[Insight-users] itk::Image to itk::OrientedImage
frankmiller at jhmi.edu
frankmiller at jhmi.edu
Fri Mar 16 09:51:33 EST 2007
Hi Sophie,
If you are comfortable breaking out of the pipeline model it is really
easy its create your own itk::OrientedImage by hand.
Another possibility, which is still outside the pipeline model, wound be
to Graft the itk::Image onto a new itk::OrientedImage. I have never
tried this but it seems to me that it would work. This would require
less memory. Read the documentation for itk::Image<.>::Graft(.).
If you really need the conversion to happen in an itk::ProcessObject,
this can be done with just a little more work.
Hope this helps,
Frank
On Fri, Mar 16, 2007 at 10:03:21AM +0100, sblestel at irisa.fr wrote:
> Hi,
>
> I can't do that because I don't use itkImageFileReader to read my image. I
> use a specific reader (because the format of the image is very specific).
> I can only obtain an itk::Image (3D) and I need to modify it to obtain an
> itk::OrientedImage (and I know the orientation of the image)
>
> Thanks,
>
> Sophie
>
>
> > HI Sophie,
> >
> > You can simply instantiate the itk::ImageFileReader
> > using an itk::OrientedImage as template argument.
> >
> >
> > The code will look like:
> >
> >
> > #include "itkOrientedImage.h"
> > #include "itkImageFileReader.h"
> >
> > typedef signed short PixelType;
> > const unsigned int Dimension = 3;
> >
> > typedef itk::OrientedImage< PixelType, Dimension > ImageType;
> > typedef itk::ImageFileReader< ImageType > ReaderType;
> >
> > ReaderType::Pointer reader = ReaderType::New();
> >
> > reader->SetFileName( "myimage.hdr" );
> > reader->Update();
> >
> > ImageType::ConstPointer image = reader->GetOutput();
> >
> > Note however, that, if you are trying to use IGSTK,
> > there are already specific reader developed in
> > IGSTK that encapsulate the ITK readers inside safe
> > state machine classes.
> >
> >
> >
> >
> > Regards,
> >
> >
> >
> > Luis
> >
> >
> > =====================================
> > On 3/15/07, sblestel at irisa.fr <sblestel at irisa.fr> wrote:
> >> Hello,
> >>
> >> I use a specific image reader that only returns an itk::image, and I
> >> need
> >> an itk::OrientedImage to display my image (with igstk).
> >> Has a mapper already been done ?
> >>
> >> Thanks,
> >>
> >> Sophie
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> _______________________________________________
> >> 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