ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkParabolicOpenCloseSafeBorderImageFilter.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 itkParabolicOpenCloseSafeBorderImageFilter_h
19 #define itkParabolicOpenCloseSafeBorderImageFilter_h
20 
22 #include "itkCropImageFilter.h"
24 #include "itkCastImageFilter.h"
26 
27 /* this class implements padding and cropping, so we don't just
28 * inherit from the OpenCloseImageFitler */
29 
30 namespace itk
31 {
32 template< typename TInputImage,
33  bool doOpen,
34  typename TOutputImage = TInputImage >
36  public ImageToImageFilter< TInputImage,
37  TOutputImage >
38 {
39 public:
45 
47  itkNewMacro(Self);
48 
51 
53  typedef TInputImage InputImageType;
54  typedef TOutputImage OutputImageType;
55  typedef typename TInputImage::PixelType InputPixelType;
58  typedef typename TOutputImage::PixelType OutputPixelType;
59 
61  typedef typename TInputImage::Pointer InputImagePointer;
62  typedef typename TInputImage::ConstPointer InputImageConstPointer;
63 
66 
68  itkStaticConstMacro(ImageDimension, unsigned int,
69  TInputImage::ImageDimension);
70 
75  // set all of the scales the same
77  {
78  RadiusType s = this->GetScale();
79 
80  this->m_MorphFilt->SetScale(scale);
81  if ( s != this->GetScale() )
82  {
83  this->Modified();
84  }
85  }
86 
87  // different scale for each direction
88  void SetScale(RadiusType scale)
89  {
90  if ( scale != this->GetScale() )
91  {
92  this->m_MorphFilt->SetScale(scale);
93  this->Modified();
94  }
95  }
96 
97  //
98  const RadiusType & GetScale() const
99  {
100  return ( this->m_MorphFilt->GetScale() );
101  }
102 
103  void SetUseImageSpacing(bool B)
104  {
105  if ( B != this->GetUseImageSpacing() )
106  {
107  this->m_MorphFilt->SetUseImageSpacing(B);
108  this->Modified();
109  }
110  }
111 
112  bool GetUseImageSpacing() const
113  {
114  return ( this->m_MorphFilt->GetUseImageSpacing() );
115  }
116 
117  itkBooleanMacro(UseImageSpacing);
118 
119  itkSetMacro(SafeBorder, bool);
120  itkGetConstReferenceMacro(SafeBorder, bool);
121  itkBooleanMacro(SafeBorder);
122  // should add the Get methods
123 
125  NOCHOICE = 0, // decices based on scale - experimental
126  CONTACTPOINT = 1, // sometimes faster at low scale
127  INTERSECTION = 2 // default
128  };
135  itkSetMacro(ParabolicAlgorithm, int);
136  itkGetConstReferenceMacro(ParabolicAlgorithm, int);
137 
140  virtual void Modified() const;
141 
142 protected:
143  void GenerateData();
144 
145  void PrintSelf(std::ostream & os, Indent indent) const;
146 
151 
153  {
154  m_MorphFilt = MorphFilterType::New();
155  m_PadFilt = PadFilterType::New();
156  m_CropFilt = CropFilterType::New();
157  m_StatsFilt = StatsFilterType::New();
158  m_SafeBorder = true;
159  m_ParabolicAlgorithm = INTERSECTION;
160  }
161 
164 private:
165  ParabolicOpenCloseSafeBorderImageFilter(const Self &); //purposely not
166  // implemented
167  void operator=(const Self &); //purposely not
168  // implemented
169 
174 
178 };
179 } // end namespace itk
180 #ifndef ITK_MANUAL_INSTANTIATION
181 #include "itkParabolicOpenCloseSafeBorderImageFilter.hxx"
182 #endif
183 
184 #endif
Increase the image size by padding with a constant value.
Base class for all process objects that output image data.
NumericTraits< InputPixelType >::ScalarRealType ScalarRealType
itk::FixedArray< ScalarRealType, TInputImage::ImageDimension > RadiusType
Compute min. max, variance and mean of an Image.
Decrease the image size by cropping the image by an itk::Size at both the upper and lower bounds of t...
ImageToImageFilter< TInputImage, TOutputImage > Superclass
CropImageFilter< TOutputImage, TOutputImage > CropFilterType
ConstantPadImageFilter< TInputImage, TInputImage > PadFilterType
ParabolicOpenCloseImageFilter< TInputImage, doOpen, TOutputImage > MorphFilterType
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Define additional traits for native types such as int or float.
Parent class for morphological opening and closing operations with parabolic structuring elements...