Oops. Dicom image had wrong length

Skip to first unread message

Dylan Hsu

Nov 3, 2020, 11:05:14 AM11/3/20
to Plastimatch

I'm trying to convert some new Dicom series to nifti files. I've used plastimatch extensively for over a year and this is the first time I saw this issue.

Example command:
plastimatch convert --input <dicom-folder> --output-img niftifile.nii.gz

Error output:
Oops. Dicom image had wrong length (196126 vs. 512 x 512)

Of the batch scans I'm trying to convert, this seems to be a small minority. Any tips on debugging this?

Best regards,

Mikhail Polkovnikov

Nov 6, 2020, 3:58:56 AM11/6/20
to Plastimatch
Have you tried to open that series in any kind of medical viewer? It is possible that image data was cropped but DICOM tag responsible for image width and height were left the same. You can also try to use dcmdump command from DCMTK to check dump of dicom tags values.

Best regards,

Dylan Hsu

Nov 11, 2020, 11:03:52 AM11/11/20
to Plastimatch
Following up on this, it looks like when this happens, one image in the series was not fully downloaded. In a normal scenario all of the individual files of the series have the same file size. So it was a problem upstream.


Sharp, Gregory C.

Dec 3, 2020, 3:53:03 PM12/3/20
to plast...@googlegroups.com

Hi Dylan,

Thank you for reporting this.  I have run into this problem once before, but didn't have time to fix it yet.  I have opened a ticket for this.






From: plast...@googlegroups.com <plast...@googlegroups.com> On Behalf Of Dylan Hsu
Sent: Wednesday, November 11, 2020 11:04 AM
To: Plastimatch <plast...@googlegroups.com>
Subject: [Plastimatch] Re: Oops. Dicom image had wrong length


        External Email - Use Caution        

You received this message because you are subscribed to the Google Groups "Plastimatch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plastimatch...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/plastimatch/5b2e786e-2900-483b-8e4d-c741a97504adn%40googlegroups.com.

The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Mass General Brigham Compliance HelpLine at http://www.massgeneralbrigham.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.

Dennis Bontempi

Oct 15, 2021, 10:39:44 AMOct 15
to Plastimatch
Hey All!

Thanks Mikhail and Gregory for looking into this.
I'm experiencing the same problem described by Dylan and also never had this issue before, despite having been a Plastimatch user for quite some time now.

In my case, the error message looks like this:

>> Oops.  Dicom image had wrong length (0 vs. 512 x 512).

I can't share the data I'm dealing with for PHI reasons. However, hoping to help you guys out on this, I tried to debug the problem in a few different ways:
  1. I tried to inspect DICOM metadata of the the CT scan(s) raising the Plastimatch error - using 3DSlicer. Everything looks fine.
  2. I tried to load the CT scan(s) using 3DSlicer. Everything works fine.*
  3. I tried to convert the CT scan(s) to NRRD using 3DSlicer. Everything looks fine.
  4. I tried to load the PixelData from each of the .dcm files, and inspect their shape: all are 512x512 as expected.
  5. I tried to load the CT scan(s) using SITK's python APIs:
    file_reader = sitk.ImageFileReader()
    file_names = sitk.ImageSeriesReader.GetGDCMSeriesFileNames(PATH_TO_SERIES)
    img = sitk.GetArrayFromImage(sitk.ReadImage(file_names))
    >> (57, 512, 512)
     [N.B.: this is the correct size, and the volume looks ok]

* this could be totally unrelated, but 3DSlicer notified me this:
>> XYZ: Unnamed Series [Scalar Volume]: Multi-frame image. If slice orientation or spacing is non-uniform then the image may be displayed incorrectly. Use with caution.

Plastimatch is the go-to SW for most of the pre-processing I do on images - so I would love to help you folks solve the problem :-)

Thank you in advance,
Reply all
Reply to author
0 new messages