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"><<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>></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="'times new roman', 'new york', times, serif">Dora00001d.png</font><br>
<font face="'times new roman', 'new york', times, serif">Dora00002d.png<br>
</font><font face="'times new roman', 'new york', 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"><<a href="mailto:dora.szasz@yahoo.com" target="_blank">dora.szasz@yahoo.com</a>></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: 'times new roman','new york',times,serif; font-size: 12pt;">Hello all,</div><div style="font-family: 'times new roman','new york',times,serif; font-size: 12pt;"><br>
</div><div style="font-family: 'times new roman','new york',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't generate any output.</div>
<div style="font-family: 'times new roman','new york',times,serif; font-size: 12pt;">My code is the following:</div><div style="font-family: 'times new roman','new york',times,serif; font-size: 12pt;">
<br></div><div><div><font face="'times new roman', 'new york', times, serif">#include "itkImage.h"</font></div><div><font face="'times new
roman', 'new york', times, serif"> #include "itkImageSeriesReader.h"</font></div><div><font face="'times new roman', 'new york', times, serif"> #include "itkImageFileWriter.h"</font></div>
<div><font face="'times new roman', 'new york', times, serif"> #include "itkNumericSeriesFileNames.h"</font></div><div><font face="'times new roman', 'new york', times, serif"> #include "itkPNGImageIO.h"</font></div>
<div><font face="'times new roman', 'new york', times, serif"><br></font></div><div><font face="'times new roman', 'new york', times, serif"> int main( int argc, char ** argv )</font></div>
<div><font face="'times new roman', 'new york', times, serif"> {</font></div><div><font face="'times new roman', 'new york', times, serif"> // Verify the number of
parameters in the command line</font></div><div><font face="'times new roman', 'new york', times, serif"> if( argc < 4 )</font></div><div><font face="'times new roman', 'new york', times, serif"> {</font></div>
<div><font face="'times new roman', 'new york', times, serif"> std::cerr << "Usage: " << std::endl;</font></div><div><font face="'times new roman', 'new york', times, serif"> std::cerr << argv[0] << " firstSliceValue lastSliceValue outputImageFile " << std::endl;</font></div>
<div><font face="'times new roman', 'new york', times, serif"> return EXIT_FAILURE;</font></div><div><font face="'times new roman', 'new york', times, serif"> }</font></div><div><font face="'times new
roman', 'new york', times, serif"><br></font></div><div><font face="'times new roman', 'new york', times, serif"> typedef unsigned char PixelType;</font></div><div><font face="'times new roman', 'new york', times, serif"> const unsigned int Dimension = 3;</font></div>
<div><font face="'times new roman', 'new york', times, serif"><br></font></div><div><font face="'times new roman', 'new york', times, serif"> typedef itk::Image< PixelType, Dimension > ImageType;</font></div>
<div><font face="'times new roman', 'new york', times, serif"> typedef itk::ImageSeriesReader< ImageType > ReaderType;</font></div><div><font face="'times new roman', 'new york', times, serif"> typedef itk::ImageFileWriter< ImageType >
WriterType;</font></div><div><font face="'times new roman', 'new york', times, serif"><br></font></div><div><font face="'times new roman', 'new york', times, serif"> ReaderType::Pointer reader = ReaderType::New();</font></div>
<div><font face="'times new roman', 'new york', times, serif"> WriterType::Pointer writer = WriterType::New();</font></div><div><font face="'times new roman', 'new york', times, serif"><br>
</font></div><div><font face="'times new roman', 'new york', times, serif"> const unsigned int first = atoi( argv[1] );</font></div><div><font face="'times new roman', 'new york', times, serif"> const unsigned int last = atoi( argv[2] );</font></div>
<div><font face="'times new roman', 'new york', times, serif"><br></font></div><div><font face="'times new roman', 'new york', times, serif"> const char * outputFilename = argv[3];</font></div>
<div><font face="'times new roman', 'new york', times, serif"><br></font></div><div><font face="'times new roman', 'new york', times, serif"> typedef itk::NumericSeriesFileNames NameGeneratorType;</font></div>
<div><font face="'times new roman', 'new york', times, serif"><br></font></div><div><font face="'times new roman', 'new york', times, serif"> NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();</font></div>
<div><font face="'times new roman', 'new york', times, serif"><br></font></div><div><font face="'times new roman', 'new york', times, serif"> nameGenerator->SetSeriesFormat( "Dora00%02d.png" );</font></div>
<div><font face="'times new roman', 'new york', times, serif"><br></font></div><div><font face="'times new roman', 'new york', times, serif"> nameGenerator->SetStartIndex( first );</font></div>
<div><font face="'times new roman', 'new york', times, serif"> nameGenerator->SetEndIndex( last );</font></div><div><font face="'times new roman', 'new york', times, serif"> nameGenerator->SetIncrementIndex( 1 );</font></div>
<div><font face="'times new roman', 'new york', times, serif"><br></font></div><div><font face="'times new roman', 'new york', times, serif"> reader->SetImageIO( itk::PNGImageIO::New() );</font></div>
<div><font face="'times new roman', 'new york', times, serif"> reader->SetFileNames( nameGenerator->GetFileNames()
);</font></div><div><font face="'times new roman', 'new york', times, serif"><br></font></div><div><font face="'times new roman', 'new york', times, serif"> writer->SetFileName( outputFilename );</font></div>
<div><font face="'times new roman', 'new york', times, serif"> writer->SetInput( reader->GetOutput() );</font></div><div><font face="'times new roman', 'new york', times, serif"> try</font></div>
<div><font face="'times new roman', 'new york', times, serif"> {</font></div><div><font face="'times new roman', 'new york', times, serif"> writer->UpdateLargestPossibleRegion();</font></div>
<div><font face="'times new roman', 'new york', times, serif"> writer->Update();</font></div><div><font face="'times new roman', 'new york', times, serif"> }</font></div><div>
<font face="'times new roman', 'new york', times, serif"> catch( itk::ExceptionObject & err )</font></div>
<div><font face="'times new roman', 'new york', times, serif"> {</font></div><div><font face="'times new roman', 'new york', times, serif"> std::cerr << "ExceptionObject caught !" << std::endl;</font></div>
<div><font face="'times new roman', 'new york', times, serif"> std::cerr << err << std::endl;</font></div><div><font face="'times new roman', 'new york', times, serif"> return EXIT_FAILURE;</font></div>
<div><font face="'times new roman', 'new york', times, serif"> }</font></div><div><font face="'times new roman', 'new york', times, serif"> return EXIT_SUCCESS;</font></div><div><font face="'times new roman', 'new york', times, serif"> }</font></div>
<div><font face="'times new roman', 'new york', times, serif"><br></font></div><div><font face="'times new roman', 'new york', times, serif">1. How could I modify it in order to obtain the volume?</font></div>
<div><font face="'times new roman', 'new york', times, serif">2. How could I modify it in order to use "itkImageToVTKImageFilter.h" to display it on vtk window?</font></div><div><font face="'times new roman', 'new york', times, serif"><br>
</font></div><div><font face="'times new roman', 'new york', times, serif">Thank you a lot!</font></div></div><div style="font-family: 'times new roman','new york',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>