[Insight-users] ITK DICOM series reading
Saurabh Garg
srbh.garg at gmail.com
Thu Jul 19 14:52:02 EDT 2012
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
More information about the Insight-users
mailing list