GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
itkViscousWatershedTransform.h
Go to the documentation of this file.
1 /*=========================================================================
2  Authors: The GoFigure Dev. Team.
3  at Megason Lab, Systems biology, Harvard Medical school, 2009-11
4 
5  Copyright (c) 2009-11, President and Fellows of Harvard College.
6  All rights reserved.
7 
8  Redistribution and use in source and binary forms, with or without
9  modification, are permitted provided that the following conditions are met:
10 
11  Redistributions of source code must retain the above copyright notice,
12  this list of conditions and the following disclaimer.
13  Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16  Neither the name of the President and Fellows of Harvard College
17  nor the names of its contributors may be used to endorse or promote
18  products derived from this software without specific prior written
19  permission.
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
25  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
30  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 
33 =========================================================================*/
34 
35 #ifndef __itkViscousWatershedTransform_h
36 #define __itkViscousWatershedTransform_h
37 
38 #if defined( _MSC_VER )
39 #pragma warning ( disable : 4786 )
40 #endif
41 
42 #ifdef __BORLANDC__
43 #define ITK_LEAN_AND_MEAN
44 #endif
45 
46 #include "itkImageToImageFilter.h"
47 #include "itkBinaryThresholdImageFilter.h"
48 #include "itkBinaryBallStructuringElement.h"
49 #include "itkBinaryMorphologicalClosingImageFilter.h"
50 #include "itkImageRegionIterator.h"
51 
52 namespace itk
53 {
54 template< class TFeatureImage, class TInputImage, class TSegmentImage >
55 class ViscousWatershedTransform:public ImageToImageFilter<
56  TFeatureImage, TFeatureImage >
57 {
58 public:
60  typedef ImageToImageFilter< TFeatureImage, TFeatureImage > Superclass;
61  typedef SmartPointer< Self > Pointer;
62  typedef SmartPointer< const Self > ConstPointer;
63 
64  itkStaticConstMacro (ImageDimension, unsigned int,
65  TFeatureImage::ImageDimension);
66 
68  itkNewMacro (Self);
69 
71  itkTypeMacro (ViscousWatershedTransform, ImageToImageFilter);
72 
74  void PrintSelf(std::ostream & os, Indent indent) const;
75 
76  typedef TFeatureImage FeatureImageType;
77  typedef typename FeatureImageType::Pointer FeatureImagePointer;
78  typedef typename FeatureImageType::ConstPointer FeatureImageConstPointer;
79  typedef typename FeatureImageType::PixelType FeatureImagePixelType;
80  typedef typename FeatureImageType::RegionType FeatureImageRegionType;
81  typedef typename FeatureImageType::SizeType FeatureImageSizeType;
82  typedef typename FeatureImageSizeType::SizeValueType FeatureImageSizeValueType;
83  typedef typename FeatureImageType::SpacingType FeatureImageSpacingType;
84  typedef typename FeatureImageType::IndexType FeatureImageIndexType;
85  typedef typename FeatureImageType::PointType FeatureImagePointType;
86 
87  typedef TInputImage ImageType;
88  typedef typename ImageType::Pointer ImagePointer;
89  typedef typename ImageType::ConstPointer ImageConstPointer;
90  typedef typename ImageType::PixelType ImagePixelType;
91  typedef typename ImageType::RegionType ImageRegionType;
92  typedef typename ImageType::SizeType ImageSizeType;
93  typedef typename ImageSizeType::SizeValueType ImageSizeValueType;
94  typedef typename ImageType::SpacingType ImageSpacingType;
95  typedef typename ImageType::IndexType ImageIndexType;
96  typedef typename ImageType::PointType ImagePointType;
97 
98  typedef TSegmentImage SegmentImageType;
99  typedef typename SegmentImageType::Pointer SegmentImagePointer;
100  typedef typename SegmentImageType::ConstPointer SegmentImageConstPointer;
101  typedef typename SegmentImageType::IndexType SegmentImageIndexType;
102  typedef typename SegmentImageType::PixelType SegmentImagePixelType;
103 
104  typedef BinaryThresholdImageFilter< FeatureImageType, FeatureImageType >
106  typedef typename ThresholdFilterType::Pointer ThresholdFilterPointer;
107 
108  typedef BinaryBallStructuringElement< int,
109  ImageDimension > StructuringElementType;
110  typedef BinaryMorphologicalClosingImageFilter< FeatureImageType, FeatureImageType,
112  typedef typename ClosingFilterType::Pointer
114  typedef ImageRegionIterator< FeatureImageType >
116 
117  itkSetMacro (InitialLevel, unsigned int);
118  itkGetConstMacro (InitialLevel, unsigned int);
119  itkSetMacro (FinalLevel, unsigned int);
120  itkGetConstMacro (FinalLevel, unsigned int);
121  itkSetMacro (Increment, unsigned int);
122  itkGetConstMacro (Increment, unsigned int);
123  itkSetMacro (LargestRadius, unsigned int);
124  itkGetConstMacro (LargestRadius, unsigned int);
125  itkSetMacro (Slope, unsigned int);
126  itkGetConstMacro (Slope, unsigned int);
127 protected:
130  void GenerateData();
131 
132  unsigned int m_InitialLevel;
133  unsigned int m_FinalLevel;
134  unsigned int m_Increment;
135  unsigned int m_LargestRadius;
136  unsigned int m_Slope;
137 private:
138  ViscousWatershedTransform (Self &); // intentionally not implemented
139  void operator=(const Self &); // intentionally not implemented
140 };
141 } /* namespace itk */
142 
143 #include "itkViscousWatershedTransform.txx"
144 #endif
BinaryThresholdImageFilter< FeatureImageType, FeatureImageType > ThresholdFilterType
itkTypeMacro(ViscousWatershedTransform, ImageToImageFilter)
void operator=(const Self &)
SegmentImageType::IndexType SegmentImageIndexType
itkSetMacro(InitialLevel, unsigned int)
SegmentImageType::Pointer SegmentImagePointer
FeatureImageType::SpacingType FeatureImageSpacingType
BinaryMorphologicalClosingImageFilter< FeatureImageType, FeatureImageType, StructuringElementType > ClosingFilterType
SegmentImageType::ConstPointer SegmentImageConstPointer
ImageToImageFilter< TFeatureImage, TFeatureImage > Superclass
ThresholdFilterType::Pointer ThresholdFilterPointer
ClosingFilterType::Pointer ClosingFilterPointer
SegmentImageType::PixelType SegmentImagePixelType
itkGetConstMacro(InitialLevel, unsigned int)
FeatureImageType::ConstPointer FeatureImageConstPointer
FeatureImageType::Pointer FeatureImagePointer
FeatureImageType::RegionType FeatureImageRegionType
FeatureImageSizeType::SizeValueType FeatureImageSizeValueType
BinaryBallStructuringElement< int, ImageDimension > StructuringElementType
itkStaticConstMacro(ImageDimension, unsigned int, TFeatureImage::ImageDimension)
void PrintSelf(std::ostream &os, Indent indent) const
FeatureImageType::IndexType FeatureImageIndexType
FeatureImageType::SizeType FeatureImageSizeType
FeatureImageType::PixelType FeatureImagePixelType
FeatureImageType::PointType FeatureImagePointType
ImageRegionIterator< FeatureImageType > FeatureIteratorType
ImageSizeType::SizeValueType ImageSizeValueType