ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkLabelSetMorphBaseImageFilter.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 itkLabelSetMorphBaseImageFilter_h
19 #define itkLabelSetMorphBaseImageFilter_h
20 
21 #include "itkNumericTraits.h"
22 #include "itkImageToImageFilter.h"
23 
24 namespace itk
25 {
26 #if ITK_VERSION_MAJOR < 4
27 using ThreadIdType = int;
28 using RegionIndexType = int;
29 #else
30 using RegionIndexType = unsigned int;
31 #endif
32 
45 template< typename TInputImage, bool doDilate,
46  typename TOutputImage = TInputImage >
48  public ImageToImageFilter< TInputImage, TOutputImage >
49 {
50 public:
51  ITK_DISALLOW_COPY_AND_ASSIGN(LabelSetMorphBaseImageFilter);
52 
58 
60  itkNewMacro(Self);
61 
64 
66  using InputImageType = TInputImage;
67  using OutputImageType = TOutputImage;
68  using PixelType = typename TInputImage::PixelType;
70  using OutputPixelType = typename TOutputImage::PixelType;
72 
75 
77  using InputImagePointer = typename TInputImage::Pointer;
78  using InputImageConstPointer = typename TInputImage::ConstPointer;
81 
84 
88 
89  // set all of the scales the same
90  void SetRadius(ScalarRealType scale);
91 
92  itkSetMacro(Radius, RadiusType);
93  itkGetConstReferenceMacro(Radius, RadiusType);
94 
99  itkSetMacro(UseImageSpacing, bool);
100  itkGetConstReferenceMacro(UseImageSpacing, bool);
101  itkBooleanMacro(UseImageSpacing);
103 
105  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
106  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
107  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
108 
113  void writeDist(std::string fname);
114 
115 protected:
118 
119  RegionIndexType SplitRequestedRegion(RegionIndexType i, RegionIndexType num,
120  OutputImageRegionType & splitRegion) override;
121 
122  void DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
123 
124  void GenerateData(void) override;
125 
126  // Override since the filter produces the entire dataset.
127  void EnlargeOutputRequestedRegion(DataObject *output) override;
128 
130  void PrintSelf(std::ostream & os, Indent indent) const override;
131 
136 
137  typename DistanceImageType::Pointer m_DistanceImage;
138 
142 
143  // this is the first non-zero entry in the radius. Needed to
144  // support elliptical operations
146 };
147 } // end namespace itk
148 
149 #ifndef ITK_MANUAL_INSTANTIATION
150 #include "itkLabelSetMorphBaseImageFilter.hxx"
151 #endif
152 
153 #endif
typename itk::Image< RealType, TInputImage::ImageDimension > DistanceImageType
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.
Base class for binary morphological erosion of label images.
typename InputImageType::Pointer InputImagePointer
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
signed long IndexValueType
Definition: itkIntTypes.h:90
unsigned int ThreadIdType
Definition: itkIntTypes.h:99
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 itk::FixedArray< ScalarRealType, TInputImage::ImageDimension > RadiusType
typename InputImageType::ConstPointer InputImageConstPointer
Base class for all data objects in ITK.
Templated n-dimensional image class.
Definition: itkImage.h:75