ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkMultiLabelSTAPLEImageFilter.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 itkMultiLabelSTAPLEImageFilter_h
19#define itkMultiLabelSTAPLEImageFilter_h
20
21#include "itkImage.h"
23
26
27#include "vector"
28#include "itkArray.h"
29#include "itkArray2D.h"
30#include "itkNumericTraits.h"
31
32namespace itk
33{
109template <typename TInputImage, typename TOutputImage = TInputImage, typename TWeights = float>
110class ITK_TEMPLATE_EXPORT MultiLabelSTAPLEImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
111{
112public:
113 ITK_DISALLOW_COPY_AND_MOVE(MultiLabelSTAPLEImageFilter);
114
120
122 itkNewMacro(Self);
123
125 itkOverrideGetNameOfClassMacro(MultiLabelSTAPLEImageFilter);
126
129 using OutputPixelType = typename TOutputImage::PixelType;
130 using InputPixelType = typename TInputImage::PixelType;
131
134 static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
135
137 using InputImageType = TInputImage;
138 using OutputImageType = TOutputImage;
139 using InputImagePointer = typename InputImageType::Pointer;
140 using OutputImagePointer = typename OutputImageType::Pointer;
141
144
148
150 using WeightsType = TWeights;
153
155 itkGetConstMacro(ElapsedNumberOfIterations, unsigned int);
156
159 void
160 SetMaximumNumberOfIterations(const unsigned int mit)
161 {
162 this->m_MaximumNumberOfIterations = mit;
164 this->Modified();
165 }
166 itkGetConstMacro(MaximumNumberOfIterations, unsigned int);
168
170 itkGetConstMacro(HasMaximumNumberOfIterations, bool);
171
174 void
176 {
178 {
179 this->m_HasMaximumNumberOfIterations = false;
180 this->Modified();
181 }
182 }
183
184
187 itkSetMacro(TerminationUpdateThreshold, TWeights);
188 itkGetConstMacro(TerminationUpdateThreshold, TWeights);
190
193 void
195 {
197 this->m_HasLabelForUndecidedPixels = true;
198 this->Modified();
199 }
200
201
209 itkGetMacro(LabelForUndecidedPixels, OutputPixelType);
210
212 itkGetMacro(HasLabelForUndecidedPixels, bool);
213
216 void
218 {
220 {
221 this->m_HasLabelForUndecidedPixels = false;
222 this->Modified();
223 }
224 }
225
226
233 void
235 {
236 this->m_PriorProbabilities = ppa;
237 this->m_HasPriorProbabilities = true;
238 this->Modified();
239 }
240
241
249 itkGetConstReferenceMacro(PriorProbabilities, PriorProbabilitiesType);
250
252 itkGetMacro(HasPriorProbabilities, bool);
253
256 void
258 {
259 if (this->m_HasPriorProbabilities)
260 {
261 this->m_HasPriorProbabilities = false;
262 this->Modified();
263 }
264 }
265
266
269 const ConfusionMatrixType &
270 GetConfusionMatrix(const unsigned int i) const
271 {
272 return this->m_ConfusionMatrixArray[i];
273 }
274
275protected:
280 ~MultiLabelSTAPLEImageFilter() override = default;
281
282 void
283 GenerateData() override;
284
285 void
286 PrintSelf(std::ostream &, Indent) const override;
287
289 typename TInputImage::PixelType
291
292 // Override since the filter needs all the data for the algorithm
293 void
295
296 // Override since the filter produces all of its output
297 void
299
300private:
301 size_t m_TotalLabelCount{ 0 };
302
305
308
309 void
311
312 std::vector<ConfusionMatrixType> m_ConfusionMatrixArray{};
313 std::vector<ConfusionMatrixType> m_UpdatedConfusionMatrixArray{};
314
315 void
317 void
319
322 unsigned int m_ElapsedNumberOfIterations{ 0u };
323
325};
326
327} // end namespace itk
328
329#ifndef ITK_MANUAL_INSTANTIATION
330# include "itkMultiLabelSTAPLEImageFilter.hxx"
331#endif
332
333#endif
Array2D class representing a 2D array.
Definition itkArray2D.h:43
Array class with size defined at construction time.
Definition itkArray.h:48
Base class for all data objects in ITK.
A multi-dimensional iterator templated over image type that walks a region of pixels.
A multi-dimensional iterator templated over image type that walks a region of pixels.
typename OutputImageType::RegionType OutputImageRegionType
Control indentation during Print() invocation.
Definition itkIndent.h:50
std::vector< ConfusionMatrixType > m_UpdatedConfusionMatrixArray
void PrintSelf(std::ostream &, Indent) const override
const ConfusionMatrixType & GetConfusionMatrix(const unsigned int i) const
void SetMaximumNumberOfIterations(const unsigned int mit)
typename InputImageType::Pointer InputImagePointer
typename OutputImageType::Pointer OutputImagePointer
void SetLabelForUndecidedPixels(const OutputPixelType l)
typename TInputImage::PixelType InputPixelType
~MultiLabelSTAPLEImageFilter() override=default
ImageRegionIterator< TOutputImage > OutputIteratorType
TInputImage::PixelType ComputeMaximumInputValue()
ImageRegionConstIterator< TInputImage > InputConstIteratorType
typename TOutputImage::PixelType OutputPixelType
ImageToImageFilter< TInputImage, TOutputImage > Superclass
void EnlargeOutputRequestedRegion(DataObject *) override
std::vector< ConfusionMatrixType > m_ConfusionMatrixArray
void GenerateInputRequestedRegion() override
void SetPriorProbabilities(const PriorProbabilitiesType &ppa)
virtual void Modified() const
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....