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

dcm2niix is not generating Volume data #8

Closed
ignaciordc opened this issue Jan 9, 2022 · 23 comments
Closed

dcm2niix is not generating Volume data #8

ignaciordc opened this issue Jan 9, 2022 · 23 comments

Comments

@ignaciordc
Copy link

I am running 3D Slicer 4.10.2, the latest that supports Mac OS Sierra (10.12)

Tried to import a stack of DICOM files, and, by default, it launched DWIConvert module, which gave me an error, for it tried to load it "as DWI Volume as a Diffusion Volume":

I googled it and found the the module assumes DCM files are DWI ("Can't find tag 29 1010"),which is not my case, hence I installed extension DCM2NiixGUI. It worked, I was a able to load the data in 3D Slicer.
However, it is unable to Render its volume. When I save the nrrd data, I can see the header contains:
thicknesses: Nan Nan 0.86
I think that is the reason it's unable to render in 3D. The original DICOM files contained
(0028, 0030) Pixel Spacing DS: [0.572917, 0.572917]
which is not reflected in the .nhdr file (Nan Nan).

Maybe the (images) raw data saved contain that info, but in any case 3DSlicer is not using it for the volume. No volume is rendered. Proyections are being displayed correctly, and respond to the slicers in the three views, but in 3D only 3 orthognal slices are shown.
The "rotate to volume plane" option is not working as expected either: I think the images in the original DICOM files are already converted to real-world coordinates in the nrrd files.

What should I do in order to to import DICOM images without DWI information and display their volume?
Thanks,
Ignacio

