<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><span>Hi</span></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><span><br></span></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><span>thank you&nbsp;</span><span class="Apple-style-span" style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; ">Saurabh</span></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><span>It does not make difference. The program is crashing at the reader-&gt;update() I debugged and I find it has a problem with Pointer that it returns null,</span></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><span>I get the following from QT creator console:</span></div><div><span>

<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; text-indent: 0px; "><!--StartFragment--><span style=" font-family:'Monaco'; font-size:12pt; color:#c80000;">bonesegment(624,0x7fff70e28cc0) malloc: *** error for object 0x7fff7052d500: pointer being freed was not allocated</span></div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; text-indent: 0px; "><span style=" font-family:'Monaco'; font-size:12pt; color:#c80000;">*** set a breakpoint in malloc_error_break to debug</span></div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; text-indent: 0px; "><span style=" font-family:'Monaco'; font-size:12pt; font-weight:600; color:#c80000;">The program has unexpectedly finished.</span><!--EndFragment--></div><div style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; text-indent: 0px; "><font class="Apple-style-span" size="2"><br></font></div><div style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; text-indent: 0px; "><font class="Apple-style-span" size="2">The path I provide contains dicom series I am sure of &nbsp;this, however the files name does not have extension.dcm.</font></div><div style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; text-indent: 0px; "><span class="Apple-style-span" style="font-size: 13px; ">Any Idea!!!!</span></div><div
 style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; text-indent: 0px; "><span class="Apple-style-span" style="font-size: 13px; "><br></span></div><div style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; text-indent: 0px; "><span class="Apple-style-span" style="font-size: 13px; ">Cheers</span></div><div style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; text-indent: 0px; "><span class="Apple-style-span" style="font-size: 13px; ">&nbsp;El-Hassan Mohamed&nbsp;</span><br></div></span></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; ">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>
 Saurabh Garg &lt;srbh.garg@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 8:52 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [Insight-users] ITK DICOM series reading<br> </font> </div> <br>
