[Insight-users] Question about RGBToVectorImageAdaptor
Luis Ibanez
luis.ibanez at kitware.com
Sun Nov 27 08:00:40 EST 2005
Hi Chris,
Adaptors *are* like images.
When you intend to pass an ImageAdaptor as an input to
a filter, you *MUST* use the adaptor type itself for
instantiating the filter type.
Please see the examples on the ITK Software Guide.
http://www.itk.org/ItkSoftwareGuide.pdf
in particular you *MUST* read the chapter on Image Adaptors.
There is a specific example on how to extract the Red
component out of an RGB image.
Note that ImageAdaptors cannot be used as input to
Writers, because writers attempt to gain access to
the image buffer directly, and ImageAdaptors do not
have a real buffer.
Regards,
Luis
----------------------
Chris Farmer wrote:
>
>
> Hi. I’m trying to extract a single channel (red) from an RGB image and
> save that as an 8-bit scalar image. I can then discard the original RGB
> image. Between the archives and the test/example code from itk 2.2, I
> tried to use the RGBToVectorImageAdaptor, then the
> VectorIndexSelectionCastImageFilter. I seem to be having trouble
> compiling the code to use my adaptor, though. I believe I’m just
> confused regarding the true identity of the RGBToVectorImageAdaptor’s
> output type, but I can’t seem to find any more examples.
>
>
>
> Can someone point me in the right direction?
>
>
>
>
>
> typedef itk::RGBToVectorImageAdaptor<RGB8ImageType> AdaptorType;
>
> typedef AdaptorType::AccessorType::ExternalType PixelVectorType;
>
> typedef itk::Image<PixelVectorType> VectorImageType;
>
> AdaptorType::Pointer adaptor = AdaptorType::New();
>
> adaptor->SetImage(rgbimage);
>
>
>
> typedef itk::VectorIndexSelectionCastImageFilter<VectorImageType,
> Grayscale8ImageType> VectorCastType;
>
> VectorCastType::Pointer caster = VectorCastType::New();
>
> //caster->SetInput(adaptor); // fails to compile, invalid argument type
>
>
>
> VectorImageType::Pointer vimage = VectorImageType::New();
>
> caster->SetInput(vimage); // does compile, but of course does nothing
>
>
>
>
>
>
>
> Thanks,
>
> Chris
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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