[Insight-users] MetaImage

Yinpeng Jin yj76 at columbia . edu
Fri, 13 Jun 2003 14:51:09 -0400


does this mean that you have to know the Pixeltype and dimension before
you use the itkReader?
or I should always use something like
itk::Image<double, 3>  to make sure that my Image object can "accomodate"
the data if I don't know such info.



----- Original Message -----
From: "Luis Ibanez" <luis . ibanez at kitware . com>
To: "Anouk Stein M.D." <anouk_stein at earthlink . net>
Cc: <insight-users at www . itk . org>
Sent: Thursday, June 12, 2003 9:59 PM
Subject: Re: [Insight-users] MetaImage


>
> Hi Anouk,
>
> You don't need to do this by yourself.
>
> The ImageFileReader<> filter will do all this directly.
>
http://public . kitware . com/Insight/Doxygen/html/classitk_1_1ImageFileReader . h
tml
>
> Simply instantiate an image with a pixel type
> that is capable of receiving the numerical values
> stored in the actual image file.  Then, instantiate
> an image file reader.
>
> The whole code will look like:
>
> typedef   unsigned short  PixelType;
> typedef   itk::Image< PixelType, 3 > ImageType;
> typedef   itk::ImageFileReader< ImageType > ReaderType;
>
> ReaderType::Pointer reader = ReaderType::New();
>
> reader->SetFileName("myImageFile.mha");
> reader->Update();
>
> ImageType::ConstPointer image = reader->GetOutput();
>
>
> "image" will contain at this point the data read
> from your MetaImage file.
>
> You will find details about ITK's IO architecture
> in the Chapter 6 of the SoftwareGuide, pdf-page 159.
>
>      http://www . itk . org/ItkSoftwareGuide . pdf
>
>
> The associated examples can be found in the directory
>
>          Insitht/Examples/IO
>
> --
>
>
>   Regards,
>
>
>      Luis
>
>
> ----------------------------------
> Anouk Stein M.D. wrote:
> > Dear ITK users group,
> >
> > I'm trying to use the info from a metaImage file to instantiate Image<>
> > .  The element type in the header is listed as MET_SHORT which is a
> >
> > MET_ValueEnumType which is also what MetaImage::ElementType() returns.
> > How do I convert this to a typename so that
> >
> > typedef itk::Image <TPixel, dimensions> ImageType recognizes it?
> >
> > Also I would like to use the number of dimensions from the header but
> > it's a protected member. What do you think I should do? Thankyou,
> >
> > Anouk Stein
> >
>
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at www . itk . org
> http://www . itk . org/mailman/listinfo/insight-users