[Insight-users] RGBImageType to FloatImageType wit CastImageFilter
Bill Lorensen
bill.lorensen at gmail.com
Fri May 24 07:43:56 EDT 2013
Try RGBToLuminanceImageFilter
http://itk.org/Wiki/ITK/Examples/ImageProcessing/RGBToLuminanceImageFilter
Bill
On Fri, May 24, 2013 at 5:02 AM, chasank <chasank at gmail.com> wrote:
> Hi,
>
> I'm reading a JPEG Image and trying to process a blur filter
> (BinomialBlurImageFilter) on it. Because BinomialBlurImageFilter does not
> accept RGBImageType, first I'm trying to convert the RGBImageType to
> FloatImageType however I'm getting compiling errors; The sample code is
> below; What conversion should I do for processing a RGB Image ?
>
> typedef itk::Image< itk::RGBPixel <unsigned char>, 2 > RGBImageType;
> typedef itk::Image< float, 2 >
> FloatImageType;
>
> itk::VTKImageToImageFilter< RGBImageType >::Pointer converter =
> itk::VTKImageToImageFilter<RGBImageType> :: New();
> converter->SetInput(this->image);
> converter->Update();
>
> itk::CastImageFilter<RGBImageType, FloatImageType>::Pointer caster
> =
> itk::CastImageFilter<RGBImageType, FloatImageType>::New();
> caster->SetInput(converter->GetOutput());
> caster->Update();
>
> itk::BinomialBlurImageFilter< FloatImageType, FloatImageType >
> ::Pointer blurFilter =
> itk::BinomialBlurImageFilter < FloatImageType,
> FloatImageType> ::New();
> blurFilter->SetInput( caster->GetOutput() );
> blurFilter->SetRepetitions(2);
> blurFilter->Update();
>
> itk::CastImageFilter<FloatImageType, RGBImageType>::Pointer caster2
> =
> itk::CastImageFilter<FloatImageType, RGBImageType>::New();
> caster2->SetInput(blurFilter->GetOutput());
> caster2->Update();
>
> /usr/local/include/ITK-4.3/itkConceptChecking.h: In member function 'void
> itk::Concept::Convertible<T1, T2>::Constraints::constraints() [with T1 =
> itk::RGBPixel<unsigned char>, T2 = float]':
> /usr/local/include/ITK-4.3/itkConceptChecking.h:192: instantiated from
> 'itk::Concept::Convertible<itk::RGBPixel<unsigned char>, float>'
> /usr/local/include/ITK-4.3/itkCastImageFilter.h:116: instantiated from
> 'itk::CastImageFilter<itk::Image<itk::RGBPixel<unsigned char>, 2u>,
> itk::Image<float, 2u> >'
> ../Program/program.cpp:67: instantiated from here
> /usr/local/include/ITK-4.3/itkConceptChecking.h:185: error: invalid
> static_cast from type 'itk::RGBPixel<unsigned char>' to type 'float'
> /usr/local/include/ITK-4.3/itkCastImageFilter.h: In member function
> 'TOutput
> itk::Functor::Cast<TInput, TOutput>::operator()(const TInput&) const [with
> TInput = itk::RGBPixel<unsigned char>, TOutput = float]':
> /usr/local/include/ITK-4.3/itkUnaryFunctorImageFilter.hxx:175:
> instantiated from 'void itk::UnaryFunctorImageFilter<TInputImage,
> TOutputImage, TFunction>::ThreadedGenerateData(const typename
> TOutputImage::RegionType&, itk::ThreadIdType) [with TInputImage =
> itk::Image<itk::RGBPixel<unsigned char>, 2u>, TOutputImage =
> itk::Image<float, 2u>, TFunction =
> itk::Functor::Cast<itk::RGBPixel<unsigned char>, float>]'
> ../Program/program.cpp:151: instantiated from here
> /usr/local/include/ITK-4.3/itkCastImageFilter.h:83: error: invalid
> static_cast from type 'const itk::RGBPixel<unsigned char>' to type 'float'
>
>
>
> --
> View this message in context:
> http://itk-insight-users.2283740.n2.nabble.com/RGBImageType-to-FloatImageType-wit-CastImageFilter-tp7583155.html
> Sent from the ITK Insight Users mailing list archive at Nabble.com.
> _____________________________________
> 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://www.kitware.com/products/protraining.php
>
> 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-users
>
--
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130524/ee567b67/attachment.htm>
More information about the Insight-users
mailing list