Skip to content

Conversation

@tblock79
Copy link
Contributor

Context

Currently, the WADO-RS dicomImageLoader uses only the DICOM tag "PixelSpacing" (0028,0030) for setting the size of the loaded pixels. However, for projection radiography studies (DX, CR), this DICOM tag can be missing. Such DICOM files instead have the tag ImagerPixelSpacing (0018,1164) (which additionally may need to be corrected according to the EstimatedRadiographicMagnificationFactor tag).

If the PixelSpacing tag is missing, the measurement tools currently show a value in pixels, but the shown unit is "mm". Hence, it shows incorrect values. This discrepancy arises because the annotation tools use the calibratedPixelSpacingMetadataProvider for determining which unit should be shown, while the measurement value is calculated via canvas-to-world conversions, which account only for the pixel spacing set during loading of the image.

Therefore, this PR modifies the WADO-PR loader to utilize the pixel spacing from the calibratedPixelSpacingMetadataProvider when loading the image pixel data, as the corrected pixel spacing is typically already available there (calculated with the function getPixelSpacingInformation when processing the WADO-RS metadata call). If the calibratedPixelSpacingMetadataProvider does not have an entry for the current imageId, it falls back to the PixelSpacing tag (0028,0030), as before.

Changes & Results

  • Changed the metaDataProvider.ts of the wadors loader and changed the handler for MetadataModules.IMAGE_PLANE to read the prior-calculated pixel spacing from the calibratedPixelSpacingMetadataProvider.
  • The measurement tools now show the correct metric values instead of pixel values for DX/CR studies with absent PixelSpacing DICOM tag.

Testing

Checklist

  • Load DX and/or CR studies and validate that the correct (non-pixel) values are shown if a measurement tool (e.g., the LengthTool) show the unit "mm".

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: Windows 11"
  • "Node version: 22.17.0"
  • "Browser: Chrome 142.0, Firefox 143.0"

};
}

if (type === MetadataModules.IMAGE_PLANE) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code has been moved to shared code between different types of instance data.

export const PIXEL_INSTANCE = 'PixelInstanceModule';

export class ImagePlaneModule extends Module<Types.ImagePlaneModuleMetadata> {
public fromInstance(instance) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the standard implementation from OHIF in the fromInstance. Making sure everyone goes through the single standard implementation allows for fixing the implementation as required for various types of new implementations.

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.

3 participants