<div dir="ltr"><div><div><div>Hello,<br><br></div>If I understand correctly what you are saying, you were able to use itkImageSeriesReader [1] but you do not want all your files of dimension N-1 to be merged altogether in a file of dimension N, correct?<br></div>In this case, you will have to read each file individually with itkImageReader. You can still use itkNumericSeriesFileNames to create the list of file names.<br><br></div>Your code could look like this (modify and complete what you need:<br><br>typedef itk::NumericSeriesFileNames NameGeneratorType;<br>NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();<div><div>nameGenerator->SetSeriesFormat( argv[1] );<br> <br>nameGenerator->SetStartIndex( first );<br>nameGenerator->SetEndIndex( last );<br>nameGenerator->SetIncrementIndex( 1 );<br>std::vector<std::string> names = nameGenerator->GetFileNames();<br><br>typedef itk::ImageFileReader<ImageType> ReaderType;<br> std::vector<std::string>::iterator nit;<br> for (nit = names.begin();<br> nit != names.end();<br> nit++)<br> {<br></div><div> ReaderType::Pointer reader = ReaderType::New();<br></div><div> reader->SetFileName((*nit).c_str());<br></div><div> reader->Update();<br> ////////////<br></div><div> // Do your computation<br></div><div> ////////<br> }<br> <br><br></div><div>Hope this helps,<br></div><div>Francois<br></div><div><br>[1] <a href="https://itk.org/Doxygen/html/classitk_1_1ImageSeriesReader.html">https://itk.org/Doxygen/html/classitk_1_1ImageSeriesReader.html</a><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 24, 2017 at 7:46 PM, Matias <span dir="ltr"><<a href="mailto:matimontg@gmail.com" target="_blank">matimontg@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I need to read a directory which contains X number of Dicom images. I have<br>
no troubles doing this by passing a parameter with the name of each file to<br>
ITK but I'd like to read one by one and do the translation in a For. Sounds<br>
simple but I could not find an example where you read a directory, process<br>
images one by one on a For and then write the resultant image (within the<br>
same For) to an output directory..<br>
<br>
Does anyone know where I can find an example (of any kind) for reading a<br>
directory and doing some processing (any type) in a For?<br>
<br>
Thank you!<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://itk-users.7.n7.nabble.com/Translation-on-each-Dicom-on-a-Directory-tp38034.html" rel="noreferrer" target="_blank">http://itk-users.7.n7.nabble.<wbr>com/Translation-on-each-Dicom-<wbr>on-a-Directory-tp38034.html</a><br>
Sent from the ITK - Users mailing list archive at Nabble.com.<br>
______________________________<wbr>_______<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>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" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>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" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_<wbr>FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/insight-users" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/insight-users</a><br>
</blockquote></div><br></div>