PS: As expected: images as shown in the original DICOM,i.e., as acquired: the original images have
(0020, 0037) Image Orientation (Patient) DS: [0.835, 0.551, 0.0, 0.110, -0.168, -0.980]
(that is, the subject is not positioned to viewer's saggital and coronal standards)
The real distance between pixels in 3D orthogonal coordinates is 0.56.
The volume extension does not help if the voxels don't have the proper info...

@ljod
Copy link
Member

ljod commented Jan 11, 2022

Hi Ignacio and thank you for reporting this! First, are your images diffusion MRI images? I can't tell from your question if they are actually DWI/diffusion MRI or not.

For DWI, DCM2Nii is developed by the amazing Chris Rorden @neurolabusc who may have some input on this issue.

If your data is DWI there is good information about using that in DCM2Nii here
https://www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage#Diffusion_Tensor_Imaging

@ignaciordc
Copy link
Author

Thanks for your quick answer!
Sorry, I forgot to mention the images are not DWI -- that is why I went and grabbed the other plugin, to explicitely avoid DWI. Thought it could handle non-DWI DICOM files... does it?

I went through the Volume tutorial of Sonia Pujol, that imports CT images in her 3DVisualizationDataset, but that has not helped me with my dataset.

The way I am going is trying to generate a new volume (numpy array) applying the 3D transforms available in nibabel source orientation.py .

I am wondering, though, if 3DSlicer (or its volume plugins) expects some other information/tags in the DICOM files (such as Siemens' CSA'), 'cause it imports the file, but only allows viewing the slices, can not render them as volume.

Thanks for your interest and help!
Ignacio

@fedorov
Copy link
Collaborator

fedorov commented Jan 11, 2022

@ignaciordc if your images are de-identified, the most efficient way to investigate this may be sharing a series from your dataset.

@neurolabusc
Copy link

I would suggest you remove Slicer from the equation:

  • Download MRIcroGL.
  • Choose the "Convert DICOM to NIfTI" item from the "Import" menu.
  • Drop your DICOM folder onto the conversion window.
  • You can now close the conversion window.
  • Drag and drop the converted NIfTI image onto MRIcroGL
  • Press the 'Options' button in the 'Layer' panel and select the 'Show header' item - what is shown as the Spacing for the three spatial dimensions?
    gl

If the results are not plausible, you can go to the dcm2niix page to file an issue.

@ignaciordc
Copy link
Author

Lauren,
If it helps you, you can download the set of images from this link:

https://www.dropbox.com/s/0gp4bwqrut1sigm/Embryo6.zip?dl=0

Ignacio

@ignaciordc
Copy link
Author

Andrey,
Yes, the images are anonimized, of course!

Chris,
The 3DSlicer will be in the equation, for the plan is to segment it once rendered.
Your SlicerGUI plugin worked fine, but, as described above, Slicer displays slices but does not render volume.
I'll give MRIcroGL a go and let you know.

Thanks both,
Ignacio

@ignaciordc
Copy link
Author

Chris,
Yep, it worked! MRIcorGL created the NifTI which imported into 3DSLicer was rendered.

Thank you all,
ignacio

PS: Issue can be closed.

@neurolabusc
Copy link

Great. As an aside, I did not mean remove slicer from the equitation for your workflow entirely. Rather, just to help trouble shoot it. It looks like you already removed the sample image, perhaps @ljod or others would like to see it to see if they can improve the Slicer import.

@ignaciordc
Copy link
Author

Chris,
Ooops! yes, I did remove it, but it was with good intentions, in order to avoid cluttering. I'm putting it back.

PS:
Some notes on those images: they seem to have noise in the black area.
If you try to convert it with Jolinda Smith's MRIConvert, it complains and states it's not a valid DICOM file. In fact, it is a Siemens CSA file, with extra header info, but not conformant to the standard. Your tool does a much better work. Only comment I have is: would love reorientation of the XY axes, rotating them around the Z axes. so that saggital is a real saggital...

I am now checking if there are better segmentation tools than the one in Slicer. Any hint?

@pieper
Copy link
Contributor

pieper commented Jan 12, 2022

Slicer's Segment Editor is very general purpose but also very powerful. You should try the latest preview release since it's much improved since 4.10.2.

If your goals is neuroimage segmentation, try the suggestions here:

https://discourse.slicer.org/t/whole-brain-automate-segmentation/21225/7

@ljod
Copy link
Member

ljod commented Jan 12, 2022 via email

@neurolabusc
Copy link

@ignaciordc

  • By default, dcm2niix will rotate 3D acquisitions like your MP-RAGE to RAS. If you do not want this, you can have dcm2niix to ignore the transform: dcm2niix -x i /path/to/dicoms. You can also turn off the flipping of the rows (y dimension) with dcm2niix -y n -x i /path/to/dicoms. The y-flipping is because DICOMs have the first row at the top of the screen (the way we read English), while the first line of NIfTI is at the bottom (the way we draw a cartesian graph, with positive values ascending in the y direction).
  • I note this data comes from an Siemens Vida running XA10. You should be aware that this was Siemens first draft of enhanced DICOM, with very impoverished meta data and some quirks. The data was acquired a few years ago, so hopefully more recent scans will be based on XA20 or XA30 that should provide a lot more data.
  • I note these images are stored with JPEGLossless:Non-hierarchical-1stOrderPrediction - be aware that this is not a particularly efficient compression scheme and the DICOM standard does not require tools to handle any form of data beyond uncompressed. This may cause issues with DICOM compatible tools. I would suggest you save data as uncompressed image data - you can use file (zstd) or disk based compression instead.

@fedorov
Copy link
Collaborator

fedorov commented Jan 12, 2022

Yep, it worked! MRIcorGL created the NifTI which imported into 3DSLicer was rendered

Is the version of dcm2niix the same in MRIcorGL and 3D SlicerDcm2Nii? It looks like the latter is using the development branch: https://github.com/SlicerDMRI/SlicerDcm2nii/blob/master/SuperBuild/External_dcm2niix.cmake#L31.

@fedorov
Copy link
Collaborator

fedorov commented Jan 12, 2022

And I would not close the issue - the reported issue is about Slicer dcm2nii extension not being able to load the image properly, which has not been resolved.

@neurolabusc
Copy link

@fedorov good catch, I suspect the extension originally used the development branch as I added a few Slicer specific features, these are all now part of the stable master branch, so the master branch should be sourced.

@lassoan
Copy link
Collaborator

lassoan commented Jan 12, 2022

I am now checking if there are better segmentation tools than the one in Slicer. Any hint?

Slicer's Segment Editor is the most versatile segmentation tool among all open-source and commercial medical imaging software that I know of. It can work with any number of input volumes, 2D/3D/4D, in any orientation, with overlapping segments, editable in 2D and 3D, with about 15-20 manual, semi-automatic, and fully-automatic segmentation tools, using classic and AI-based methods. See a general introduction here: https://slicer.readthedocs.io/en/latest/user_guide/image_segmentation.html

With all these features are exposed, Slicer can be overwhelming at first, so if you are sure that all you will ever need are basic manual contouring and region growing on a single volume then you can use ITK-Snap. General medical image segmentation tools, such as Materialize Mimics or Simpleware comes close to Slicer's feature set, but they are not much easier to use, and very expensive. Clinical segmentation tools can be easier to use and very effective for the specific segmentation tasks that they are designed for, but they impose many limitations for regulatory compliance reasons, and can be very expensive.

@fedorov
Copy link
Collaborator

fedorov commented Jan 12, 2022

the master branch should be sourced

Great, we should update and test again once this update propagates into the preview release. Will you do it Chris? I am not actively using this extension, but I do consider it very valuable, and I don't want this to fall through the cracks.

@lassoan
Copy link
Collaborator

lassoan commented Jan 12, 2022

Also note that Slicer-4.10 was released 3 years ago (build from the development version at the time). Both dcm2niix and Slicer got many bugfixes and improvements since then. Maybe everything works well with recent Slicer versions, but switching to the master branch of dcm2niix makes sense anyway. This discussion is already quite long, so I've added a separate issue to track that task: #9.

@ignaciordc
Copy link
Author

Hi,
Thanks for all your comments, and for updating the dcm2niix Slicer plugin!

I am working at home with a MacBookPro, Mac OS 10.12(Sierra) and Slicer 4.10.2 is the latest release supporting that OS. At work, Slicer 4.13.0 runs under Windows 10, but Remote Desktop (or maybe my mid-2011 hardware, stuck on openGL 1.0), doesn't let me run it.

I'll follow your advice and stick to the Segmentation Editor of Slicer.

Cheers,
Ignacio

@pieper
Copy link
Contributor

pieper commented Jan 13, 2022

Hi @ignaciordc - you may want to try a different remote desktop solution like VNC, chrome remote desktop, etc to work around the opengl issue. It's very hard for us to support older hardware/software/os versions so using the latest is always a good idea.

@lassoan
Copy link
Collaborator

lassoan commented Jan 13, 2022

If you must use Windows Remote Desktop then you can replace the hardware renderer by a software renderer (Mesa) by simply replacing a file in the Slicer installation. See instructions in the note here: https://slicer.readthedocs.io/en/latest/user_guide/get_help.html#slicer-application-does-not-start

@ignaciordc
Copy link
Author

Thanks, Andras.

Regarding dcm2niix: I have tried the plugin with Slicer 4.11.20210226 (the link to the Windows version 4.13.0, revision 30528 built 2022-01-13 is not working). It imports the images and is able to display the projections, but is not registering the data as a 3D volume. Hence, no 3D rendering.

@benjaclara

This comment was marked as off-topic.

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

No branches or pull requests

7 participants