ITK-SNAP 4.0 error opening dicom image series

209 views
Skip to first unread message

Jason Yuan

unread,
May 4, 2023, 10:45:25 AM5/4/23
to itksnap-users
Hello, 
I'm using ITK-SNAP 4.0 to annotate several MRI ADC images. When I finish one annotation, I drag another image file/folder to the main window, and the "open image" window is supposed to pop up.

The error occurs when I'm trying to open another dicom image series. The error message is "invalid string position". Then the software shuts down.
无标题.png

I have tested several combinations:
1. opened dicom series + drag to open another dicom series: error
2. opened nifti + drag  to open another dicom series: error
3. opened dicom series + drag  to open another nifti: no error
4. opened  nifti + drag  to open another nifti: no error

For ITK-SNAP 3.6 and 3.8, the error does not occur.

The error does not occur if I close the current image using "File - Close image" before I drag another dicom folder into the main window. 

It seems the error is image-agnostic, and I cannot share the image files that generate the error.

The platform is Windows 10

Best regards,
Jason Yuan

Jilei Hao

unread,
May 4, 2023, 3:39:48 PM5/4/23
to itksna...@googlegroups.com
Hi Jason,

I tried dragging a dicom series to an existing window and loading as the main image. The new image loaded without any problem. 

When you dragged the image to the window, were you open it as a main image? Also, are you using 4.0.0 or 4.0.1?

Best,
Jilei



--
You received this message because you are subscribed to the Google Groups "itksnap-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to itksnap-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/itksnap-users/620841ec-ef3a-4fff-8bbd-5aac082925dan%40googlegroups.com.

kyle drover

unread,
May 4, 2023, 8:16:46 PM5/4/23
to itksnap-users
Hi Jason,

not a dev but a potential quick work-around  (if you have a little bit of coding experience) is to convert the DICOMs to NRRDs. 

Through the Windows Ubuntu App (you can download it from the Microsoft store , you can write a bash file (*.sh) containiing something like:

#!/bin/bash

#DICOM to NRRD  file  bash script

# get the latest dcm to niix and unzip - ToDO: decide whether to just download the zip or proper install...

curl -fLO https://github.com/rordenlab/dcm2niix/releases/latest/download/dcm2niix_lnx.zip
unzip dcm2niix_lnx.zip

#loops through folders
mkdir nrrd_out
for directory in */;
do
    #Go within the specific DICOM directory:
    dir_name=${directory%/*// /_}
    cd ${dir_name}

    #Error trap for spaces in dicom filenames from previous PhD student
    for f in *\ *; do mv "$f" "${f// /_}"; done

    #Make directory and perform the conversion
    cd ../

    #TODO: check if -l o/n is better!!!!
    ./dcm2niix -1 -d 0 -f ${dir_name%/} -o nrrd_out -e y -z n ${dir_name}

    #Do some basic clean-up - we don't care about .json files
    rm nrrd_out/*.json
done



and then type ./"MY_BASH_SCRIPT".sh to run it and that should do the conversion automatically, then load the NRRD files (they will be in a folder called nrrd_out).

Jason Yuan

unread,
May 4, 2023, 9:25:02 PM5/4/23
to itksnap-users
Hi Jilei,
Sorry I made a mistake. It's not the "open image" window but the "open document" window that is soppused to pop up. 

When I dragged the image to the existing window, the error occured and the "open document" window did not pop up. The version is 4.0.1.

I tried another CT dataset, and the error also occured. 

Great appreciation for your efforts in making ITK-SNAP a better image segmentation software.

Let me know if there's anything I could do to help debug.

Best regards,
Jason Yuan

Jason Yuan

unread,
May 4, 2023, 9:30:27 PM5/4/23
to itksnap-users
Hi kyle,

Thank you for your advise. Converting to a single file is an easy and effective solution.

Best regards,
Jason Yuan

Jilei Hao

unread,
May 30, 2023, 10:30:00 AM5/30/23
to itksnap-users
Hi Jason,

Is there any sample dataset causing error than can be shared for troubleshoot?

Best,
Jilei

Jason Yuan

unread,
Jun 9, 2023, 11:43:24 AM6/9/23
to itksnap-users
Hello Jilei,

You may use the public dicom files in python package "pydicom" (https://github.com/pydicom/pydicom). The files are in ".\pydicom\data\test_files\dicomdirtests". I can reproduce the error with these files.

Best regard,
Jason
Reply all
Reply to author
Forward
0 new messages