ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkKLMRegionGrowImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 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 {
164 template< typename TInputImage, typename TOutputImage >
165 class KLMRegionGrowImageFilter:public RegionGrowImageFilter< TInputImage, TOutputImage >
166 {
167 public:
173 
175  itkNewMacro(Self);
176 
179 
181  typedef TInputImage InputImageType;
182  typedef typename TInputImage::Pointer InputImagePointer;
183  typedef typename TInputImage::ConstPointer InputImageConstPointer;
184 
186  typedef typename TInputImage::PixelType InputImagePixelType;
187 
189  typedef typename TInputImage::PixelType::VectorType InputImageVectorType;
190 
192  itkStaticConstMacro(InputImageVectorDimension, unsigned int,
193  InputImagePixelType::Dimension);
194 
196  typedef typename TInputImage::IndexType InputImageIndexType;
197 
201 
203  typedef typename TInputImage::RegionType InputRegionType;
204 
208 
210  typedef TOutputImage OutputImageType;
211  typedef typename TOutputImage::Pointer OutputImagePointer;
212 
214  itkStaticConstMacro(InputImageDimension, unsigned int,
215  TInputImage::ImageDimension);
216 
218  itkStaticConstMacro(OutputImageDimension, unsigned int,
219  TOutputImage::ImageDimension);
220 
222  typedef typename TOutputImage::PixelType OutputImagePixelType;
223 
225  typedef typename TOutputImage::PixelType::VectorType OutputImageVectorType;
226 
228  itkStaticConstMacro(OutputImageVectorDimension, unsigned int,
229  OutputImagePixelType::Dimension);
230 
232  typedef typename TOutputImage::IndexType OutputImageIndexType;
233 
236 
239 
241  itkStaticConstMacro(LabelImageDimension, RegionLabelType,
243 
246 
249 
252 
255 
258 
260  typedef vnl_vector< double > MeanRegionIntensityType;
261 
264 
267 
271  itkSetMacro(MaximumLambda, double);
272  itkGetConstReferenceMacro(MaximumLambda, double);
274 
276  itkSetMacro(NumberOfRegions, unsigned int);
277  itkGetConstReferenceMacro(NumberOfRegions, unsigned int);
279 
282 
285 
288 
289 #ifdef ITK_USE_CONCEPT_CHECKING
290  // Begin concept checking
291  itkConceptMacro( InputHasNumericTraitsCheck,
293  itkConceptMacro( SameDimension,
294  ( Concept::SameDimension< itkGetStaticConstMacro(InputImageDimension),
295  itkGetStaticConstMacro(OutputImageDimension) > ) );
296 #if defined(THIS_CONCEPT_FAILS_ON_GCC)
297 
298  itkConceptMacro( SameVectorDimension,
299  ( Concept::SameDimension< itkGetStaticConstMacro(InputImageVectorDimension),
300  itkGetStaticConstMacro(OutputImageVectorDimension) > ) );
301 #endif
302  // End concept checking
303 #endif
304 
305 protected:
308  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
309 
313  virtual void GenerateData() ITK_OVERRIDE;
314 
318  virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
319 
324  virtual void EnlargeOutputRequestedRegion(DataObject *) ITK_OVERRIDE;
325 
328  void ApplyRegionGrowImageFilter() ITK_OVERRIDE;
329 
333  virtual void MergeRegions() ITK_OVERRIDE;
334 
336  virtual void GenerateOutputImage();
337 
339  void ApplyKLM();
340 
342  void InitializeKLM();
343 
346 
352  virtual void InitializeRegionParameters(InputRegionType region);
353 
357  virtual void ResolveRegions();
358 
359 private:
360  KLMRegionGrowImageFilter(const Self &) ITK_DELETE_FUNCTION;
361  void operator=(const Self &) ITK_DELETE_FUNCTION;
362 
363  typedef typename TInputImage::SizeType InputImageSizeType;
366 
368  unsigned int m_NumberOfRegions;
369 
375 
376  std::vector< KLMSegmentationRegionPtr > m_RegionsPointer;
377  std::vector< KLMSegmentationBorderPtr > m_BordersPointer;
380 
383 }; // class KLMRegionGrowImageFilter
384 } // namespace itk
385 
386 #ifndef ITK_MANUAL_INSTANTIATION
387 #include "itkKLMRegionGrowImageFilter.hxx"
388 #endif
389 
390 #endif
static const unsigned int OutputImageVectorDimension
ImageRegionIterator< TOutputImage > OutputImageIterator
static const unsigned int InputImageDimension
Base class for KLMSegmentationRegion object.
LabelImagePointer GenerateLabelledImage(LabelImageType *labelImagePtr)
static const unsigned int OutputImageDimension
SmartPointer< const Self > ConstPointer
virtual void MergeRegions() override
ImageRegionIterator< LabelImageType > LabelImageIterator
virtual void GenerateData() override
Base class for all process objects that output image data.
TOutputImage::IndexType OutputImageIndexType
TOutputImage::PixelType::VectorType OutputImageVectorType
ImageRegionIterator< TInputImage > InputImageIterator
TPixel PixelType
Definition: itkImage.h:89
void ApplyRegionGrowImageFilter() override
TInputImage::PixelType::VectorType InputImageVectorType
LabelImageType::IndexType LabelImageIndexType
KLMSegmentationBorderArrayPtr * m_BorderCandidate
virtual void EnlargeOutputRequestedRegion(DataObject *) override
virtual void InitializeRegionParameters(InputRegionType region)
ImageRegionConstIterator< TInputImage > InputImageConstIterator
A multi-dimensional iterator templated over image type that walks a region of pixels.
virtual void GenerateOutputImage()
static const unsigned int InputImageVectorDimension
Superclass::IndexType IndexType
Definition: itkImage.h:119
RegionGrowImageFilter< TInputImage, TOutputImage > Superclass
typedef(Concept::HasNumericTraits< typename InputImagePixelType::ValueType >) InputHasNumericTraitsCheck
Base class for a region growing object that performs energy-based region growing for multiband images...
Base class for KLMSegmentationBorder object.
Superclass::RegionLabelType RegionLabelType
std::vector< KLMSegmentationBorderPtr > m_BordersPointer
virtual void GenerateInputRequestedRegion() override
static const RegionLabelType LabelImageDimension
Base class for RegionGrowImageFilter object.
std::vector< KLMSegmentationBorderArrayPtr > m_BordersDynamicPointer
LabelImageType::PixelType LabelImagePixelType
LabelImagePointer GetLabelledImage()
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Image< RegionLabelType, itkGetStaticConstMacro(LabelImageDimension) > LabelImageType
void PrintSelf(std::ostream &os, Indent indent) const override
std::vector< KLMSegmentationRegionPtr > m_RegionsPointer
KLMSegmentationRegion::RegionLabelType RegionLabelType
Object maintaining a reference to a list of borders associated with a region.
#define itkConceptMacro(name, concept)
TInputImage::ConstPointer InputImageConstPointer
KLMDynamicBorderArray< BorderType > KLMSegmentationBorderArrayPtr
Base class for all data objects in ITK.
Templated n-dimensional image class.
Definition: itkImage.h:75
A multi-dimensional iterator templated over image type that walks a region of pixels.
TOutputImage::PixelType OutputImagePixelType