[ITK] [ITK-users] itkMeanImageFilter on RGB (how to adjust example MedianFilteringOfAnRGBImage?)
Dr. Roman Grothausmann
grothausmann.roman at mh-hannover.de
Fri Jul 11 07:53:36 EDT 2014
Dear mailing list members,
How would I need to extend/modify the example for MedianFilteringOfAnRGBImage
http://itk.org/ITKExamples/src/Filtering/Smoothing/MedianFilteringOfAnRGBImage/Documentation.html
to work with itkMeanImageFilter?
I modified myRGBPixel like this:
namespace itk{
template<typename TComponent>
class myRGBPixel : public RGBPixel<TComponent>{
public:
typedef myRGBPixel Self;
typedef RGBPixel<TComponent> Superclass;
myRGBPixel():Superclass() {} //avoid candidate expects 1 argument, 0 provided
myRGBPixel(int i):Superclass(i) {} //avoid candidate expects 0 arguments, 1
provided
using RGBPixel<TComponent>::operator=;
bool operator<=(const Self & r) const{
return (this->GetLuminance() <= r.GetLuminance());
}
bool operator>=(const Self & r) const{
return (this->GetLuminance() >= r.GetLuminance());
}
bool operator<(const Self & r) const{
return (this->GetLuminance() < r.GetLuminance());
}
bool operator>(const Self & r) const{
return (this->GetLuminance() > r.GetLuminance());
}
};
}
However gcc still yields this error:
In file included from /opt/itk-4.5.1/include/ITK-4.5/itkMeanImageFilter.h:115:0,
from /net/home/ghky/itk/simple/mean-CPU_02.cxx:8:
/opt/itk-4.5.1/include/ITK-4.5/itkMeanImageFilter.hxx: In instantiation of ?void
itk::MeanImageFilter<TInputImage, TOutputImage>::ThreadedGenerateData(const
OutputImageRegionType&, itk::ThreadIdType) [with TInputImage =
itk::Image<itk::myRGBPixel<unsigned char>, 3u>; TOutputImage =
itk::Image<itk::myRGBPixel<unsigned char>, 3u>;
itk::MeanImageFilter<TInputImage, TOutputImage>::OutputImageRegionType =
itk::ImageRegion<3u>; itk::ThreadIdType = unsigned int]?:
/net/home/ghky/itk/simple/mean-CPU_02.cxx:335:5: required from here
/opt/itk-4.5.1/include/ITK-4.5/itkMeanImageFilter.hxx:81:9: error: invalid
static_cast from type
?itk::ConstNeighborhoodIterator<itk::Image<itk::myRGBPixel<unsigned char>, 3u>,
itk::ZeroFluxNeumannBoundaryCondition<itk::Image<itk::myRGBPixel<unsigned char>,
3u>, itk::Image<itk::myRGBPixel<unsigned char>, 3u> > >::PixelType {aka
itk::myRGBPixel<unsigned char>}? to type
?itk::MeanImageFilter<itk::Image<itk::myRGBPixel<unsigned char>, 3u>,
itk::Image<itk::myRGBPixel<unsigned char>, 3u> >::InputRealType {aka double}?
make[3]: *** [CMakeFiles/mean-CPU_02.dir/mean-CPU_02.cxx.o] Error 1
make[2]: *** [CMakeFiles/mean-CPU_02.dir/all] Error 2
make[1]: *** [CMakeFiles/mean-CPU_02.dir/rule] Error 2
make: *** [mean-CPU_02] Error 2
What am I missing in myRGBPixel?
Any help or hints are very much appreciated
Roman
--
Dr. Roman Grothausmann
Tomographie und Digitale Bildverarbeitung
Tomography and Digital Image Analysis
Institut für Funktionelle und Angewandte Anatomie, OE 4120
Medizinische Hochschule Hannover
Carl-Neuberg-Str. 1
D-30625 Hannover
Tel. +49 511 532-9574
_____________________________________
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://public.kitware.com/mailman/listinfo/insight-users
More information about the Community
mailing list