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