ITK  5.2.0
Insight Toolkit
itkMaskedMovingHistogramImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkMaskedMovingHistogramImageFilter_h
19 #define itkMaskedMovingHistogramImageFilter_h
20 
23 #include <list>
24 #include <map>
25 #include <set>
26 
27 namespace itk
28 {
42 template <typename TInputImage, typename TMaskImage, typename TOutputImage, typename TKernel, typename THistogram>
43 class ITK_TEMPLATE_EXPORT MaskedMovingHistogramImageFilter
44  : public MovingHistogramImageFilterBase<TInputImage, TOutputImage, TKernel>
45 {
46 public:
47  ITK_DISALLOW_COPY_AND_MOVE(MaskedMovingHistogramImageFilter);
48 
54 
56  itkNewMacro(Self);
57 
60 
62  using InputImageType = TInputImage;
63  using OutputImageType = TOutputImage;
64  using MaskImageType = TMaskImage;
66  using SizeType = typename TInputImage::SizeType;
68  using PixelType = typename TInputImage::PixelType;
69  using OffsetType = typename TInputImage::OffsetType;
70  using OutputImageRegionType = typename Superclass::OutputImageRegionType;
71  using OutputPixelType = typename TOutputImage::PixelType;
72  using InputPixelType = typename TInputImage::PixelType;
73  using MaskPixelType = typename MaskImageType::PixelType;
74  using HistogramType = THistogram;
75 
77  void
78  SetMaskImage(const MaskImageType * input)
79  {
80  // Process object is not const-correct so the const casting is required.
81  this->SetNthInput(1, const_cast<TMaskImage *>(input));
82  }
83 
85  MaskImageType *
87  {
88  return static_cast<MaskImageType *>(const_cast<DataObject *>(this->ProcessObject::GetInput(1)));
89  }
90 
92  void
93  SetInput1(const InputImageType * input)
94  {
95  this->SetInput(input);
96  }
97 
99  void
100  SetInput2(const MaskImageType * input)
101  {
102  this->SetMaskImage(input);
103  }
104 
106  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
107 
109  using KernelType = TKernel;
110 
112  using KernelIteratorType = typename KernelType::ConstIterator;
113 
116 
117  using OffsetListType = typename std::list<OffsetType>;
118 
119  using OffsetMapType = typename std::map<OffsetType, OffsetListType, Functor::LexicographicCompare>;
120 
122  MaskImageType *
123  GetOutputMask();
124 
125  void
126  AllocateOutputs() override;
127 
129  using Superclass::MakeOutput;
131  MakeOutput(DataObjectPointerArraySizeType idx) override;
132 
133  itkSetMacro(FillValue, OutputPixelType);
134  itkGetConstMacro(FillValue, OutputPixelType);
135 
136  itkSetMacro(MaskValue, MaskPixelType);
137  itkGetConstMacro(MaskValue, MaskPixelType);
138 
139  itkSetMacro(BackgroundMaskValue, MaskPixelType);
140  itkGetConstMacro(BackgroundMaskValue, MaskPixelType);
141 
142  void
143  SetGenerateOutputMask(bool);
144 
145  itkGetConstMacro(GenerateOutputMask, bool);
146  itkBooleanMacro(GenerateOutputMask);
147 
149  virtual void
150  ConfigureHistogram(THistogram &)
151  {}
152 
153 protected:
155  ~MaskedMovingHistogramImageFilter() override = default;
156 
158  void
159  DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
160 
161 
162  void
163  PrintSelf(std::ostream & os, Indent indent) const override;
164 
165  void
166  pushHistogram(HistogramType & histogram,
167  const OffsetListType * addedList,
168  const OffsetListType * removedList,
169  const RegionType & inputRegion,
170  const RegionType & kernRegion,
171  const InputImageType * inputImage,
172  const MaskImageType * maskImage,
173  const IndexType currentIdx);
174 
175 private:
177 
179 
181 
183 }; // end of class
184 } // end namespace itk
185 
186 #ifndef ITK_MANUAL_INSTANTIATION
187 # include "itkMaskedMovingHistogramImageFilter.hxx"
188 #endif
189 
190 #endif
itk::MaskedMovingHistogramImageFilter::SetInput1
void SetInput1(const InputImageType *input)
Definition: itkMaskedMovingHistogramImageFilter.h:93
itk::BoxImageFilter::OutputPixelType
typename TOutputImage::PixelType OutputPixelType
Definition: itkBoxImageFilter.h:67
itk::MovingHistogramImageFilterBase::KernelIteratorType
typename KernelType::ConstIterator KernelIteratorType
Definition: itkMovingHistogramImageFilterBase.h:126
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itkLexicographicCompare.h
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::MaskedMovingHistogramImageFilter::SetInput2
void SetInput2(const MaskImageType *input)
Definition: itkMaskedMovingHistogramImageFilter.h:100
itk::ProcessObject::DataObjectPointerArraySizeType
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Definition: itkProcessObject.h:193
itk::BoxImageFilter::RadiusType
typename TInputImage::SizeType RadiusType
Definition: itkBoxImageFilter.h:73
itk::BoxImageFilter::OffsetType
typename TInputImage::OffsetType OffsetType
Definition: itkBoxImageFilter.h:62
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::BoxImageFilter::InputPixelType
typename TInputImage::PixelType InputPixelType
Definition: itkBoxImageFilter.h:64
itk::BoxImageFilter::IndexType
typename TInputImage::IndexType IndexType
Definition: itkBoxImageFilter.h:61
itk::MovingHistogramImageFilterBase::PixelType
typename TInputImage::PixelType PixelType
Definition: itkMovingHistogramImageFilterBase.h:114
itk::MovingHistogramImageFilterBase
Implements a generic moving histogram algorithm.
Definition: itkMovingHistogramImageFilterBase.h:91
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::MaskedMovingHistogramImageFilter::m_GenerateOutputMask
bool m_GenerateOutputMask
Definition: itkMaskedMovingHistogramImageFilter.h:176
itk::MaskedMovingHistogramImageFilter::m_BackgroundMaskValue
MaskPixelType m_BackgroundMaskValue
Definition: itkMaskedMovingHistogramImageFilter.h:182
itk::MaskedMovingHistogramImageFilter< TInputImage, TMaskImage, TOutputImage, TKernel, Function::RankHistogram< TInputImage::PixelType > >::MaskImageType
TMaskImage MaskImageType
Definition: itkMaskedMovingHistogramImageFilter.h:64
itk::MaskedMovingHistogramImageFilter::ConfigureHistogram
virtual void ConfigureHistogram(THistogram &)
Definition: itkMaskedMovingHistogramImageFilter.h:150
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkMovingHistogramImageFilterBase.h
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itk::MaskedMovingHistogramImageFilter
Definition: itkMaskedMovingHistogramImageFilter.h:43
itk::ImageSource::DataObjectPointerArraySizeType
Superclass::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
Definition: itkImageSource.h:84
itk::MaskedMovingHistogramImageFilter::m_MaskValue
MaskPixelType m_MaskValue
Definition: itkMaskedMovingHistogramImageFilter.h:180
itk::MovingHistogramImageFilter
Implements a generic moving histogram algorithm.
Definition: itkMovingHistogramImageFilter.h:88
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::KernelImageFilter::KernelType
TKernel KernelType
Definition: itkKernelImageFilter.h:71
itk::MovingHistogramImageFilterBase::OffsetMapType
typename std::map< OffsetType, OffsetListType, Functor::LexicographicCompare > OffsetMapType
Definition: itkMovingHistogramImageFilterBase.h:133
itk::MaskedMovingHistogramImageFilter::GetMaskImage
MaskImageType * GetMaskImage()
Definition: itkMaskedMovingHistogramImageFilter.h:86
itk::Function::RankHistogram
Definition: itkRankHistogram.h:51
itk::MaskedMovingHistogramImageFilter::SetMaskImage
void SetMaskImage(const MaskImageType *input)
Definition: itkMaskedMovingHistogramImageFilter.h:78
itk::BoxImageFilter::SizeType
typename TInputImage::SizeType SizeType
Definition: itkBoxImageFilter.h:60
itk::MaskedMovingHistogramImageFilter< TInputImage, TMaskImage, TOutputImage, TKernel, Function::RankHistogram< TInputImage::PixelType > >::MaskPixelType
typename MaskImageType::PixelType MaskPixelType
Definition: itkMaskedMovingHistogramImageFilter.h:73
itk::MovingHistogramImageFilterBase::OffsetListType
typename std::list< OffsetType > OffsetListType
Definition: itkMovingHistogramImageFilterBase.h:131
itk::MaskedMovingHistogramImageFilter::m_FillValue
OutputPixelType m_FillValue
Definition: itkMaskedMovingHistogramImageFilter.h:178
itk::ProcessObject::GetInput
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90
itk::BoxImageFilter::RegionType
typename TInputImage::RegionType RegionType
Definition: itkBoxImageFilter.h:59