<div dir="ltr"><div><div><div>Hello Sara,<br><br></div>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).<br><br></div>Hope this helps,<br></div>Francois<br><div><div><br><br>[1] <a href="https://midas3.kitware.com/midas/folder/7741">https://midas3.kitware.com/midas/folder/7741</a> <br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 3, 2016 at 8:46 PM, Sara Gh <span dir="ltr"><<a href="mailto:sg.ele.eng@gmail.com" target="_blank">sg.ele.eng@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><font face="arial, helvetica, sans-serif">Hello,</font><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif">I have used this <a href="https://www.mathworks.com/matlabcentral/fileexchange/50974-3d-shepp-logan-phantom" target="_blank">MATLAB</a> code to create a stack of images using Shepp-Logan Phantom and saved all these images in dicom format using <font class="m_-6052409426321707032m_3583889205035543946gmail-m_-9027579790780061859gmail-"><i>dicomwrite</i></font> function:</font></div><span class=""><div><font face="arial, helvetica, sans-serif"><br></font></div><div><p class="MsoNormal"><font color="#0000ff" face="arial, helvetica, sans-serif">sizeP = [128 128 128]</font></p><p class="MsoNormal"><font color="#0000ff" face="arial, helvetica, sans-serif">[p,ellipse]=phantom3dAniso(siz<wbr>eP);</font></p><p class="MsoNormal"><font color="#0000ff" face="arial, helvetica, sans-serif">outDir = './SLPData/';</font></p><p class="MsoNormal"><font color="#0000ff" face="arial, helvetica, sans-serif">for i=1:sizeP(3)</font></p><p class="MsoNormal"><font color="#0000ff" face="arial, helvetica, sans-serif"> fname = [outDir sprintf('SLP%06d.dcm', i)];</font></p><p class="MsoNormal"><font color="#0000ff" face="arial, helvetica, sans-serif"> dicomwrite(p(:,:,i), fname)</font></p><font face="arial, helvetica, sans-serif"><font color="#0000ff">end </font> <br></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">So, I have 128 dicom files ('SLP000001.dcm', 'SLP000002.d<wbr>cm', ... , 'SLP000128.dcm' ) in th<font color="#000000">e </font><font color="#000000">'SLPData' folder. </font>Now, I am trying to read these dicom images in Python using SimpleITK:</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><div><font color="#0000ff" face="arial, helvetica, sans-serif">pathDicomA = '/SLPData'</font></div><div><font color="#0000ff" face="arial, helvetica, sans-serif">reader = sitk.ImageSeriesReader()</font></div><div><font color="#0000ff" face="arial, helvetica, sans-serif">dicom_namesA = reader.GetGDCMSeriesFileNames(<wbr>pathDicomA)</font></div><div><font color="#0000ff" face="arial, helvetica, sans-serif">reader.SetFileNames(dicom_name<wbr>sA)</font></div><div><font color="#0000ff" face="arial, helvetica, sans-serif">imageA = reader.Execute()</font></div></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">However, when I run the code, it only reads in one of the images instead of the whole series:</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">dicom_namesA => ('.../SLPData/SLP000108.dcm',)</font></div><div><font face="arial, helvetica, sans-serif">imageA.GetSize() => (128, 128, 1)</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div></span><div><font face="arial, helvetica, sans-serif">I am wondering what is causing this issue and how I should resolve it?</font></div><span class=""><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Thanks in advance!</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Best regards,</font></div><div><font face="arial, helvetica, sans-serif">Sara </font></div></span></div>
<br>______________________________<wbr>_______<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_<wbr>FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/insight-users" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br></div>