Oops...<br>Dora0001d.png<br>Dora0002d.png<br>Dora0003d.png<br>...<br><br><br><div class="gmail_quote">On Wed, May 18, 2011 at 12:02 AM, Bill Lorensen <span dir="ltr">&lt;<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">What are the names of the file? From your code they should be something like:<br><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">Dora00001d.png</font><br>
<font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">Dora00002d.png<br>
</font><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">Dora00003d.png<br>...<br><br>Is that how your files are named?<br><br>Bill<br><br></font><div class="gmail_quote"><div><div></div><div class="h5">
On Tue, May 17, 2011 at 4:19 PM, Dora Szasz <span dir="ltr">&lt;<a href="mailto:dora.szasz@yahoo.com" target="_blank">dora.szasz@yahoo.com</a>&gt;</span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div class="h5"><div><div style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: times new roman,new york,times,serif; font-size: 12pt;">

<div style="font-family: &#39;times new roman&#39;,&#39;new york&#39;,times,serif; font-size: 12pt;">Hello all,</div><div style="font-family: &#39;times new roman&#39;,&#39;new york&#39;,times,serif; font-size: 12pt;"><br>

</div><div style="font-family: &#39;times new roman&#39;,&#39;new york&#39;,times,serif; font-size: 12pt;">I am trying to make a 3D volume using a set of .png images. I want to obtain a 3D image (for example .mhd), but It doesn&#39;t generate any output.</div>

<div style="font-family: &#39;times new roman&#39;,&#39;new york&#39;,times,serif; font-size: 12pt;">My code is the following:</div><div style="font-family: &#39;times new roman&#39;,&#39;new york&#39;,times,serif; font-size: 12pt;">

<br></div><div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">#include &quot;itkImage.h&quot;</font></div><div><font face="&#39;times new
 roman&#39;, &#39;new york&#39;, times, serif"> #include &quot;itkImageSeriesReader.h&quot;</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif"> #include &quot;itkImageFileWriter.h&quot;</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif"> #include &quot;itkNumericSeriesFileNames.h&quot;</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif"> #include &quot;itkPNGImageIO.h&quot;</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif"><br></font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif"> int main( int argc, char ** argv )</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif"> {</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  // Verify the number of
 parameters in the command line</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  if( argc &lt; 4 )</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">    {</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">    std::cerr &lt;&lt; &quot;Usage: &quot; &lt;&lt; std::endl;</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">    std::cerr &lt;&lt; argv[0] &lt;&lt; &quot; firstSliceValue lastSliceValue outputImageFile &quot; &lt;&lt; std::endl;</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">    return EXIT_FAILURE;</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">    }</font></div><div><font face="&#39;times new
 roman&#39;, &#39;new york&#39;, times, serif"><br></font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  typedef unsigned char   PixelType;</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  const unsigned int Dimension = 3;</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif"><br></font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  typedef itk::Image&lt; PixelType, Dimension &gt;  ImageType;</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  typedef itk::ImageSeriesReader&lt; ImageType &gt;  ReaderType;</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  typedef itk::ImageFileWriter&lt;   ImageType &gt;
  WriterType;</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif"><br></font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  ReaderType::Pointer reader = ReaderType::New();</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  WriterType::Pointer writer = WriterType::New();</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif"><br>

</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  const unsigned int first = atoi( argv[1] );</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  const unsigned int last  = atoi( argv[2] );</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif"><br></font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  const char * outputFilename = argv[3];</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif"><br></font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  typedef itk::NumericSeriesFileNames    NameGeneratorType;</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif"><br></font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif"><br></font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  nameGenerator-&gt;SetSeriesFormat( &quot;Dora00%02d.png&quot; );</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif"><br></font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  nameGenerator-&gt;SetStartIndex( first );</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  nameGenerator-&gt;SetEndIndex( last );</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  nameGenerator-&gt;SetIncrementIndex( 1 );</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif"><br></font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  reader-&gt;SetImageIO( itk::PNGImageIO::New() );</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  reader-&gt;SetFileNames( nameGenerator-&gt;GetFileNames()
  );</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif"><br></font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  writer-&gt;SetFileName( outputFilename );</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  writer-&gt;SetInput( reader-&gt;GetOutput() );</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  try</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">    {</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">    writer-&gt;UpdateLargestPossibleRegion();</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">        writer-&gt;Update();</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">    }</font></div><div>
<font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  catch( itk::ExceptionObject &amp; err )</font></div>
<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">    {</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">    std::cerr &lt;&lt; &quot;ExceptionObject caught !&quot; &lt;&lt; std::endl;</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">    std::cerr &lt;&lt; err &lt;&lt; std::endl;</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">    return EXIT_FAILURE;</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">    }</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">  return EXIT_SUCCESS;</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif"> }</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif"><br></font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">1. How could I modify it in order to obtain the volume?</font></div>

<div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">2. How could I modify it in order to use &quot;itkImageToVTKImageFilter.h&quot; to display it on vtk window?</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif"><br>

</font></div><div><font face="&#39;times new roman&#39;, &#39;new york&#39;, times, serif">Thank you a lot!</font></div></div><div style="font-family: &#39;times new roman&#39;,&#39;new york&#39;,times,serif; font-size: 12pt;">

<br></div></div></div><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.html" target="_blank">http://www.kitware.com/products/protraining.html</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></blockquote></div><br>
</blockquote></div><br>