# ITK-snap cannot load DICOM

**URL:** https://discourse.itk.org/t/itk-snap-cannot-load-dicom/4351
**Category:** Engineering
**Tags:** dicom, simpleitk, python
**Created:** [August 24, 2021, 5:53am UTC](https://discourse.itk.org/t/itk-snap-cannot-load-dicom/4351 "2021-08-24T05:53:16Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Won\_Chul\_Chung](https://discourse.itk.org/user_avatar/discourse.itk.org/won_chul_chung/32/2227_2.png) [@Won\_Chul\_Chung](https://discourse.itk.org/u/Won_Chul_Chung)
#### Post date: [August 24, 2021, 5:53am UTC](https://discourse.itk.org/t/itk-snap-cannot-load-dicom/4351/1 "2021-08-24T05:53:16Z")

</div>

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:

 ![오가노이드_CT의 메타데이터](https://discourse.itk.org/uploads/default/original/2X/d/d4197f7db5ed7d32b4f17f03713621b20246fe2a.jpeg)

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

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [August 24, 2021, 1:12pm UTC](https://discourse.itk.org/t/itk-snap-cannot-load-dicom/4351/2 "2021-08-24T13:12:50Z")

</div>

Latest ITK-SNAP (version 3.8.0) uses a pretty old ITK version (4.12.2). Current version of ITK ([example](https://itk.org/ITKExamples/src/IO/GDCM/ReadDICOMSeriesAndWrite3DImage/Documentation.html)) reads the sample without issue. Perhaps ask for a refreshed build on [ITK-SNAP mailing list](http://www.itksnap.org/pmwiki/pmwiki.php?n=MailingLists.MailingLists)?

---

<div class="post-metadata">

### Author: ![dchen](https://discourse.itk.org/user_avatar/discourse.itk.org/dchen/32/34_2.png) [@dchen](https://discourse.itk.org/u/dchen)
#### Post date: [August 24, 2021, 8:09pm UTC](https://discourse.itk.org/t/itk-snap-cannot-load-dicom/4351/3 "2021-08-24T20:09:51Z")

</div>

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](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](https://simpleitk.readthedocs.io/en/master/link_DicomSeriesFromArray_docs.html)

---

<div class="post-metadata">

### Author: ![Won\_Chul\_Chung](https://discourse.itk.org/user_avatar/discourse.itk.org/won_chul_chung/32/2227_2.png) [@Won\_Chul\_Chung](https://discourse.itk.org/u/Won_Chul_Chung)
#### Post date: [August 25, 2021, 6:34am UTC](https://discourse.itk.org/t/itk-snap-cannot-load-dicom/4351/4 "2021-08-25T06:34:26Z")

</div>

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

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.itk.org/user_avatar/discourse.itk.org/lassoan/32/27_2.png) [@lassoan](https://discourse.itk.org/u/lassoan)
#### Post date: [August 25, 2021, 6:29pm UTC](https://discourse.itk.org/t/itk-snap-cannot-load-dicom/4351/5 "2021-08-25T18:29:46Z")

</div>

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).

---

<div class="post-metadata">

### Author: ![Won\_Chul\_Chung](https://discourse.itk.org/user_avatar/discourse.itk.org/won_chul_chung/32/2227_2.png) [@Won\_Chul\_Chung](https://discourse.itk.org/u/Won_Chul_Chung)
#### Post date: [August 27, 2021, 12:44am UTC](https://discourse.itk.org/t/itk-snap-cannot-load-dicom/4351/6 "2021-08-27T00:44:39Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.itk.org/user_avatar/discourse.itk.org/lassoan/32/27_2.png) [@lassoan](https://discourse.itk.org/u/lassoan)
#### Post date: [August 27, 2021, 1:24am UTC](https://discourse.itk.org/t/itk-snap-cannot-load-dicom/4351/7 "2021-08-27T01:24:41Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Saeiditi](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/cdc98d/32.png) [@Saeiditi](https://discourse.itk.org/u/Saeiditi)
#### Post date: [June 5, 2023, 3:51am UTC](https://discourse.itk.org/t/itk-snap-cannot-load-dicom/4351/8 "2023-06-05T03:51:16Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.itk.org/user_avatar/discourse.itk.org/lassoan/32/27_2.png) [@lassoan](https://discourse.itk.org/u/lassoan)
#### Post date: [June 9, 2023, 5:41pm UTC](https://discourse.itk.org/t/itk-snap-cannot-load-dicom/4351/9 "2023-06-09T17:41:19Z")

</div>

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, …).

---

<div class="post-metadata">

### Author: ![Carina\_C\_Gipson](https://discourse.itk.org/user_avatar/discourse.itk.org/carina_c_gipson/32/4527_2.png) [@Carina\_C\_Gipson](https://discourse.itk.org/u/Carina_C_Gipson)
#### Post date: [May 21, 2025, 6:25pm UTC](https://discourse.itk.org/t/itk-snap-cannot-load-dicom/4351/10 "2025-05-21T18:25:02Z")

</div>

Was experiencing same problem.. try setting file format to DICOM single image rather than ECHO cart dicom
