Skip to content

fix(measurements): read displayName in SplineROI and PlanarFreehandROI reports#5908

Open
GhadeerAlbattarni wants to merge 1 commit intoOHIF:masterfrom
GhadeerAlbattarni:fix/spline-freehandROI-report-displayname
Open

fix(measurements): read displayName in SplineROI and PlanarFreehandROI reports#5908
GhadeerAlbattarni wants to merge 1 commit intoOHIF:masterfrom
GhadeerAlbattarni:fix/spline-freehandROI-report-displayname

Conversation

@GhadeerAlbattarni
Copy link
Collaborator

@GhadeerAlbattarni GhadeerAlbattarni commented Mar 19, 2026

Context

Related to issue #5588

  • getColumnValueReport in PlanarFreehandROI.ts and SplineROI.ts was destructuring { name, value } from each report config item, but the cornerstone.measurements customization schema defines displayName, not name.
  • This caused all measurement-specific column headers (Mean, Max, Area, Unit) not to be read in downloaded CSV reports.

Changes & Results

  • PlanarFreehandROI.ts — changed { name, value }{ displayName, value } in getColumnValueReport
  • SplineROI.ts — same fix

Before
The report were missing some entries like:

  • Area and Unit for SplineROI
  • Mean, Max, Area and Unit for PlanarFreehandROI

After
The report has all the missing fields above.

Testing

  1. Open a study in the viewer mode
  2. Draw a PlanarFreehandROI annotation on an image
  3. Draw a SplineROI annotation on an image
  4. Open the measurement panel
  5. Download the CSV report from the measurements panel
  6. Verify column headers (Mean, Max, Area, Unit) are correctly labelled

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:
  • [] Node version:
  • [] Browser:

Greptile Summary

This PR fixes a bug where getColumnValueReport in PlanarFreehandROI.ts and SplineROI.ts destructured { name, value } from customization report config items, but the cornerstone.measurements customization schema (defined in measurementsCustomization.ts) uses displayName, not name. Because name was always undefined, the downloadCSVReport logic in platform/core/src/utils/downloadCSVReport.js was collapsing all measurement-specific columns (Mean, Max, Area, Unit) into a single column named undefined — with each subsequent value overwriting the previous one. The fix correctly aligns the destructuring key to displayName, so each statistic gets its own properly labelled CSV column.

  • Both PlanarFreehandROI.ts and SplineROI.ts now destructure { displayName, value } in getColumnValueReport, consistent with the cornerstone.measurements schema.
  • The change is minimal, surgical, and consistent with how other measurement tool mappings (e.g. CircleROI.ts) build their column lists.
  • A minor whitespace cleanup (if( !cachedStats )if (!cachedStats)) is included in PlanarFreehandROI.ts.

Confidence Score: 5/5

  • This PR is safe to merge — the fix is minimal, correct, and directly matches the existing customization schema definition.
  • The root cause (schema uses displayName, not name) is clearly confirmed by measurementsCustomization.ts. The downstream downloadCSVReport.js logic relies on column names being meaningful strings for Array.includes / Array.indexOf lookups, so the fix unblocks the correct CSV output. No new logic is introduced and no regressions are expected.
  • No files require special attention.

Important Files Changed

Filename Overview
extensions/cornerstone/src/utils/measurementServiceMappings/PlanarFreehandROI.ts Correctly renames namedisplayName in getColumnValueReport to match the cornerstone.measurements customization schema. Includes a minor whitespace cleanup (if( !cachedStats )if (!cachedStats)).
extensions/cornerstone/src/utils/measurementServiceMappings/SplineROI.ts Correctly renames namedisplayName in getColumnValueReport, mirroring the same fix applied to PlanarFreehandROI.ts.

Sequence Diagram

sequenceDiagram
    participant User
    participant MeasurementsPanel
    participant downloadCSVReport
    participant getColumnValueReport
    participant measurementsCustomization

    User->>MeasurementsPanel: Click "Download CSV"
    MeasurementsPanel->>downloadCSVReport: measurementData[]
    loop For each measurement
        downloadCSVReport->>getColumnValueReport: annotation, customizationService
        getColumnValueReport->>measurementsCustomization: getCustomization('cornerstone.measurements')
        measurementsCustomization-->>getColumnValueReport: report: [{ displayName, value }]
        Note over getColumnValueReport: Before fix: destructured { name } → undefined<br/>After fix: destructured { displayName } → 'Mean','Max','Area','Unit'
        getColumnValueReport-->>downloadCSVReport: { columns: ['AnnotationType','Mean',...], values: [...] }
    end
    downloadCSVReport->>downloadCSVReport: Build column index map
    downloadCSVReport->>User: MeasurementReport.csv with correct headers
Loading

Last reviewed commit: "fix(measurements): r..."

@netlify
Copy link

netlify bot commented Mar 19, 2026

Deploy Preview for ohif-dev ready!

Name Link
🔨 Latest commit 0ce9549
🔍 Latest deploy log https://app.netlify.com/projects/ohif-dev/deploys/69bc5d23675f1c0008043282
😎 Deploy Preview https://deploy-preview-5908--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.

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