[ITK] [ITK-users] reading 3D temporal MRA dicom: miss ordered

Jerome Plumat j.plumat at auckland.ac.nz
Mon May 23 17:54:58 EDT 2016


Dear all,
I'm facing to a problem while reading a 3D Angiography dicom data set 
and transforming it in MHA with ITK 4.8.1. The angiography is a TWIST 
generated by a 3T Siemens scanner. Each slice is a projection of the 
head at a specific time after the contrast agent injection.
The dicom is detected as 3D
(0018,0023) CS [3D]                                     #   2, 1 
MRAcquisitionType

While I try to load the whole dicom with ITK (using the lines below) it 
creates a volume but the slices are not well ordered. Indeed, each slice 
has a timer tag and the generated sequence has is not in the proper order.

Has anyone faced this problem?

Thanks a lot.
Jerome Plumat

Reading the DCM Angiography with:
     const    unsigned int   Dimension = 3;
     typedef  float PixelType;
     typedef  itk::Image<PixelType, Dimension> ImageType;

     typedef unsigned short                DcmPixelType;
     typedef typename itk::Image<DcmPixelType,  3> DCMImageType;
     typedef typename itk::Image<float ,  3>   OutputImageType;
     typedef itk::ImageSeriesReader< DCMImageType > DCMReaderType;
     typedef itk::GDCMSeriesFileNames NamesGeneratorType;
     typedef itk::GDCMImageIO ImageIOType;
     typedef std::vector< std::string > SeriesIdContainer;
     typedef std::vector< std::string > FileNamesContainer;

     ImageIOType::Pointer        dicomIO = ImageIOType::New();
     NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();
     DCMReaderType::Pointer reader = DCMReaderType::New();

     reader->SetImageIO( dicomIO );

nameGenerator->SetUseSeriesDetails( true );
// restrict to the serie date
nameGenerator->AddSeriesRestriction("0008|0021" );
nameGenerator->SetDirectory( inputPath ); // m_path designates the DCM 
folder

     const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs();
     std::string seriesIdentifier = seriesUID.begin()->c_str();
     FileNamesContainer fileNames;
     fileNames = nameGenerator->GetFileNames( seriesIdentifier );
     reader->SetFileNames( fileNames );

     typedef itk::CastImageFilter<  DCMImageType, OutputImageType 
 >          CastFilterType;
     typename CastFilterType::Pointer caster = CastFilterType::New();
     caster->SetInput( reader->GetOutput() );

     // write the volume
     typedef itk::ImageFileWriter< OutputImageType > MetaWriterType;
     MetaWriterType::Pointer writer = MetaWriterType::New();
     writer->SetFileName( outputPath ); // volume.mha
     writer->SetInput( caster->GetOutput() );
     try{
         writer->Update();
     }catch( itk::ExceptionObject &err){
         std::cerr << "Error while writing the volume as: "
             << outputPath << std::endl;
         std::cerr << err << std::endl;
         exit( EXIT_FAILURE );
     }



_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list