ITK  4.3.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< class TInputImage, class TOutputImage >
165 class ITK_EXPORT 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 
207  typedef typename Superclass::GridSizeType GridSizeType;
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,
242  InputImageDimension);
243 
246 
249 
252 
255 
258 
261 
264 
267 
271  itkSetMacro(MaximumLambda, double);
272  itkGetConstReferenceMacro(MaximumLambda, double);
274 
276  itkSetMacro(NumberOfRegions, unsigned int);
277  itkGetConstReferenceMacro(NumberOfRegions, unsigned int);
279 
281  LabelImagePointer GetLabelledImage(void);
282 
284  void PrintAlgorithmRegionStats(void);
285 
287  void PrintAlgorithmBorderStats(void);
288 
289 #ifdef ITK_USE_CONCEPT_CHECKING
290 
291  itkConceptMacro( InputHasNumericTraitsCheck,
293  itkConceptMacro( SameDimension,
294  ( Concept::SameDimension< itkGetStaticConstMacro(InputImageDimension),
295  itkGetStaticConstMacro(OutputImageDimension) > ) );
296 #if defined(THIS_CONCEPT_FAILS_ON_GCC)
297 
299  itkConceptMacro( SameVectorDimension,
300  ( Concept::SameDimension< itkGetStaticConstMacro(InputImageVectorDimension),
301  itkGetStaticConstMacro(OutputImageVectorDimension) > ) );
302 #endif
303 
305 #endif
306 
307 protected:
310  void PrintSelf(std::ostream & os, Indent indent) const;
311 
315  virtual void GenerateData();
316 
320  virtual void GenerateInputRequestedRegion();
321 
326  virtual void EnlargeOutputRequestedRegion(DataObject *);
327 
330  void ApplyRegionGrowImageFilter();
331 
335  virtual void MergeRegions();
336 
338  virtual void GenerateOutputImage();
339 
341  void ApplyKLM();
342 
344  void InitializeKLM();
345 
347  LabelImagePointer GenerateLabelledImage(LabelImageType *labelImagePtr);
348 
354  virtual void InitializeRegionParameters(InputRegionType region);
355 
359  virtual void ResolveRegions();
360 
361 private:
362  KLMRegionGrowImageFilter(const Self &); // purposely not implemented
363  void operator=(const Self &); // purposely not implemented
364 
365  typedef typename TInputImage::SizeType InputImageSizeType;
368 
370  unsigned int m_NumberOfRegions;
371 
377 
378  std::vector< KLMSegmentationRegionPtr > m_RegionsPointer;
379  std::vector< KLMSegmentationBorderPtr > m_BordersPointer;
380  std::vector< KLMSegmentationBorderArrayPtr > m_BordersDynamicPointer;
382 
385 }; // class KLMRegionGrowImageFilter
386 } // namespace itk
387 
388 #ifndef ITK_MANUAL_INSTANTIATION
389 #include "itkKLMRegionGrowImageFilter.hxx"
390 #endif
391 
392 #endif
393