<div dir="ltr">ok, but i don't want a vector of images. I want to have a 4d matrix so I can do segmentation through time<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jul 1, 2013 at 9:59 AM, Alessandro <span dir="ltr"><<a href="mailto:notinmyhead@gmail.com" target="_blank">notinmyhead@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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.<br>
<br>
In your code, you only read the first volume by setting the filenames into ImageSeriesReader object...<br>
<br>
<br>
Il giorno 01/lug/2013, alle ore 15.49, Jose Ignacio Prieto ha scritto:<br>
<div><div class="h5"><br>
> 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??<br>
> Thanks!<br>
><br>
> #include "itkImage.h"<br>
> #include "itkImageFileReader.h"<br>
> #include "itkImageFileWriter.h"<br>
> #include "itkGDCMImageIO.h"<br>
> #include "itkGDCMSeriesFileNames.h"<br>
> #include "itkImageSeriesReader.h"<br>
> #include "itkImageFileWriter.h"<br>
> #include <itkImageToVTKImageFilter.h><br>
> #include <itkExtractImageFilter.h><br>
><br>
> typedef unsigned short PixelType;<br>
> typedef itk::Image< PixelType, Dimension3> ImageType3D;<br>
> typedef itk::Image< PixelType, Dimension4 > ImageType;<br>
> typedef itk::ImageSeriesReader< ImageType > ReaderType;<br>
> typedef itk::GDCMSeriesFileNames NamesGeneratorType;<br>
> typedef std::vector< std::string > FileNamesContainer;<br>
> typedef itk::GDCMImageIO ImageIOType;<br>
> typedef std::vector< std::string > SeriesIdContainer;<br>
><br>
> const unsigned int Dimension3 = 3;<br>
> const unsigned int Dimension4 = 4;<br>
> ReaderType::Pointer reader = ReaderType::New();<br>
> ImageIOType::Pointer dicomIO = ImageIOType::New();<br>
> NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();<br>
> FileNamesContainer fileNames;<br>
> std::string seriesIdentifier;<br>
><br>
> reader->SetImageIO( dicomIO );<br>
> nameGenerator->SetDirectory( argv[9]);<br>
> const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs();<br>
> SeriesIdContainer::const_iterator seriesItr = seriesUID.begin();<br>
> SeriesIdContainer::const_iterator seriesEnd = seriesUID.end();<br>
> seriesIdentifier = seriesUID.begin()->c_str();<br>
> fileNames = nameGenerator->GetFileNames( seriesIdentifier );<br>
> reader->SetFileNames( fileNames );<br>
> reader->Update();<br>
><br>
><br>
> --<br>
> José Ignacio Prieto<br>
> celular(nuevo): 94348182<br>
</div></div>> _____________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>José Ignacio Prieto<br>celular(nuevo): 94348182
</div>