<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div><span>Hi all,</span></div><div><span><br></span></div><div><span><br></span></div><div><span>Thank you all for your help. The main problem for crashing was due to me using qmake not cmake. So I advise anyone who plan to use ITK and QT to use cmake instead of qmake. Also, there are some solutions of using ITK and QT in qmake but I did not go through it.</span></div><div><span><br></span></div><div><span>Best Regards</span></div><div> </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> 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>