[Insight-users] ITK DICOM series reading
Elhassan Abdou
hassan.abdou at yahoo.com
Thu Jul 19 18:09:48 EDT 2012
Hi
thank you Saurabh
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,
I get the following from QT creator console:
bonesegment(624,0x7fff70e28cc0) malloc: *** error for object 0x7fff7052d500: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
The program has unexpectedly finished.
The path I provide contains dicom series I am sure of this, however the files name does not have extension.dcm.
Any Idea!!!!
Cheers
El-Hassan Mohamed
Biomedical engineering
________________________________
From: Saurabh Garg <srbh.garg at gmail.com>
To: Elhassan Abdou <hassan.abdou at yahoo.com>
Cc: "insight-users at itk.org" <insight-users at itk.org>
Sent: Thursday, July 19, 2012 8:52 PM
Subject: Re: [Insight-users] ITK DICOM series reading
Hi,
You are mixing c type strings with c++ strings. This might be the issue.
Just a thought, replace this line
nameGenerator->SetDirectory( dirName.toStdString().c_str());
with
nameGenerator->SetInputDirectory( dirName.toStdString().c_str());
HTH,
Saurabh
On 7/19/12, Elhassan Abdou <hassan.abdou at yahoo.com> wrote:
>
>
> Hi John
>
> 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.
> I also tried to make the path hardwired and it does not work. I am using itk
> 4.2
>
> Please help this problem is driving me crazy
> best
> El-Hassan Mohamed
> Biomedical engineering
>
>
> ________________________________
> From: John Drescher <drescherjm at gmail.com>
> To: Elhassan Abdou <hassan.abdou at yahoo.com>
> Cc: "insight-users at itk.org" <insight-users at itk.org>
> Sent: Thursday, July 19, 2012 5:53 PM
> Subject: Re: [Insight-users] ITK DICOM series reading
>
>> class BoneSegment
>> {
>> public:
>> BoneSegment();
>> void readDirectory(QString dirName);
>> vtkImageData* getImageData()const;
>> typedef signed short PixelType;
>> typedef itk::Image< PixelType, 3 >ImageType;
>> typedef itk::ImageSeriesReader< ImageType > ReaderType;
>> ReaderType::Pointer reader;
>> typedef itk::GDCMImageIO ImageIOType;
>> ImageIOType::Pointer dicomIO;
>> typedef itk::GDCMSeriesFileNames NamesGeneratorType;
>> NamesGeneratorType::Pointer nameGenerator;
>> typedef std::vector< std::string > SeriesIdContainer;
>> typedef std::vector< std::string > FileNamesContainer;
>> typedef itk::ImageToVTKImageFilter<ImageType> ConnectorType;
>> };
>> BoneSegment::BoneSegment(){
>>
>> }
>>
>> void BoneSegment::readDirectory(QString dirName){
>> reader = ReaderType::New();
>> dicomIO = ImageIOType::New();
>> reader->SetImageIO( dicomIO );
>> nameGenerator = NamesGeneratorType::New();
>>
>> nameGenerator->SetUseSeriesDetails( true );
>> nameGenerator->AddSeriesRestriction("0008|0021" );
>> nameGenerator->SetDirectory( dirName.toStdString().c_str());
>> const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs();
>> std::string seriesIdentifier;
>> seriesIdentifier = seriesUID.begin()->c_str();
>> FileNamesContainer fileNames;
>> fileNames = nameGenerator->GetFileNames( seriesIdentifier );
>> reader->SetFileNames( fileNames );
>> try
>> {
>> reader->Update();
>> }
>> catch (itk::ExceptionObject &ex)
>> {
>> std::cout << ex << std::endl;
>> }
>>
>> }
>>
>> Best
>>
>
> Are there any series found? The reader will not be happy if fileNames is
> empty.
>
> John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120719/4cf44ffd/attachment.htm>
More information about the Insight-users
mailing list