<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="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;">The files are named as file000.png, file001.png, ...file031.png.<br><br>The .vtk file generated is of a decent size. Also, when I read in the .vtk and write out Image series, using the ImageReadImageSeriesWrite.cpp file, I can recreate the original 32 2D slices.<br><br>I am simply not able to view them using volview. Any clues ! Volview does ask for Z-spacing and units, but then it displays nothing.<br><br>Emma<br><br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: Andinet Enquobahrie <andinet.enqu@kitware.com><br>To: Emma Ryan <eryanvtk@yahoo.com><br>Sent: Tuesday, June 12, 2007 5:31:13 AM<br>Subject: Re: [Insight-users]
ImageSeriesReadWrite only reads first file.<br><br><div>Emma Ryan wrote:<br><br>><br>> Hi,<br>><br>> I am trying to generate a .vtk file (3D ) from a set of .png <br>> images. I use the ImageSeriesReadWrite.cxx example provided in ITK as <br>> is. My command line syntax is "SeriesRW.exe 0 31 output.vtk"<br><br><br>How are the png images named? Give us a list of their names... The issue <br>might be with the file format..<br><br>><br>> i.e SeriesRW is the executable, there are 32 slices starting from 0, <br>> and the output format is supposed to be .vtk , so that I can open it <br>> using Volview.<br>><br>> While the program executes with no errors or warnings, when I open <br>> output.vtk file in Volview, it seems to be empty.<br>><br>> I am not sure why this. If anyone has a clue as to why this happens, <br>> please let me know. Here is the code.<br>><br>>
#include "itkImage.h"<br>> #include "itkImageSeriesReader.h"<br>> #include "itkImageFileWriter.h"<br>> #include "itkNumericSeriesFileNames.h"<br>> #include "itkPNGImageIO.h"<br>><br>><br>> int main( int argc, char ** argv )<br>> {<br>> <br>> if( argc < 4 )<br>> {<br>> std::cerr << "Usage: " << std::endl;<br>> std::cerr << argv[0] << " firstSliceValue lastSliceValue <br>> outputImageFile " << std::endl;<br>> return EXIT_FAILURE;<br>> }<br>><br>><br>> typedef unsigned char PixelType;<br>> const unsigned int Dimension = 3;<br>><br>> typedef itk::Image<
PixelType, Dimension > ImageType;<br>><br>> typedef itk::ImageSeriesReader< ImageType > ReaderType;<br>> typedef itk::ImageFileWriter< ImageType > WriterType;<br>><br>> ReaderType::Pointer reader = ReaderType::New();<br>> WriterType::Pointer writer = WriterType::New();<br>><br>> const unsigned int first = atoi( argv[1] );<br>> const unsigned int last = atoi( argv[2] );<br>><br>> const char * outputFilename = argv[3];<br>><br>><br>> typedef itk::NumericSeriesFileNames NameGeneratorType;<br>><br>> NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();<br>><br>><br>> nameGenerator->SetSeriesFormat( "file%03d.png" );<br>><br>> nameGenerator->SetStartIndex(
first);<br>> nameGenerator->SetEndIndex( last );<br>> nameGenerator->SetIncrementIndex( 1 );<br>><br>><br>><br>> reader->SetImageIO( itk::PNGImageIO::New() );<br>><br>> reader->SetFileNames( nameGenerator->GetFileNames() );<br>><br>><br>> writer->SetFileName( outputFilename );<br>><br>> writer->SetInput( reader->GetOutput() );<br>><br>> try<br>> {<br>> writer->Update();<br>> }<br>> catch( itk::ExceptionObject & err )<br>> {<br>> std::cerr << "ExceptionObject caught !" << std::endl;<br>> std::cerr << err << std::endl;<br>> return EXIT_FAILURE;<br>>
}<br>><br>><br>> return EXIT_SUCCESS;<br>> }<br>><br>><br>> Thank you,<br>> Emma<br>><br>> ------------------------------------------------------------------------<br>> Building a website is a piece of cake.<br>> Yahoo! Small Business gives you all the tools to get online. <br>> <<a target="_blank" href="http://us.rd.yahoo.com/evt=48251/*http://smallbusiness.yahoo.com/webhosting/?p=PASSPORTPLUS">http://us.rd.yahoo.com/evt=48251/*http://smallbusiness.yahoo.com/webhosting/?p=PASSPORTPLUS</a>><br>><br>><br>> ------------------------------------------------------------------------<br>> Don't get soaked. Take a quick peak at the forecast <br>> <<a target="_blank" href="http://tools.search.yahoo.com/shortcuts/?fr=oni_on_mail&#news">http://tools.search.yahoo.com/shortcuts/?fr=oni_on_mail&#news</a>><br>> with theYahoo! Search weather shortcut. <br>> <<a target="_blank"
href="http://tools.search.yahoo.com/shortcuts/?fr=oni_on_mail&#news">http://tools.search.yahoo.com/shortcuts/?fr=oni_on_mail&#news</a>><br>><br>>------------------------------------------------------------------------<br>><br>>_______________________________________________<br>>Insight-users mailing list<br>>Insight-users@itk.org<br>><a target="_blank" href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a><br>> <br>><br><br><br>-- <br>==========================================================<br>Andinet A. Enquobahrie, PhD<br>R&D Engineer<br>Kitware Inc.<br><br>28 Corporate Drive<br>Clifton Park, NY 12065-8662<br>Phone: 518-371-3971 x124<br><a target="_blank" href="http://www.kitware.com">www.kitware.com</a><br><br><br></div></div><br></div></div><br>
<hr size=1>Boardwalk for $500? In 2007? Ha! <br><a href="http://us.rd.yahoo.com/evt=48223/*http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow">Play Monopoly Here and Now</a> (it's updated for today's economy) at Yahoo! Games.</body></html>