ITK-snap cannot load DICOM

Hello,

I am relatively new to python and itk.

I originally started with MicroCT scan images with .tif extension. (single series, about 500 “slices”)
I then transformed the slices into DICOM series using simpleitk functions.

I expect ITK-snap to recognize the DICOM series and visualize the 3D volume representation but instead it gave me the following error saying vector is too long:

My guess is that ITK snap recognizes the instance number (“slices”) information but does not know that the DICOM series is a single volumetric data because it does not contain any geometrical information.
Maybe during the tif->dcm conversion I missed out essential metadata information.
Any ideas on how I might fix this?

thanks

Latest ITK-SNAP (version 3.8.0) uses a pretty old ITK version (4.12.2). Current version of ITK (example) reads the sample without issue. Perhaps ask for a refreshed build on ITK-SNAP mailing list?

1 Like

If you have a stack of TIFF images, you don’t really have the meta data information that a DICOM series would need, such as Z spacing. Even if you want to apply some Z spacing, individually converting each TIFF into a DICOM will not get you a series.

What you need to do is read all the TIFF images, then use the JoinSeriesImageFilter to create a 3d volume from the stack of images.

Here’s the doc for JoinSeriesImageFilter:
https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1JoinSeriesImageFilter.html

It’s going to create a volume of cubic voxels, so if your Z spacing is something else, use the Image’s SetSpacing method to change it voxel spacing.

Once you have the 3d volume, you can use the writeSlices function from the following example to write out a DICOM series.

https://simpleitk.readthedocs.io/en/master/link_DicomSeriesFromArray_docs.html

1 Like

Thank you Dave Chen,
I now understand what my problem is. I’ll look into your solution

1 Like

If you are not sure how to create valid DICOM images and you only need to use the images in ITK-Snap, 3D Slicer, etc., then the simplest is to save the image in a standard research file format, such as NRRD. In fact most segmentation software can readily import 3D volumes from TIFF files.

By the way, how did you end up having a volume in TIFF files? Normally you convert DICOM to NRRD (or if you use brain images then NIFTI) and would never need to create a TIFF stack (other than maybe for adding illustrations to papers or presentations).

1 Like

hello @lassoan,

I’m working with medical image data and the data passed on to me only existed in 2D TIFF files to begin with, so I am piecing them back to volume data so I can segment it. I do not know why the scanner technician (or someone else) decided to save medical data in TIFF format.

Some hospitals disable DICOM export in their PACS client applications for “data protection”, but of course this is ineffective (you can take screenshots or photos no matter what IT admins do) and all they achieve is inconveniencing users. The clinicians may need to go to the CT console or an image review workstation where DICOM export is available.

2 Likes

Hi, I have the excat same problem as yours. I have series of 2D Tiff images which I should open in ITK-snap and do a segmentation on that. I cant open it in ITK_SNAP due so same error (Exception ocurred during image IO:vector too long). I was wondering if you came up with a solution ? Thank you.

If you want to load a TIFF stack then I would recommend to use ImageStacks module in 3D Slicer (provided by SlicerMorph extension, which you can install within Slicer by a few clicks). You can then export the image in a standard 3D file format (NRRD, DICOM, …).