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{
111template <typename TInputImage, typename TOutputImage = TInputImage, typename TWeights = float>
112class ITK_TEMPLATE_EXPORT MultiLabelSTAPLEImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
113{
114public:
115 ITK_DISALLOW_COPY_AND_MOVE(MultiLabelSTAPLEImageFilter);
116
122
124 itkNewMacro(Self);
125
127 itkOverrideGetNameOfClassMacro(MultiLabelSTAPLEImageFilter);
128
131 using OutputPixelType = typename TOutputImage::PixelType;
132 using InputPixelType = typename TInputImage::PixelType;
133
136 static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
137
139 using InputImageType = TInputImage;
140 using OutputImageType = TOutputImage;
141 using InputImagePointer = typename InputImageType::Pointer;
142 using OutputImagePointer = typename OutputImageType::Pointer;
143
146
150
152 using WeightsType = TWeights;
155
157 itkGetConstMacro(ElapsedNumberOfIterations, unsigned int);
158
162 void
163 SetMaximumNumberOfIterations(const unsigned int mit)
164 {
165 this->m_MaximumNumberOfIterations = mit;
167 this->Modified();
168 }
169 itkGetConstMacro(MaximumNumberOfIterations, unsigned int);
171
173 itkGetConstMacro(HasMaximumNumberOfIterations, bool);
174
177 void
179 {
181 {
182 this->m_HasMaximumNumberOfIterations = false;
183 this->Modified();
184 }
185 }
186
190 itkSetMacro(TerminationUpdateThreshold, TWeights);
191 itkGetConstMacro(TerminationUpdateThreshold, TWeights);
193
196 void
198 {
200 this->m_HasLabelForUndecidedPixels = true;
201 this->Modified();
202 }
203
211 itkGetMacro(LabelForUndecidedPixels, OutputPixelType);
212
214 itkGetMacro(HasLabelForUndecidedPixels, bool);
215
218 void
220 {
222 {
223 this->m_HasLabelForUndecidedPixels = false;
224 this->Modified();
225 }
226 }
227
234 void
236 {
237 this->m_PriorProbabilities = ppa;
238 this->m_HasPriorProbabilities = true;
239 this->Modified();
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
268 const ConfusionMatrixType &
269 GetConfusionMatrix(const unsigned int i) const
270 {
271 return this->m_ConfusionMatrixArray[i];
272 }
273
274protected:
279 ~MultiLabelSTAPLEImageFilter() override = default;
280
281 void
282 GenerateData() override;
283
284 void
285 PrintSelf(std::ostream &, Indent) const override;
286
288 typename TInputImage::PixelType
290
291 // Override since the filter needs all the data for the algorithm
292 void
294
295 // Override since the filter produces all of its output
296 void
298
299private:
300 size_t m_TotalLabelCount{ 0 };
301
304
307
308 void
310
311 std::vector<ConfusionMatrixType> m_ConfusionMatrixArray{};
312 std::vector<ConfusionMatrixType> m_UpdatedConfusionMatrixArray{};
313
314 void
316 void
318
321 unsigned int m_ElapsedNumberOfIterations{ 0u };
322
324};
325
326} // end namespace itk
327
328#ifndef ITK_MANUAL_INSTANTIATION
329# include "itkMultiLabelSTAPLEImageFilter.hxx"
330#endif
331
332#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:51
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....