00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkMaskedMovingHistogramImageFilter_h
00018 #define __itkMaskedMovingHistogramImageFilter_h
00019
00020 #include "itkMovingHistogramImageFilterBase.h"
00021 #include <list>
00022 #include <map>
00023 #include <set>
00024
00025 namespace itk {
00026
00034 template<class TInputImage, class TMaskImage, class TOutputImage, class TKernel, class THistogram >
00035 class ITK_EXPORT MaskedMovingHistogramImageFilter :
00036 public MovingHistogramImageFilterBase<TInputImage, TOutputImage, TKernel>
00037 {
00038 public:
00040 typedef MaskedMovingHistogramImageFilter Self;
00041 typedef MovingHistogramImageFilterBase<TInputImage, TOutputImage, TKernel>
00042 Superclass;
00043 typedef SmartPointer<Self> Pointer;
00044 typedef SmartPointer<const Self> ConstPointer;
00045
00047 itkNewMacro(Self);
00048
00050 itkTypeMacro(MaskedMovingHistogramImageFilter,
00051 MovingHistogramImageFilter);
00052
00054 typedef TInputImage InputImageType;
00055 typedef TOutputImage OutputImageType;
00056 typedef TMaskImage MaskImageType;
00057 typedef typename TInputImage::RegionType RegionType;
00058 typedef typename TInputImage::SizeType SizeType;
00059 typedef typename TInputImage::IndexType IndexType;
00060 typedef typename TInputImage::PixelType PixelType;
00061 typedef typename TInputImage::OffsetType OffsetType;
00062 typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00063 typedef typename TOutputImage::PixelType OutputPixelType;
00064 typedef typename TInputImage::PixelType InputPixelType;
00065 typedef typename MaskImageType::PixelType MaskPixelType;
00066 typedef THistogram HistogramType;
00067
00069 void SetMaskImage(MaskImageType *input)
00070 {
00071
00072 this->SetNthInput( 1, const_cast<TMaskImage *>(input) );
00073 }
00074
00076 MaskImageType * GetMaskImage()
00077 {
00078 return static_cast<MaskImageType*>(const_cast<DataObject *>(this->ProcessObject::GetInput(1)));
00079 }
00080
00081
00083 void SetInput1(InputImageType *input)
00084 {
00085 this->SetInput( input );
00086 }
00087
00089 void SetInput2(MaskImageType *input)
00090 {
00091 this->SetMaskImage( input );
00092 }
00093
00094
00096 itkStaticConstMacro(ImageDimension, unsigned int,
00097 TInputImage::ImageDimension);
00098
00100 typedef TKernel KernelType;
00101
00103 typedef typename KernelType::ConstIterator KernelIteratorType;
00104
00106 typedef typename KernelType::SizeType RadiusType;
00107
00108 typedef typename std::list< OffsetType > OffsetListType;
00109
00110 typedef typename std::map< OffsetType, OffsetListType, typename Functor::OffsetLexicographicCompare<itkGetStaticConstMacro(ImageDimension)> > OffsetMapType;
00111
00113 MaskImageType * GetOutputMask();
00114
00115 void AllocateOutputs();
00116
00117 DataObject::Pointer MakeOutput(unsigned int idx);
00118
00119 itkSetMacro(FillValue, OutputPixelType);
00120 itkGetConstMacro(FillValue, OutputPixelType);
00121
00122 itkSetMacro(MaskValue, MaskPixelType);
00123 itkGetConstMacro(MaskValue, MaskPixelType);
00124
00125 itkSetMacro(BackgroundMaskValue, MaskPixelType);
00126 itkGetConstMacro(BackgroundMaskValue, MaskPixelType);
00127
00128 void SetGenerateOutputMask( bool );
00129 itkGetConstMacro(GenerateOutputMask, bool);
00130
00131
00132 protected:
00133 MaskedMovingHistogramImageFilter();
00134 ~MaskedMovingHistogramImageFilter() {};
00135
00137 void ThreadedGenerateData (const OutputImageRegionType&
00138 outputRegionForThread,
00139 int threadId);
00140
00141 void PrintSelf(std::ostream& os, Indent indent) const;
00142
00148 virtual THistogram * NewHistogram();
00149
00150 void pushHistogram(HistogramType *histogram,
00151 const OffsetListType* addedList,
00152 const OffsetListType* removedList,
00153 const RegionType &inputRegion,
00154 const RegionType &kernRegion,
00155 const InputImageType* inputImage,
00156 const MaskImageType *maskImage,
00157 const IndexType currentIdx);
00158
00159 private:
00160 MaskedMovingHistogramImageFilter(const Self&);
00161 void operator=(const Self&);
00162
00163 bool m_GenerateOutputMask;
00164
00165 OutputPixelType m_FillValue;
00166
00167 MaskPixelType m_MaskValue;
00168
00169 MaskPixelType m_BackgroundMaskValue;
00170
00171 };
00172
00173 }
00174
00175 #ifndef ITK_MANUAL_INSTANTIATION
00176 #include "itkMaskedMovingHistogramImageFilter.txx"
00177 #endif
00178
00179 #endif
00180