[Insight-users] Question about RGBToVectorImageAdaptor

Chris Farmer cfarmer at scitegic.com
Tue Nov 22 16:59:20 EST 2005


 
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
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20051122/cbb50d5f/attachment.html


More information about the Insight-users mailing list