[please keep the mailing list involved]<br>Try printing out the generated filenames. Something like:<br><br> std::vector<std::string> names = nameGenerator->GetFileNames();<br> std::vector<std::string>::iterator nit;<br>
<br> for (nit = names.begin();<br> nit != names.end();<br> nit++)<br> {<br> std::cout << "File: " << (*nit).c_str() << std::endl;<br> }<br><br><br><br><br><div class="gmail_quote">
On Wed, May 18, 2011 at 8:16 AM, Dora Szasz <span dir="ltr"><<a href="mailto:dora.szasz@yahoo.com">dora.szasz@yahoo.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;">
<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>I've tried all the possibilities. Even if I run BrainModel.exe 1 5 out.mhd the error appears and I don't know why.</div>
<div><br></div><div style="font-size: 12pt; font-family: 'times new roman','new york',times,serif;"><div style="font-size: 12pt; font-family: 'times new roman','new york',times,serif;"><font size="2" face="Arial"><div class="im">
<hr size="1"><b><span style="font-weight: bold;">From:</span></b> Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>><br><b><span style="font-weight: bold;">To:</span></b> Dora Szasz <<a href="mailto:dora.szasz@yahoo.com" target="_blank">dora.szasz@yahoo.com</a>><br>
</div><b><span style="font-weight: bold;">Cc:</span></b> Insight-Users <<a href="mailto:insight-users@itk.org" target="_blank">insight-users@itk.org</a>><br><b><span style="font-weight: bold;">Sent:</span></b> Wednesday, May 18, 2011 3:00 PM<div>
<div></div><div class="h5"><br><b><span style="font-weight: bold;">Subject:</span></b> Re: [Insight-users] Problem generating a 3D
volume from a set of slices<br></div></div></font><div><div></div><div class="h5"><br>
<div>But the program should be run as:<br>BrainModel.exe 1 5 out.mhd<br><br>at least according to the source you attached.<br><br><div>On Wed, May 18, 2011 at 2:00 AM, Dora Szasz <span dir="ltr"><<a rel="nofollow" href="mailto:dora.szasz@yahoo.com" target="_blank">dora.szasz@yahoo.com</a>></span> wrote:<br>
<blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 12pt; font-family: 'times new roman','new york',times,serif;">
<div><span><div>Hi Bill,</div><div><br></div><div>Yes, the names of the files are correct, but the following error message appears:</div><div>I have verified and the size of the pictures is the same. I don't know what could be the problem.</div>
<div>Thank you!</div><div><br></div><div><i>D:\Lib\Project\Dora\bin\Debug>BrainModel.exe Dora0001d.png Dora0005d.png out.mhd</i></div><div><i>ExceptionObject caught !</i></div><div><i><br></i></div><div><i>itk::ExceptionObject (00B2F4D8)</i></div>
<div><i>Location: "void __thiscall itk::ImageFileWriter<class itk::Image<unsigned char,3</i></div><div><i>> >::Write(void)"</i></div><div><i>File: d:\lib\_itk\source\code\io\itkImageFileWriter.txx</i></div>
<div><i>Line: 271</i></div><div><i>Description: itk::ERROR: ImageFileWriter(0012F3F8): Largest possible region
does</i></div><div><i> not fully contain requested paste IO regionPaste IO region: ImageIORegion (00B2</i></div><div><i>F910)</i></div><div><i> Dimension: 3</i></div><div><i> Index: 0 0 0</i></div><div><i> Size: 0 0 1</i></div>
<div><i>Largest possible region: ImageRegion (00B2F9C4)</i></div><div><i> Dimension: 3</i></div><div><i> Index: [0, 0, 0]</i></div><div><i> Size: [0, 0, 1]</i></div></span></div><div style="font-size: 12pt;">
<br></div><div style="font-size: 12pt;"><div style="font-size: 12pt;"><div>
<font size="2" face="Arial"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Bill Lorensen <<a rel="nofollow" href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>><br><b><span style="font-weight: bold;">To:</span></b> Dora Szasz <<a rel="nofollow" href="mailto:dora.szasz@yahoo.com" target="_blank">dora.szasz@yahoo.com</a>><br>
<b><span style="font-weight: bold;">Cc:</span></b> "<a rel="nofollow" href="mailto:insight-users@itk.org" target="_blank">insight-users@itk.org</a>" <<a rel="nofollow" href="mailto:insight-users@itk.org" target="_blank">insight-users@itk.org</a>><br>
<b><span style="font-weight: bold;">Sent:</span></b> Wednesday, May 18, 2011 7:03 AM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [Insight-users] Problem generating a 3D volume from a set of slices<br></font></div>
<div><div><br>
<div>Oops...<br>Dora0001d.png<br>Dora0002d.png<br>Dora0003d.png<br>...<br><br><br><div>On Wed, May 18, 2011 at 12:02 AM, Bill Lorensen <span dir="ltr"><<a rel="nofollow" href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span> wrote:<br>
<blockquote 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><div><div>
On Tue, May 17, 2011 at 4:19 PM, Dora Szasz <span dir="ltr"><<a rel="nofollow" href="mailto:dora.szasz@yahoo.com" target="_blank">dora.szasz@yahoo.com</a>></span> wrote:<br>
</div></div><blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div><div><div style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 12pt;">
<div style="font-size: 12pt;">Hello all,</div><div style="font-size: 12pt;"><br>
</div><div style="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-size: 12pt;">My code is the following:</div><div style="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-size: 12pt;">
<br></div></div></div><br></div></div>_____________________________________<br>
Powered by <a rel="nofollow" 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>
</div><br><br></div></div></div></div></div></div></blockquote></div><br>
</div><br><br></div></div></div></div></div></div></blockquote></div><br>