Skip to content
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

[Bug] Viewing CT and SEG DICOM files in OHIF converted from nifti #3682

Open
deepakri201 opened this issue Sep 27, 2023 · 15 comments
Open

[Bug] Viewing CT and SEG DICOM files in OHIF converted from nifti #3682

deepakri201 opened this issue Sep 27, 2023 · 15 comments
Labels
Awaiting Reproduction Can we reproduce the reported bug?

Comments

@deepakri201
Copy link

deepakri201 commented Sep 27, 2023

Hi,

I have deployed my own viewer app using the https://github.com/ImagingDataCommons/Viewers master branch here. It has been working with no issues -- however now I have been working with a different set of files, and have encountered an issue.

I have a nifti CT file that I converted to a DICOM series using the slicer.modules.createdicomseries module. I then converted the associated label nifti file to a DICOM SEG file using dcmqi. When I load these converted DICOM files into Slicer, they load with no visible issues:

image

However, when I view the same DICOM files in OHIF, the following occurs:

video.mp4

Here are the DICOM CT and SEG files in dropbox.

Thank you,

Deepa

Steps to Reproduce

  1. Deployed my own viewer app using the https://github.com/ImagingDataCommons/Viewers master branch
  2. Converted the CT nifti file to DICOM series using slicer.modules.createdicomseries
  3. Converted the label nifti file to DICOM using dcmqi
  4. Added DICOM files to a dataset and DICOM datastore and accessed in the deployed viewer

The current behavior

Currently, both the CT and SEG do not load properly:

video.mp4

The expected behavior

It should look something like this:

image

OS

Windows 10

Node version

I'm not sure

Browser

Chrome 116.0.5845.188

@deepakri201 deepakri201 added the Awaiting Reproduction Can we reproduce the reported bug? label Sep 27, 2023
@pieper
Copy link
Member

pieper commented Sep 27, 2023

I'm not sure exactly what's going on, but one clue could be that this data is tilted with respect to typical patient alignment (you can see this in the green / coronal view in Slicer, where the person is leaning to one side). You can see this with the non-identify ImagePostiionPatient tag in the dicoms. This is unusual for a CT, and maybe it interferes with some heuristics.

@deepakri201
Copy link
Author

deepakri201 commented Sep 27, 2023

@pieper I thought this looked strange too. Just to check I loaded the original CT nifti and label nifti file (they are from TotalSegmentator training data), and they look like the DICOM files:

image

@pieper
Copy link
Member

pieper commented Sep 27, 2023

@deepakri201 where you able to try OHIF v3 on this data? It has a different approach and might not have this issue.

@fedorov
Copy link
Member

fedorov commented Sep 28, 2023

@igoroctaviano has GCP store selection been integrated into v3? If yes, testing this should be trivial with our existing IDC v3 sandbox. If not, we should just wait until that feature is ready and revisit then.

@fedorov
Copy link
Member

fedorov commented Sep 29, 2023

@sedghi
Copy link
Member

sedghi commented Oct 3, 2023

Can you try OHIF v3 (latest master branch) and see if you still have this issue?

@igoroctaviano
Copy link
Contributor

@sedghi this is how it looks using /local:

Screenshot 2023-10-03 at 11 30 55

@sedghi
Copy link
Member

sedghi commented Oct 3, 2023

At least it shows something in v3 (compared to v2 :D)
Is there anything specific regarding this SEG compared to other SEGs?

@igoroctaviano
Copy link
Contributor

@sedghi It does load in v2 but the window level is messed up too.
@fedorov any updates about this seg?

Screenshot 2023-10-03 at 12 17 23

@igoroctaviano igoroctaviano added this to Priority in IDC via automation Oct 20, 2023
@igoroctaviano igoroctaviano added the IDC:candidate Possible feature requests for discussion, and if we agree, they can be relabeled IDC:priority label Oct 20, 2023
@fedorov
Copy link
Member

fedorov commented Oct 20, 2023

We reviewed this example with David Clunie, and he noticed that the slices have rather unusual for a typical DICOM resolution (since the original DICOM data was resampled and cropped prior to creating the source NIfTIs), resulting in an odd number of pixels in a frame, which may trigger a bug in OHIF v2. We will investigate this further with the OHIF team, and will try to make sure this is fixed for OHIF v3.

Deepa, can you try padding the original image to some typical matrix (ie 256x256 or 512x512) and see if that fixes the issue?

@deepakri201
Copy link
Author

Still using OHIF v2 -- I tried padding the volume as @fedorov suggested, and now the CT/SEG load successfully in OHIF (as well as in Slicer).

image

TotalSegmentator_DICOM_OHIF_video.mp4

@fedorov
Copy link
Member

fedorov commented Oct 31, 2023

Thank you, this confirms the source of the problem I think. For our purposes, it makes sense to pad those images to standard matrix size.

In general, for OHIF maintainers, I think it is important to be aware of this bug in OHIF, but fixing it is most definitely not a priority for IDC.

@fedorov fedorov removed the IDC:candidate Possible feature requests for discussion, and if we agree, they can be relabeled IDC:priority label Oct 31, 2023
@sedghi
Copy link
Member

sedghi commented Oct 31, 2023

Deepa, can you try padding the original image to some typical matrix (ie 256x256 or 512x512) and see if that fixes the issue?

@fedorov so what was the problem? the labelmap was not the same exact size of the reference?

@fedorov
Copy link
Member

fedorov commented Oct 31, 2023

My current understanding is that he problem is that when the Rows*Columns of the image result in a number that is odd, or maybe not divisible by 8 resulting in lack of byte boundary alignment of bit-packed SEG content, or something like that (I have not debugged, so I do not know for sure) - bad things will happen with SEG in OHIF. If someone would like to debug this further, the sample provided by @deepakri201 in the initial post should be a good start.

@sedghi
Copy link
Member

sedghi commented Oct 31, 2023

Great explanation thanks

@fedorov fedorov removed this from Priority in IDC Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Reproduction Can we reproduce the reported bug?
Projects
None yet
Development

No branches or pull requests

5 participants