[Insight-users] loading 4d dicom image

Jose Ignacio Prieto joseignacio.prieto at gmail.com
Mon Jul 1 09:49:53 EDT 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130701/2db1a85e/attachment.htm>


More information about the Insight-users mailing list