[ITK-users] Problem with reading dicom series using SimpleITK

Francois Budin francois.budin at kitware.com
Thu Nov 3 22:26:57 EDT 2016


Hello Sara,

Your code using SimpleITK is correct. I downloaded dicom images from here
[1] and ran your code with this data and it found all the input dicom that
were in the specified folder. Can you make sure that your output DICOM
images from matlab are 2D images with the same series ID? My guess isthat
your DICOMs have different seriesID, and
reader.GetGDCMSeriesFileNames(pathDicomA) only takes the first series it
finds (if no seriesID is specified).

Hope this helps,
Francois


[1] https://midas3.kitware.com/midas/folder/7741

On Thu, Nov 3, 2016 at 8:46 PM, Sara Gh <sg.ele.eng at gmail.com> wrote:

> Hello,
>
> I have used this MATLAB
> <https://www.mathworks.com/matlabcentral/fileexchange/50974-3d-shepp-logan-phantom> code
> to create a stack of images using Shepp-Logan Phantom and saved all these
> images in dicom format using *dicomwrite* function:
>
> sizeP = [128 128 128]
>
> [p,ellipse]=phantom3dAniso(sizeP);
>
> outDir = './SLPData/';
>
> for i=1:sizeP(3)
>
>     fname = [outDir sprintf('SLP%06d.dcm', i)];
>
>     dicomwrite(p(:,:,i), fname)
> end
>
> So, I have 128 dicom files ('SLP000001.dcm', 'SLP000002.dcm', ... ,
> 'SLP000128.dcm' ) in the 'SLPData' folder. Now, I am trying to read
> these dicom images in Python using SimpleITK:
>
> pathDicomA = '/SLPData'
> reader = sitk.ImageSeriesReader()
> dicom_namesA = reader.GetGDCMSeriesFileNames(pathDicomA)
> reader.SetFileNames(dicom_namesA)
> imageA = reader.Execute()
>
> However, when I run the code, it only reads in one of the images
> instead of the whole series:
>
> dicom_namesA => ('.../SLPData/SLP000108.dcm',)
> imageA.GetSize()  => (128, 128, 1)
>
> I am wondering what is causing this issue and how I should resolve it?
>
> Thanks in advance!
>
> Best regards,
> Sara
>
> _____________________________________
> 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/insight-users/attachments/20161103/39a98bb0/attachment.html>


More information about the Insight-users mailing list