Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

Context

Fixes OHI-2199

The "Percentage of Max SUV" input field in the TMTV module currently accepts any characters (including special characters like +, -, e), which can lead to incorrect segmentation results when the "Run" button is clicked. This PR implements proper input validation to ensure only valid numeric values between 0-1 are accepted.

Link to Devin run: https://app.devin.ai/sessions/47b223d146cc4f2d90e100f8bc9d33cd
Requested by: @sedghi

Changes & Results

Before:

  • Basic Input component with type="text" that accepts any characters
  • No validation constraints on input values
  • Raw string values passed to threshold calculations

After:

  • Replaced with Numeric.Container and Numeric.NumberInput from @ohif/ui-next
  • Added validation constraints: min={0}, max={1}, step={0.01}
  • Automatic value clamping and rejection of invalid characters
  • Numeric values passed directly to calculations instead of strings

Key Changes:

  1. Component Migration: Replaced Input with Numeric.Container compound component
  2. Validation Logic: Added min/max constraints to enforce 0-1 range for percentage values
  3. Type Safety: onChange handler now receives numeric values instead of string values
  4. User Experience: Invalid characters are automatically rejected, out-of-range values are clamped

Testing

⚠️ Critical Testing Note: Due to difficulty accessing the Rectangle ROI Threshold panel during development, the UI changes have not been fully tested in the browser. Manual testing is essential.

To test this change:

  1. Open OHIF Viewer and navigate to a study with both CT and PT modalities
  2. Enter TMTV mode and create a segmentation
  3. Access the Rectangle ROI Threshold tool to open the ROI configuration panel
  4. Locate the "Percentage of Max SUV" input field
  5. Test validation by trying:
    • Valid values: 0.75, 0.5, 1.0, 0.0
    • Invalid values that should be clamped: 1.5 (→ 1.0), -0.5 (→ 0.0)
    • Invalid characters that should be rejected: abc, +, -, e
  6. Verify that the "Run" button produces correct segmentation results

Checklist

PR

  • My Pull Request title is descriptive, accurate and follows the semantic-release format and guidelines.

Code

  • My code has been well-documented (function documentation, inline comments, etc.)

Public Documentation Updates

  • The documentation page has been updated as necessary for any public API additions or removals.

Tested Environment

  • OS: Ubuntu Linux
  • Node version: 22.11.0
  • Browser: Chrome (via development server)

Human Review Checklist:

  • CRITICAL: Test the actual UI to ensure the Numeric component renders correctly in the TMTV Rectangle ROI Threshold panel
  • Verify that numeric validation constraints (0-1 range) work as expected
  • Test that invalid characters are properly rejected
  • Ensure that weight values are properly handled in threshold calculations
  • Check for any regressions in ROI threshold functionality
  • Verify that the component styling matches the existing design

- Replace Input with Numeric.Container and Numeric.NumberInput from @ohif/ui-next
- Add validation constraints: min=0, max=1, step=0.01
- Ensure proper numeric value handling in onChange handler
- Prevent invalid characters and out-of-range values

Fixes OHI-2199

Co-Authored-By: Alireza <[email protected]>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@netlify
Copy link

netlify bot commented Sep 19, 2025

Deploy Preview for ohif-dev ready!

Name Link
🔨 Latest commit b756125
🔍 Latest deploy log https://app.netlify.com/projects/ohif-dev/deploys/68ccbc7a59560e0008b06588
😎 Deploy Preview https://deploy-preview-5418--ohif-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@cypress
Copy link

cypress bot commented Sep 19, 2025

Viewers    Run #5542

Run Properties:  status check passed Passed #5542  •  git commit b756125c00: Fix validation for Percentage of Max SUV input field
Project Viewers
Branch Review devin/OHI-2199-1758247230
Run status status check passed Passed #5542
Run duration 02m 21s
Commit git commit b756125c00: Fix validation for Percentage of Max SUV input field
Committer Devin AI
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 37
View all changes introduced in this branch ↗︎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant