[Insight-users] RGBImageType to FloatImageType wit CastImageFilter
chasank
chasank at gmail.com
Fri May 24 05:02:33 EDT 2013
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.
More information about the Insight-users
mailing list