Skip to content

Duplicate Input DICOM Spatial Coordinates #535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

bluna301
Copy link
Contributor

@bluna301 bluna301 commented Apr 16, 2025

Will flesh out comment more tomorrow, just wanted to get some preliminary notes down prior to tomorrow's meeting.

Solution stores each SOP instance in a new dictionary (not ideal) and checks if the combination of StudyInstanceUID, SeriesInstanceUID, and ImagePositionPatient has been seen before; if so, it removes the duplicate, with preference for the higher AcquisitionNumber. In cases where the ImagePositionPatient tag is not present (X-Ray images, some non-image DICOM files like SR, KO, PR, etc. modalities), no duplication check takes place. This approach is effective for handling the case discussed:

[2025-04-15 23:07:39,429] [INFO] (dicom_data_loader_operator.DICOMDataLoaderOperator) - No or invalid input path from the optional input port: None
[2025-04-15 23:07:39,816] [INFO] (dicom_data_loader_operator.DICOMDataLoaderOperator) - DICOM Images to Load: 312
[2025-04-15 23:07:39,838] [INFO] (dicom_data_loader_operator.DICOMDataLoaderOperator) - Duplicate spatial coordinates detected; removing duplicate SOP at IPP (-250.0, -250.0, -746.25) in Series 1.2.840.113619.2.405.3.185216268.497.1730719949.233; kept SOP instance with higher AcquisitionNumber (3 > 2)
[2025-04-15 23:07:39,845] [INFO] (dicom_data_loader_operator.DICOMDataLoaderOperator) - DICOM Images Loaded: 311

I tested on ~20 clinical studies each for CT, CR, and MR modalities:

  • CT: removes duplicate when present (just on the 1 study); all other cases have no duplicates
  • CR: no duplicates present (ImagePositionPatient is absent), therefore no changes from existing loading functionality
  • MR: removes a significant number of duplicates per study (sometimes around ~50% of total study images); repeated ImagePositionPatient values seem to be quite common for T1 mDIXON, mDIXON-Quant, SE-EPI MRE series; will provide anonymized version to illustrate

I wonder if it is worth having an input parameter to the operator to control whether or not duplicates are checked for. For example, if a user is targeting MR mDIXON series for inference (not sure how common this is), the duplicate check should probably be turned off to prevent a large number of SOP instances from not being loaded.

Finally, I am wondering how arbitrary referencing the higher AcquisitionNumber value is; besides the single test case, do we have any additional justification for using this approach?

Signed-off-by: bluna301 <luna.bryanr@gmail.com>
Copy link

@bluna301 bluna301 requested review from vikashg and MMelQin April 16, 2025 04:04
Copy link
Collaborator

@MMelQin MMelQin left a comment

Choose a reason for hiding this comment

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

Look good to me. Thanks a lot.

@bluna301 bluna301 marked this pull request as draft April 16, 2025 17:08
@MMelQin MMelQin marked this pull request as ready for review April 21, 2025 18:00
@MMelQin MMelQin merged commit c87bce2 into Project-MONAI:main Apr 21, 2025
4 checks passed
MMelQin pushed a commit that referenced this pull request Apr 22, 2025
Signed-off-by: bluna301 <luna.bryanr@gmail.com>
@MMelQin MMelQin linked an issue Apr 23, 2025 that may be closed by this pull request
@bluna301
Copy link
Contributor Author

bluna301 commented May 9, 2025

Thanks Ming. Future work may need to be done to make this functionality optional (say, for example, the desired series for inference is an mDIXON MR series that has duplicate ImagePositionPatient values). But I think this is good for now!

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.

[IMP] Duplicate Input DICOM Spatial Coordinates
3 participants