[Insight-users] MetaImage Problems
Luis Ibanez
luis.ibanez at kitware.com
Wed Aug 4 15:32:07 EDT 2004
Jacob,
You also have the option of using the ImageSeriesReader
in order to load your set of PNG files directly.
For an example on the use of the ImageSeriesReader class
please look at
Insight/Examples/IO/
ImageSeriesReadWrite.cxx
The example is actually using the PNGImageIO as the
ImageIO class for reading the set of input slices.
Regards,
Luis
------------------------------
Atwood, Robert C wrote:
> I don't see how this can recognize PNG files ...
>
> -----Original Message-----
> From: insight-users-bounces at itk.org
> [mailto:insight-users-bounces at itk.org] On Behalf Of Jacob Boomgaarden
> Sent: 04 August 2004 19:59
> To: insight-users at itk.org
> Subject: [Insight-users] MetaImage Problems
>
>
> Hi all,
>
> I am having problems with reading in a MetaImage into a
> quick example program.
>
> The code for my program is:
>
> #include "itkImage.h"
> #include "itkImageFileReader.h"
>
>
> int main(int argc, char ** argv)
> {
>
> typedef unsigned char PixelType;
> const unsigned int Dimension = 3;
>
> typedef itk::Image< PixelType, Dimension > ImageType;
>
> typedef itk::ImageFileReader< ImageType > ReaderType;
>
> ReaderType::Pointer reader = ReaderType::New();
>
> const char * inputfile = argv[1];
> reader->SetFileName( inputfile );
>
>
> // catch any errors
> try
> {
> reader->Update();
> }
> catch( itk::ExceptionObject &err )
> {
> std::cout<< "Exception Caught!"<< std::endl;
> std::cout<< err << std::endl;
> return 1;
> }
>
> ImageType::Pointer thoraxImage = reader->GetOutput(); std::cout<<"All
> Done"<<std::endl; return 0; }
>
>
>
> I pass as a command line argument a metaimage header
> called "lungs.mhd" that looks like this:
>
> ObjectType = Image
> NDims = 3
> DimSize = 512 315 20
> ElementSpacing = 1 1 1
> Position = 0 0 0
> ElementByteOrderMSB = True
> ElementType = MET_UCHAR
> ElementDataFile = lungs.%03d 0 19 1
>
> The images that make up the MetaImage are all PNG images
> of 63.5 KB with size 512 X 315 and data type unsigned char.
>
> The error messages I'm getting are:
>
> file = _lungs.000_
> MetaImage: M_ReadElements: data not read completely
> ideal = 161280 : actual = 0
>
> over the twenty images that I give it.
>
> Thanks for the help.
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org http://www.itk.org/mailman/listinfo/insight-users
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
More information about the Insight-users
mailing list