ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
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 * https://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
27namespace itk
28{
41
42template <typename TInputImage, typename TMaskImage, typename TOutputImage, typename TKernel, typename THistogram>
43class ITK_TEMPLATE_EXPORT MaskedMovingHistogramImageFilter
44 : public MovingHistogramImageFilterBase<TInputImage, TOutputImage, TKernel>
45{
46public:
47 ITK_DISALLOW_COPY_AND_MOVE(MaskedMovingHistogramImageFilter);
48
54
56 itkNewMacro(Self);
57
59 itkOverrideGetNameOfClassMacro(MaskedMovingHistogramImageFilter);
60
62 using InputImageType = TInputImage;
63 using OutputImageType = TOutputImage;
64 using MaskImageType = TMaskImage;
65 using RegionType = typename TInputImage::RegionType;
66 using SizeType = typename TInputImage::SizeType;
67 using IndexType = typename TInputImage::IndexType;
68 using PixelType = typename TInputImage::PixelType;
69 using OffsetType = typename TInputImage::OffsetType;
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
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
94 {
95 this->SetInput(input);
96 }
97
99 void
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
115 using RadiusType = typename KernelType::SizeType;
116
117 using OffsetListType = typename std::list<OffsetType>;
118
119 using OffsetMapType = typename std::map<OffsetType, OffsetListType, Functor::LexicographicCompare>;
120
124
125 void
126 AllocateOutputs() override;
127
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
144
145 itkGetConstMacro(GenerateOutputMask, bool);
146 itkBooleanMacro(GenerateOutputMask);
147
149 virtual void
150 ConfigureHistogram(THistogram &)
151 {}
152
153protected:
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
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
175private:
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
Base class for all data objects in ITK.
SmartPointer< Self > Pointer
typename OutputImageType::RegionType OutputImageRegionType
ProcessObject::DataObjectPointer MakeOutput(ProcessObject::DataObjectPointerArraySizeType idx) override
typename OutputImageType::RegionType OutputImageRegionType
virtual void SetInput(const InputImageType *input)
Control indentation during Print() invocation.
Definition itkIndent.h:50
DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) override
void pushHistogram(HistogramType &histogram, const OffsetListType *addedList, const OffsetListType *removedList, const RegionType &inputRegion, const RegionType &kernRegion, const InputImageType *inputImage, const MaskImageType *maskImage, const IndexType currentIdx)
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
void PrintSelf(std::ostream &os, Indent indent) const override
~MaskedMovingHistogramImageFilter() override=default
typename std::map< OffsetType, OffsetListType, Functor::LexicographicCompare > OffsetMapType
MovingHistogramImageFilterBase< TInputImage, TOutputImage, TKernel > Superclass
ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
virtual void SetNthInput(DataObjectPointerArraySizeType idx, DataObject *input)
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....