[ITK] [ITK-users] Strange situation when ITK writes DICOM file

Dženan Zukić dzenanz at gmail.com
Fri Dec 25 12:44:41 EST 2015


​I have confirmed this bug and entered it into tracker
<https://issues.itk.org/jira/browse/ITK-3407> along with a DICOM series
which reproduces it.​

Thanks Shen

On Tue, Dec 22, 2015 at 8:41 PM, 沈庄明 <zhuangming.shen at sphic.org.cn> wrote:

> Hi all,
>
>
> I met a very strange situation when I used ITK 4.8.1. I'd like to read a
> DICOM series, write it to a DICOM file (i.e. save the volume created by the
> DICOM series to a .dcm file), and read the DICOM file. Theoretically, the
> DICOM series and the DCM file should have the same information, e.g origin,
> spacing, size. However, My results show me that the information has been
> changed. When I use other ITK-support file format (e.g. nii, nrrd), the
> information has not been changed. It seems a bug. My code and results are
> listed as below. Has anyone met the same situation?
>
>
> Regards,
>
>
> Zhuangming Shen
>
>
>
>>
> ================   My code  =================
>
>
> import itk
>
> input_dir = "/home/zshen/workspace/Data/testDCM/bbb"
> output_filename = "/home/zshen/workspace/Data/bbb2.dcm"
>
> # read DICOM series
> dicom_io = itk.GDCMImageIO.New()
>
> reader = itk.ImageSeriesReader[itk.Image.SS3].New()
> reader.SetImageIO(dicom_io)
>
> name_generator = itk.GDCMSeriesFileNames.New()
> name_generator.SetUseSeriesDetails(True)
> name_generator.SetDirectory(input_dir)
>
> series_uid = name_generator.GetSeriesUIDs()
>
> series_identifier = series_uid[0]
>
> file_names = name_generator.GetFileNames(series_identifier)
>
> reader.SetFileNames(file_names)
> reader.Update()
>
> print("****  series DICOM information: *****")
> print("size:
> "+str(reader.GetOutput().GetLargestPossibleRegion().GetSize()))
> print("origin: "+str(reader.GetOutput().GetOrigin()))
> print("spacing: "+str(reader.GetOutput().GetSpacing()))
>
> writer = itk.ImageFileWriter[itk.Image.SS3].New()
> writer.SetInput(reader.GetOutput())
> writer.SetFileName(output_filename)
> writer.Update()
>
> # read again
> reader2 = itk.ImageFileReader[itk.Image.SS3].New()
> reader2.SetFileName(output_filename)
> reader2.Update()
>
> print("****  DICOM information: *****")
> print("size:
> "+str(reader2.GetOutput().GetLargestPossibleRegion().GetSize()))
> print("origin: "+str(reader2.GetOutput().GetOrigin()))
> print("spacing: "+str(reader2.GetOutput().GetSpacing()))
>
>
> =================  My results ====================
> ****  series DICOM information: *****
> size: itkSize3 ([512, 512, 118])
> origin: itkPointD3 ([-229.5, -96.5, -553])
> spacing: itkVectorD3 ([0.896484, 0.896484, 3])
> ****  DICOM information: *****
> size: itkSize3 ([512, 512, 118])
> origin: itkPointD3 ([0, 0, 0])
> spacing: itkVectorD3 ([0.896484, 0.896484, 1])
>
>
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20151225/bba69fb7/attachment.html>
-------------- next part --------------
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list