[Insight-users] ImageSeriesReadWrite only reads first file.
Emma Ryan
eryanvtk at yahoo.com
Wed Jun 13 02:36:45 EDT 2007
Hi Luis,
Thank you for your reply. Yes, the .png files recreated from the .vtk file (by doing a ImageReadImageSeriesWrite) opens fine in Volview. I do get a normal visualization. While this suffices my requirements, I was wondering why Volview was not being able to read the .vtk file. I would rather fix the bug now than later as it might be difficult to trace the origins. If you have any further suggestions, please do let me know.
Has anyone ever encountered a problem reading .vtk files generated using ITK ?
Thank you,
Emma
----- Original Message ----
From: Luis Ibanez <luis.ibanez at kitware.com>
To: Emma Ryan <eryanvtk at yahoo.com>
Cc: Andinet Enquobahrie <andinet.enqu at kitware.com>; insight-users at itk.org
Sent: Tuesday, June 12, 2007 6:28:19 PM
Subject: Re: [Insight-users] ImageSeriesReadWrite only reads first file.
Hi Emma,
Note that you can directly read in VolView the set of PNG images,
you don't really need to convert them to .vtk.
Simply load one of the .png images, and Volview will offer you
the option of completing the series.
Please let us know if by loading the data in this way, you
get a normal visualization.
Thanks
Luis
--------------------
Emma Ryan wrote:
> 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
> <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
> <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 <http://www.kitware.com>
>
>
>
>
> ------------------------------------------------------------------------
> Boardwalk for $500? In 2007? Ha!
> Play Monopoly Here and Now
> <http://us.rd.yahoo.com/evt=48223/*http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow>
> (it's updated for today's economy) at Yahoo! Games.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
____________________________________________________________________________________
8:00? 8:25? 8:40? Find a flick in no time
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070612/2fa2a00a/attachment.htm
More information about the Insight-users
mailing list