<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div><span><br></span></div><div>&nbsp;Hi John</div><div><br></div><div>I built a UI system with QT and the creation of bonesegment class is carried by an action so i am sure that the path I sent to reader is correct I even tried the same path with vtkDicomReader and it works fine.&nbsp;</div><div>I also tried to make the path hardwired and it does not work. I am using itk 4.2</div><div><br></div><div>Please help this problem is driving me crazy</div><div>best</div><div>El-Hassan Mohamed <br>Biomedical engineering<br></div>  <div style="font-size: 10pt; font-family: arial, helvetica, sans-serif; "> <div style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> John Drescher
 &lt;drescherjm@gmail.com&gt;<br> <b><span style="font-weight: bold;">To:</span></b> Elhassan Abdou &lt;hassan.abdou@yahoo.com&gt; <br><b><span style="font-weight: bold;">Cc:</span></b> "insight-users@itk.org" &lt;insight-users@itk.org&gt; <br> <b><span style="font-weight: bold;">Sent:</span></b> Thursday, July 19, 2012 5:53 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [Insight-users] ITK DICOM series reading<br> </font> </div> <br>
&gt; class BoneSegment<br>&gt; {<br>&gt; public:<br>&gt;&nbsp; &nbsp;  BoneSegment();<br>&gt;&nbsp; &nbsp;  void readDirectory(QString dirName);<br>&gt;&nbsp; &nbsp;  vtkImageData* getImageData()const;<br>&gt;&nbsp; &nbsp;  typedef signed short&nbsp; &nbsp; PixelType;<br>&gt;&nbsp; &nbsp;  typedef itk::Image&lt; PixelType, 3 &gt;ImageType;<br>&gt;&nbsp; &nbsp;  typedef itk::ImageSeriesReader&lt; ImageType &gt;&nbsp; &nbsp; &nbsp; &nbsp; ReaderType;<br>&gt;&nbsp; &nbsp;  ReaderType::Pointer reader;<br>&gt;&nbsp; &nbsp;  typedef itk::GDCMImageIO&nbsp; &nbsp; &nbsp;  ImageIOType;<br>&gt;&nbsp; &nbsp;  ImageIOType::Pointer dicomIO;<br>&gt;&nbsp; &nbsp;  typedef itk::GDCMSeriesFileNames NamesGeneratorType;<br>&gt;&nbsp; &nbsp; &nbsp; NamesGeneratorType::Pointer nameGenerator;<br>&gt;&nbsp; &nbsp; &nbsp; typedef std::vector&lt; std::string &gt;&nbsp; &nbsp; SeriesIdContainer;<br>&gt;&nbsp; &nbsp; &nbsp; typedef std::vector&lt; std::string &gt;&nbsp; 
 FileNamesContainer;<br>&gt;&nbsp; &nbsp; &nbsp; typedef itk::ImageToVTKImageFilter&lt;ImageType&gt;&nbsp; &nbsp; &nbsp;  ConnectorType;<br>&gt; };<br>&gt; BoneSegment::BoneSegment(){<br>&gt;<br>&gt; }<br>&gt;<br>&gt; void BoneSegment::readDirectory(QString dirName){<br>&gt;&nbsp; &nbsp;  reader = ReaderType::New();<br>&gt;&nbsp; &nbsp;  dicomIO = ImageIOType::New();<br>&gt;&nbsp; &nbsp;  reader-&gt;SetImageIO( dicomIO );<br>&gt;&nbsp; &nbsp;  nameGenerator = NamesGeneratorType::New();<br>&gt;<br>&gt;&nbsp; &nbsp;  nameGenerator-&gt;SetUseSeriesDetails( true );<br>&gt;&nbsp; &nbsp;  nameGenerator-&gt;AddSeriesRestriction("0008|0021" );<br>&gt;&nbsp; &nbsp;  nameGenerator-&gt;SetDirectory( dirName.toStdString().c_str());<br>&gt;&nbsp; &nbsp;  const SeriesIdContainer &amp; seriesUID = nameGenerator-&gt;GetSeriesUIDs();<br>&gt;&nbsp; &nbsp;  std::string seriesIdentifier;<br>&gt;&nbsp; &nbsp;  seriesIdentifier = seriesUID.begin()-&gt;c_str();<br>&gt;&nbsp;
 &nbsp;  FileNamesContainer fileNames;<br>&gt;&nbsp; &nbsp;  fileNames = nameGenerator-&gt;GetFileNames( seriesIdentifier );<br>&gt;&nbsp; &nbsp;  reader-&gt;SetFileNames( fileNames );<br>&gt;&nbsp; &nbsp;  try<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; reader-&gt;Update();<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; catch (itk::ExceptionObject &amp;ex)<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; std::cout &lt;&lt; ex &lt;&lt; std::endl;<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>&gt;<br>&gt; }<br>&gt;<br>&gt; Best<br>&gt;<br><br>Are there any series found? The reader will not be happy if fileNames is empty.<br><br>John<br><br><br> </div> </div>  </div></body></html>