[Insight-users] ImageSeriesReadWrite only reads first file.
Emma Ryan
eryanvtk at yahoo.com
Tue Jun 12 10:48:29 EDT 2007
The files are named as file000.png, file001.png, ...file031.png.
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.
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.
Emma
----- Original Message ----
From: Andinet Enquobahrie <andinet.enqu at kitware.com>
To: Emma Ryan <eryanvtk at yahoo.com>
Sent: Tuesday, June 12, 2007 5:31:13 AM
Subject: Re: [Insight-users] ImageSeriesReadWrite only reads first file.
Emma Ryan wrote:
>
> Hi,
>
> I am trying to generate a .vtk file (3D ) from a set of .png
> images. I use the ImageSeriesReadWrite.cxx example provided in ITK as
> is. My command line syntax is "SeriesRW.exe 0 31 output.vtk"
How are the png images named? Give us a list of their names... The issue
might be with the file format..
>
> i.e SeriesRW is the executable, there are 32 slices starting from 0,
> and the output format is supposed to be .vtk , so that I can open it
> using Volview.
>
> While the program executes with no errors or warnings, when I open
> output.vtk file in Volview, it seems to be empty.
>
> I am not sure why this. If anyone has a clue as to why this happens,
> please let me know. Here is the code.
>
> #include "itkImage.h"
> #include "itkImageSeriesReader.h"
> #include "itkImageFileWriter.h"
> #include "itkNumericSeriesFileNames.h"
> #include "itkPNGImageIO.h"
>
>
> int main( int argc, char ** argv )
> {
>
> if( argc < 4 )
> {
> std::cerr << "Usage: " << std::endl;
> std::cerr << argv[0] << " firstSliceValue lastSliceValue
> outputImageFile " << std::endl;
> return EXIT_FAILURE;
> }
>
>
> typedef unsigned char PixelType;
> const unsigned int Dimension = 3;
>
> typedef itk::Image< PixelType, Dimension > ImageType;
>
> typedef itk::ImageSeriesReader< ImageType > ReaderType;
> typedef itk::ImageFileWriter< ImageType > WriterType;
>
> ReaderType::Pointer reader = ReaderType::New();
> WriterType::Pointer writer = WriterType::New();
>
> const unsigned int first = atoi( argv[1] );
> const unsigned int last = atoi( argv[2] );
>
> const char * outputFilename = argv[3];
>
>
> typedef itk::NumericSeriesFileNames NameGeneratorType;
>
> NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();
>
>
> nameGenerator->SetSeriesFormat( "file%03d.png" );
>
> nameGenerator->SetStartIndex( first);
> nameGenerator->SetEndIndex( last );
> nameGenerator->SetIncrementIndex( 1 );
>
>
>
> reader->SetImageIO( itk::PNGImageIO::New() );
>
> reader->SetFileNames( nameGenerator->GetFileNames() );
>
>
> writer->SetFileName( outputFilename );
>
> writer->SetInput( reader->GetOutput() );
>
> try
> {
> writer->Update();
> }
> catch( itk::ExceptionObject & err )
> {
> std::cerr << "ExceptionObject caught !" << std::endl;
> std::cerr << err << std::endl;
> return EXIT_FAILURE;
> }
>
>
> return EXIT_SUCCESS;
> }
>
>
> Thank you,
> Emma
>
> ------------------------------------------------------------------------
> Building a website is a piece of cake.
> Yahoo! Small Business gives you all the tools to get online.
> <http://us.rd.yahoo.com/evt=48251/*http://smallbusiness.yahoo.com/webhosting/?p=PASSPORTPLUS>
>
>
> ------------------------------------------------------------------------
> Don't get soaked. Take a quick peak at the forecast
> <http://tools.search.yahoo.com/shortcuts/?fr=oni_on_mail&#news>
> with theYahoo! Search weather shortcut.
> <http://tools.search.yahoo.com/shortcuts/?fr=oni_on_mail&#news>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Insight-users mailing list
>Insight-users at itk.org
>http://www.itk.org/mailman/listinfo/insight-users
>
>
--
==========================================================
Andinet A. Enquobahrie, PhD
R&D Engineer
Kitware Inc.
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x124
www.kitware.com
___________________________________________________________________________________
You snooze, you lose. Get messages ASAP with AutoCheck
in the all-new Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_html.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070612/6f82ec17/attachment.htm
More information about the Insight-users
mailing list