[Insight-developers] ImageAdaptors and RGB images

Luis Ibanez luis.ibanez at kitware.com
Mon Feb 21 19:02:59 EST 2011


Hi Richard,

1) How is the type "pixtype" defined ?

2) What exactly are the error messages that you get from the concept check ?
     please post them to the list.


  Thanks


       Luis


-------------------------------
On Mon, Feb 21, 2011 at 6:08 PM, Richard Beare <richard.beare at gmail.com> wrote:
> Hi,
> I'm trying to take a difference between channels of an RGB image. The
> color accessor functors seem the appropriate way of doing it, but I'm
> running into problems with concept checks in the subtract filter.
>
> Am I making a stupid error with this code? Should I be using an
> alternative approach?
>
> Thanks
>
>  typedef typename itk::Image<pixtype, dim> RawImType;
>  typedef typename itk::Image<unsigned char, dim> MaskImType;
>  typedef typename itk::Image<short, dim> SignedImType;
>  typedef itk::RGBPixel<pixtype>   RGBPixelType;
>  typedef itk::Image<RGBPixelType, dim>    RGBImageType;
>
>  typename RGBImageType::Pointer raw = readIm<RGBImageType>(CmdLineObj.InputIm);
>
>
>  typedef typename itk::RedPixelAccessor<RGBPixelType> RedAccessorType;
>  typedef typename itk::GreenPixelAccessor<RGBPixelType> GreenAccessorType;
>  typedef typename itk::BluePixelAccessor<RGBPixelType> BlueAccessorType;
>
>  typedef typename itk::ImageAdaptor<RGBImageType, RedAccessorType>
> RedAdaptorType;
>  typedef typename itk::ImageAdaptor<RGBImageType, GreenAccessorType>
> GreenAdaptorType;
>  typedef typename itk::ImageAdaptor<RGBImageType, BlueAccessorType>
> BlueAdaptorType;
>
>  typename RedAdaptorType::Pointer RedAdaptor = RedAdaptorType::New();
>  typename GreenAdaptorType::Pointer GreenAdaptor = GreenAdaptorType::New();
>  typename BlueAdaptorType::Pointer BlueAdaptor = BlueAdaptorType::New();
>
>
>  RedAdaptor->SetImage(raw);
>  GreenAdaptor->SetImage(raw);
>  BlueAdaptor->SetImage(raw);
>
>  // blue - red selects cyan
>  // red - blue selects yellow
>
>  itk::Instance< itk::SubtractImageFilter< BlueAdaptorType,
> RedAdaptorType, SignedImType> > Difference;
>  Difference->SetInput(BlueAdaptor);
>  Difference->SetInput2(RedAdaptor);
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>


More information about the Insight-developers mailing list