Hi,<br><br>You are mixing c type strings with c++ strings. This might be the issue.<br>Just a thought, replace this line<br>nameGenerator-&gt;SetDirectory( dirName.toStdString().c_str());<br>with<br>nameGenerator-&gt;SetInputDirectory( dirName.toStdString().c_str());<br><br>HTH,<br>Saurabh<br><br>On 7/19/12, Elhassan Abdou &lt;<a ymailto="mailto:hassan.abdou@yahoo.com" href="mailto:hassan.abdou@yahoo.com">hassan.abdou@yahoo.com</a>&gt; wrote:<br>&gt;<br>&gt;<br>&gt; &nbsp;Hi John<br>&gt;<br>&gt; I built a UI system with QT and the creation of bonesegment class is carried<br>&gt; by an action so i am sure that the path I sent to reader is correct I even<br>&gt; tried the same path with vtkDicomReader and it works fine.<br>&gt; I also tried to make the path hardwired and it does not work. I am using itk<br>&gt; 4.2<br>&gt;<br>&gt; Please help this problem is driving me crazy<br>&gt; best<br>&gt; El-Hassan Mohamed<br>&gt; Biomedical
 engineering<br>&gt;<br>&gt;<br>&gt; ________________________________<br>&gt;&nbsp; From: John Drescher &lt;<a ymailto="mailto:drescherjm@gmail.com" href="mailto:drescherjm@gmail.com">drescherjm@gmail.com</a>&gt;<br>&gt; To: Elhassan Abdou &lt;<a ymailto="mailto:hassan.abdou@yahoo.com" href="mailto:hassan.abdou@yahoo.com">hassan.abdou@yahoo.com</a>&gt;<br>&gt; Cc: "<a ymailto="mailto:insight-users@itk.org" href="mailto:insight-users@itk.org">insight-users@itk.org</a>" &lt;<a ymailto="mailto:insight-users@itk.org" href="mailto:insight-users@itk.org">insight-users@itk.org</a>&gt;<br>&gt; Sent: Thursday, July 19, 2012 5:53 PM<br>&gt; Subject: Re: [Insight-users] ITK DICOM series reading<br>&gt;<br>&gt;&gt; class BoneSegment<br>&gt;&gt; {<br>&gt;&gt; public:<br>&gt;&gt;&nbsp; &nbsp;&nbsp; BoneSegment();<br>&gt;&gt;&nbsp; &nbsp;&nbsp; void readDirectory(QString dirName);<br>&gt;&gt;&nbsp; &nbsp;&nbsp; vtkImageData* getImageData()const;<br>&gt;&gt;&nbsp;
 &nbsp;&nbsp; typedef signed short&nbsp; &nbsp; PixelType;<br>&gt;&gt;&nbsp; &nbsp;&nbsp; typedef itk::Image&lt; PixelType, 3 &gt;ImageType;<br>&gt;&gt;&nbsp; &nbsp;&nbsp; typedef itk::ImageSeriesReader&lt; ImageType &gt;&nbsp; &nbsp; &nbsp; &nbsp; ReaderType;<br>&gt;&gt;&nbsp; &nbsp;&nbsp; ReaderType::Pointer reader;<br>&gt;&gt;&nbsp; &nbsp;&nbsp; typedef itk::GDCMImageIO&nbsp; &nbsp; &nbsp;&nbsp; ImageIOType;<br>&gt;&gt;&nbsp; &nbsp;&nbsp; ImageIOType::Pointer dicomIO;<br>&gt;&gt;&nbsp; &nbsp;&nbsp; typedef itk::GDCMSeriesFileNames NamesGeneratorType;<br>&gt;&gt;&nbsp; &nbsp; &nbsp; NamesGeneratorType::Pointer nameGenerator;<br>&gt;&gt;&nbsp; &nbsp; &nbsp; typedef std::vector&lt; std::string &gt;&nbsp; &nbsp; SeriesIdContainer;<br>&gt;&gt;&nbsp; &nbsp; &nbsp; typedef std::vector&lt; std::string &gt;&nbsp;&nbsp; FileNamesContainer;<br>&gt;&gt;&nbsp; &nbsp; &nbsp; typedef itk::ImageToVTKImageFilter&lt;ImageType&gt;&nbsp; &nbsp; &nbsp;&nbsp;
 ConnectorType;<br>&gt;&gt; };<br>&gt;&gt; BoneSegment::BoneSegment(){<br>&gt;&gt;<br>&gt;&gt; }<br>&gt;&gt;<br>&gt;&gt; void BoneSegment::readDirectory(QString dirName){<br>&gt;&gt;&nbsp; &nbsp;&nbsp; reader = ReaderType::New();<br>&gt;&gt;&nbsp; &nbsp;&nbsp; dicomIO = ImageIOType::New();<br>&gt;&gt;&nbsp; &nbsp;&nbsp; reader-&gt;SetImageIO( dicomIO );<br>&gt;&gt;&nbsp; &nbsp;&nbsp; nameGenerator = NamesGeneratorType::New();<br>&gt;&gt;<br>&gt;&gt;&nbsp; &nbsp;&nbsp; nameGenerator-&gt;SetUseSeriesDetails( true );<br>&gt;&gt;&nbsp; &nbsp;&nbsp; nameGenerator-&gt;AddSeriesRestriction("0008|0021" );<br>&gt;&gt;&nbsp; &nbsp;&nbsp; nameGenerator-&gt;SetDirectory( dirName.toStdString().c_str());<br>&gt;&gt;&nbsp; &nbsp;&nbsp; const SeriesIdContainer &amp; seriesUID = nameGenerator-&gt;GetSeriesUIDs();<br>&gt;&gt;&nbsp; &nbsp;&nbsp; std::string seriesIdentifier;<br>&gt;&gt;&nbsp; &nbsp;&nbsp; seriesIdentifier = seriesUID.begin()-&gt;c_str();<br>&gt;&gt;&nbsp;
 &nbsp;&nbsp; FileNamesContainer fileNames;<br>&gt;&gt;&nbsp; &nbsp;&nbsp; fileNames = nameGenerator-&gt;GetFileNames( seriesIdentifier );<br>&gt;&gt;&nbsp; &nbsp;&nbsp; reader-&gt;SetFileNames( fileNames );<br>&gt;&gt;&nbsp; &nbsp;&nbsp; try<br>&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br>&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; reader-&gt;Update();<br>&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; catch (itk::ExceptionObject &amp;ex)<br>&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br>&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; std::cout &lt;&lt; ex &lt;&lt; std::endl;<br>&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>&gt;&gt;<br>&gt;&gt; }<br>&gt;&gt;<br>&gt;&gt; Best<br>&gt;&gt;<br>&gt;<br>&gt; Are there any series found? The reader will not be happy if fileNames is<br>&gt; empty.<br>&gt;<br>&gt; John<br><br><br> </div> </div>  </div></body></html>