<div dir="ltr">ok, but i don&#39;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">&lt;<a href="mailto:notinmyhead@gmail.com" target="_blank">notinmyhead@gmail.com</a>&gt;</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 &lt; ImageType3D &gt;  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>
&gt; 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&#39;t know how to make it for enhanced dicom. What would be the best approach??<br>

&gt; Thanks!<br>
&gt;<br>
&gt; #include &quot;itkImage.h&quot;<br>
&gt; #include &quot;itkImageFileReader.h&quot;<br>
&gt; #include &quot;itkImageFileWriter.h&quot;<br>
&gt; #include &quot;itkGDCMImageIO.h&quot;<br>
&gt; #include &quot;itkGDCMSeriesFileNames.h&quot;<br>
&gt; #include &quot;itkImageSeriesReader.h&quot;<br>
&gt; #include &quot;itkImageFileWriter.h&quot;<br>
&gt; #include &lt;itkImageToVTKImageFilter.h&gt;<br>
&gt; #include &lt;itkExtractImageFilter.h&gt;<br>
&gt;<br>
&gt; typedef unsigned short    PixelType;<br>
&gt; typedef itk::Image&lt; PixelType, Dimension3&gt;         ImageType3D;<br>
&gt; typedef itk::Image&lt; PixelType, Dimension4 &gt;         ImageType;<br>
&gt; typedef itk::ImageSeriesReader&lt; ImageType &gt;        ReaderType;<br>
&gt; typedef itk::GDCMSeriesFileNames NamesGeneratorType;<br>
&gt; typedef std::vector&lt; std::string &gt;   FileNamesContainer;<br>
&gt; typedef itk::GDCMImageIO       ImageIOType;<br>
&gt; typedef std::vector&lt; std::string &gt;    SeriesIdContainer;<br>
&gt;<br>
&gt; const unsigned int      Dimension3 = 3;<br>
&gt; const unsigned int      Dimension4 = 4;<br>
&gt; ReaderType::Pointer reader = ReaderType::New();<br>
&gt; ImageIOType::Pointer dicomIO = ImageIOType::New();<br>
&gt; NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();<br>
&gt; FileNamesContainer fileNames;<br>
&gt; std::string seriesIdentifier;<br>
&gt;<br>
&gt; reader-&gt;SetImageIO( dicomIO );<br>
&gt; nameGenerator-&gt;SetDirectory( argv[9]);<br>
&gt; const SeriesIdContainer &amp; seriesUID = nameGenerator-&gt;GetSeriesUIDs();<br>
&gt; SeriesIdContainer::const_iterator seriesItr = seriesUID.begin();<br>
&gt; SeriesIdContainer::const_iterator seriesEnd = seriesUID.end();<br>
&gt; seriesIdentifier = seriesUID.begin()-&gt;c_str();<br>
&gt; fileNames = nameGenerator-&gt;GetFileNames( seriesIdentifier );<br>
&gt; reader-&gt;SetFileNames( fileNames );<br>
&gt; reader-&gt;Update();<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; José Ignacio Prieto<br>
&gt; celular(nuevo): 94348182<br>
</div></div>&gt; _____________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Kitware offers ITK Training Courses, for more information visit:<br>
&gt; <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the ITK FAQ at:<br>
&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <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>