ITK  6.0.0
Insight Toolkit
itkKLMRegionGrowImageFilter.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 itkKLMRegionGrowImageFilter_h
19 #define itkKLMRegionGrowImageFilter_h
20 
21 #include "itkImage.h"
24 #include "itkImageRegionIterator.h"
25 #include "itkConceptChecking.h"
26 #include <algorithm>
27 #include <functional>
28 
29 namespace itk
30 {
166 template <typename TInputImage, typename TOutputImage>
167 class ITK_TEMPLATE_EXPORT KLMRegionGrowImageFilter : public RegionGrowImageFilter<TInputImage, TOutputImage>
168 {
169 public:
170  ITK_DISALLOW_COPY_AND_MOVE(KLMRegionGrowImageFilter);
171 
177 
179  itkNewMacro(Self);
180 
182  itkOverrideGetNameOfClassMacro(KLMRegionGrowImageFilter);
183 
185  using InputImageType = TInputImage;
188 
190  using InputImagePixelType = typename TInputImage::PixelType;
191 
194 
196  static constexpr unsigned int InputImageVectorDimension = InputImagePixelType::Dimension;
197 
200 
204 
207 
210  using typename Superclass::GridSizeType;
211 
213  using OutputImageType = TOutputImage;
215 
217  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
218 
220  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
221 
223  using OutputImagePixelType = typename TOutputImage::PixelType;
224 
227 
229  static constexpr unsigned int OutputImageVectorDimension = OutputImagePixelType::Dimension;
230 
233 
236 
239 
241  static constexpr RegionLabelType LabelImageDimension = InputImageDimension;
242 
245 
248 
251 
254 
257 
259  using MeanRegionIntensityType = vnl_vector<double>;
260 
263 
266 
270  itkSetMacro(MaximumLambda, double);
271  itkGetConstReferenceMacro(MaximumLambda, double);
275  itkSetMacro(NumberOfRegions, unsigned int);
276  itkGetConstReferenceMacro(NumberOfRegions, unsigned int);
281  GetLabelledImage();
282 
284  void
285  PrintAlgorithmRegionStats();
286 
288  void
289  PrintAlgorithmBorderStats();
290 
291 #ifdef ITK_USE_CONCEPT_CHECKING
292  // Begin concept checking
295 # if defined(THIS_CONCEPT_FAILS_ON_GCC)
296 
297  itkConceptMacro(SameVectorDimension,
299 # endif
300  // End concept checking
301 #endif
302 
303 protected:
305  ~KLMRegionGrowImageFilter() override = default;
306  void
307  PrintSelf(std::ostream & os, Indent indent) const override;
308 
312  void
313  GenerateData() override;
314 
318  void
319  GenerateInputRequestedRegion() override;
320 
325  void
326  EnlargeOutputRequestedRegion(DataObject *) override;
327 
330  void
331  ApplyRegionGrowImageFilter() override;
332 
336  void
337  MergeRegions() override;
338 
340  virtual void
341  GenerateOutputImage();
342 
344  void
345  ApplyKLM();
346 
348  void
349  InitializeKLM();
350 
353  GenerateLabelledImage(LabelImageType * labelImagePtr);
354 
360  virtual void
361  InitializeRegionParameters(InputRegionType region);
362 
366  virtual void
367  ResolveRegions();
368 
369 private:
373 
374  double m_MaximumLambda{ 1000 };
375  unsigned int m_NumberOfRegions{ 0 };
376 
379  double m_InternalLambda{ 0 };
380  unsigned int m_InitialNumberOfRegions{ 0 };
381  double m_TotalBorderLength{ 0.0 };
382 
383  std::vector<KLMSegmentationRegionPtr> m_RegionsPointer{};
384  std::vector<KLMSegmentationBorderPtr> m_BordersPointer{};
385  std::vector<KLMSegmentationBorderArrayPtr> m_BordersDynamicPointer{};
386  KLMSegmentationBorderArrayPtr * m_BorderCandidate{ nullptr };
387 
388  MeanRegionIntensityType m_InitialRegionMean{};
389  double m_InitialRegionArea{ 0 };
390 }; // class KLMRegionGrowImageFilter
391 } // namespace itk
392 
393 #ifndef ITK_MANUAL_INSTANTIATION
394 # include "itkKLMRegionGrowImageFilter.hxx"
395 #endif
396 
397 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::Concept::HasNumericTraits
Definition: itkConceptChecking.h:717
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::KLMRegionGrowImageFilter::LabelImagePixelType
typename LabelImageType::PixelType LabelImagePixelType
Definition: itkKLMRegionGrowImageFilter.h:250
itk::KLMRegionGrowImageFilter::InputRegionType
typename TInputImage::RegionType InputRegionType
Definition: itkKLMRegionGrowImageFilter.h:206
itk::GTest::TypedefsAndConstructors::Dimension2::VectorType
ImageBaseType::SpacingType VectorType
Definition: itkGTestTypedefsAndConstructors.h:53
itkRegionGrowImageFilter.h
itk::KLMRegionGrowImageFilter::KLMSegmentationBorderPtr
typename KLMSegmentationBorder::Pointer KLMSegmentationBorderPtr
Definition: itkKLMRegionGrowImageFilter.h:372
itkConceptChecking.h
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::KLMSegmentationBorder::Pointer
SmartPointer< Self > Pointer
Definition: itkKLMSegmentationBorder.h:146
itkImage.h
itk::KLMRegionGrowImageFilter::InputImageVectorType
typename TInputImage::PixelType::VectorType InputImageVectorType
Definition: itkKLMRegionGrowImageFilter.h:193
itk::SmartPointer< Self >
itkImageRegionIterator.h
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::KLMSegmentationBorder
class ITK_FORWARD_EXPORT KLMSegmentationBorder
Definition: itkKLMSegmentationRegion.h:91
itk::Concept::SameDimension
Definition: itkConceptChecking.h:697
itk::KLMRegionGrowImageFilter::OutputImageVectorType
typename TOutputImage::PixelType::VectorType OutputImageVectorType
Definition: itkKLMRegionGrowImageFilter.h:226
itk::ImageToImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkImageToImageFilter.h:133
itk::ImageRegionIterator
A multi-dimensional iterator templated over image type that walks a region of pixels.
Definition: itkImageRegionIterator.h:80
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::KLMRegionGrowImageFilter::RegionLabelType
typename KLMSegmentationRegion::RegionLabelType RegionLabelType
Definition: itkKLMRegionGrowImageFilter.h:238
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::KLMRegionGrowImageFilter::InputImageIndexType
typename TInputImage::IndexType InputImageIndexType
Definition: itkKLMRegionGrowImageFilter.h:199
itk::KLMRegionGrowImageFilter::OutputImageIndexType
typename TOutputImage::IndexType OutputImageIndexType
Definition: itkKLMRegionGrowImageFilter.h:232
itk::KLMSegmentationRegion::RegionLabelType
Superclass::RegionLabelType RegionLabelType
Definition: itkKLMSegmentationRegion.h:126
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::KLMRegionGrowImageFilter::LabelImagePointer
typename LabelImageType::Pointer LabelImagePointer
Definition: itkKLMRegionGrowImageFilter.h:247
itk::KLMRegionGrowImageFilter::LabelImageIndexType
typename LabelImageType::IndexType LabelImageIndexType
Definition: itkKLMRegionGrowImageFilter.h:253
itk::KLMRegionGrowImageFilter::MeanRegionIntensityType
vnl_vector< double > MeanRegionIntensityType
Definition: itkKLMRegionGrowImageFilter.h:259
itk::Image::PixelType
TPixel PixelType
Definition: itkImage.h:108
itk::RegionGrowImageFilter
Base class for RegionGrowImageFilter object.
Definition: itkRegionGrowImageFilter.h:85
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk::KLMRegionGrowImageFilter::KLMSegmentationRegionPtr
typename KLMSegmentationRegion::Pointer KLMSegmentationRegionPtr
Definition: itkKLMRegionGrowImageFilter.h:371
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::ImageSource::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itkKLMSegmentationBorder.h
itk::ImageRegionConstIterator
A multi-dimensional iterator templated over image type that walks a region of pixels.
Definition: itkImageRegionConstIterator.h:109
itk::KLMSegmentationRegion::Pointer
SmartPointer< Self > Pointer
Definition: itkKLMSegmentationRegion.h:101
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:88
itk::KLMDynamicBorderArray
Object maintaining a reference to a list of borders associated with a region.
Definition: itkKLMSegmentationBorder.h:43
itk::GTest::TypedefsAndConstructors::Dimension2::Dimension
constexpr unsigned int Dimension
Definition: itkGTestTypedefsAndConstructors.h:44
itk::KLMRegionGrowImageFilter
Base class for a region growing object that performs energy-based region growing for multiband images...
Definition: itkKLMRegionGrowImageFilter.h:167
itk::KLMSegmentationBorder
Base class for KLMSegmentationBorder object.
Definition: itkKLMSegmentationBorder.h:138
itk::KLMRegionGrowImageFilter::InputImageSizeType
typename TInputImage::SizeType InputImageSizeType
Definition: itkKLMRegionGrowImageFilter.h:370
itk::ImageToImageFilter::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkImageToImageFilter.h:131
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293