[Insight-users] ITK DICOM series reading
Elhassan Abdou
hassan.abdou at yahoo.com
Thu Jul 19 13:52:22 EDT 2012
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/f91166b5/attachment.htm>
More information about the Insight-users
mailing list