[Insight-users] loading 4d dicom image

Alessandro notinmyhead at gmail.com
Mon Jul 1 09:59:29 EDT 2013


Using this iterators (seriesItr and seriesEnd), you should be able to loop and set a vector of images (such as typedef std::vector < ImageType3D >  4dVector) by loading one volume after another.

In your code, you only read the first volume by setting the filenames into ImageSeriesReader object...


Il giorno 01/lug/2013, alle ore 15.49, Jose Ignacio Prieto ha scritto:

> Hi, I am trying to load a 4d image into ITK using gdcm libraries. They are a 4DFlow and a M2D Dicom created with a phillips resonator. I have both datasets in multiple files dicom and in enhanced dicom. I can load them as a 3d image now, with time changing in Z direction (all frames together for a single z position, and then the next slice in z direction again with all the frames), but i want the libaries to recognize it is a 4d, not a 3d. I have tried to load every volume separated by the tag 0018|1060, but it would be a vector of volumes and not a 4d matrix. And I don't know how to make it for enhanced dicom. What would be the best approach??
> Thanks!
> 
> #include "itkImage.h"
> #include "itkImageFileReader.h"
> #include "itkImageFileWriter.h"
> #include "itkGDCMImageIO.h"
> #include "itkGDCMSeriesFileNames.h"
> #include "itkImageSeriesReader.h"
> #include "itkImageFileWriter.h"
> #include <itkImageToVTKImageFilter.h>
> #include <itkExtractImageFilter.h>
> 
> typedef unsigned short    PixelType;
> typedef itk::Image< PixelType, Dimension3>         ImageType3D;
> typedef itk::Image< PixelType, Dimension4 >         ImageType;
> typedef itk::ImageSeriesReader< ImageType >        ReaderType;
> typedef itk::GDCMSeriesFileNames NamesGeneratorType;
> typedef std::vector< std::string >   FileNamesContainer;
> typedef itk::GDCMImageIO       ImageIOType;
> typedef std::vector< std::string >    SeriesIdContainer;
> 
> const unsigned int      Dimension3 = 3;
> const unsigned int      Dimension4 = 4;
> ReaderType::Pointer reader = ReaderType::New();
> ImageIOType::Pointer dicomIO = ImageIOType::New();
> NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();
> FileNamesContainer fileNames;
> std::string seriesIdentifier;
> 
> reader->SetImageIO( dicomIO );
> nameGenerator->SetDirectory( argv[9]);
> const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs();
> SeriesIdContainer::const_iterator seriesItr = seriesUID.begin();
> SeriesIdContainer::const_iterator seriesEnd = seriesUID.end();
> seriesIdentifier = seriesUID.begin()->c_str();
> fileNames = nameGenerator->GetFileNames( seriesIdentifier );
> reader->SetFileNames( fileNames );
> reader->Update();
> 
> 
> -- 
> José Ignacio Prieto
> celular(nuevo): 94348182
> _____________________________________
> 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://www.itk.org/mailman/listinfo/insight-users



More information about the Insight-users mailing list