ITK  5.0.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:
40  ITK_DISALLOW_COPY_AND_ASSIGN(ParabolicOpenCloseSafeBorderImageFilter);
41 
47 
49  itkNewMacro(Self);
50 
53 
55  using InputImageType = TInputImage;
56  using OutputImageType = TOutputImage;
57  using InputPixelType = typename TInputImage::PixelType;
60  using OutputPixelType = typename TOutputImage::PixelType;
61 
63  using InputImagePointer = typename TInputImage::Pointer;
64  using InputImageConstPointer = typename TInputImage::ConstPointer;
65 
68 
70  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
71 
76  // set all of the scales the same
78  {
79  RadiusType s = this->GetScale();
80 
81  this->m_MorphFilt->SetScale(scale);
82  if ( s != this->GetScale() )
83  {
84  this->Modified();
85  }
86  }
87 
88  // different scale for each direction
89  void SetScale(RadiusType scale)
90  {
91  if ( scale != this->GetScale() )
92  {
93  this->m_MorphFilt->SetScale(scale);
94  this->Modified();
95  }
96  }
97 
98  //
99  const RadiusType & GetScale() const
100  {
101  return ( this->m_MorphFilt->GetScale() );
102  }
103 
104  void SetUseImageSpacing(bool B)
105  {
106  if ( B != this->GetUseImageSpacing() )
107  {
108  this->m_MorphFilt->SetUseImageSpacing(B);
109  this->Modified();
110  }
111  }
112 
113  bool GetUseImageSpacing() const
114  {
115  return ( this->m_MorphFilt->GetUseImageSpacing() );
116  }
117 
118  itkBooleanMacro(UseImageSpacing);
119 
120  itkSetMacro(SafeBorder, bool);
121  itkGetConstReferenceMacro(SafeBorder, bool);
122  itkBooleanMacro(SafeBorder);
123  // should add the Get methods
124 
126  NOCHOICE = 0, // decices based on scale - experimental
127  CONTACTPOINT = 1, // sometimes faster at low scale
128  INTERSECTION = 2 // default
129  };
136  itkSetMacro(ParabolicAlgorithm, int);
137  itkGetConstReferenceMacro(ParabolicAlgorithm, int);
138 
141  void Modified() const override;
142 
143 protected:
144  void GenerateData() override;
145 
146  void PrintSelf(std::ostream & os, Indent indent) const override;
147 
152 
154  {
155  m_MorphFilt = MorphFilterType::New();
156  m_PadFilt = PadFilterType::New();
157  m_CropFilt = CropFilterType::New();
158  m_StatsFilt = StatsFilterType::New();
159  m_SafeBorder = true;
160  m_ParabolicAlgorithm = INTERSECTION;
161  }
162 
165 private:
170 
174 };
175 } // end namespace itk
176 #ifndef ITK_MANUAL_INSTANTIATION
177 #include "itkParabolicOpenCloseSafeBorderImageFilter.hxx"
178 #endif
179 
180 #endif
Increase the image size by padding with a constant value.
Define numeric traits for std::vector.
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
typename itk::FixedArray< ScalarRealType, TInputImage::ImageDimension > RadiusType
typename InputImageType::Pointer InputImagePointer
Compute min, max, variance and mean of an Image.
TOutputImage OutputImageType
Decrease the image size by cropping the image by an itk::Size at both the upper and lower bounds of t...
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
typename InputImageType::ConstPointer InputImageConstPointer
Parent class for morphological opening and closing operations with parabolic structuring elements...