ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkIsoContourDistanceImageFilter.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 itkIsoContourDistanceImageFilter_h
19 #define itkIsoContourDistanceImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 #include "itkNarrowBand.h"
24 #include "itkNumericTraits.h"
25 #include <mutex>
26 
27 namespace itk
28 {
57 template< typename TInputImage, typename TOutputImage >
58 class ITK_TEMPLATE_EXPORT IsoContourDistanceImageFilter:
59  public ImageToImageFilter< TInputImage, TOutputImage >
60 {
61 public:
62  ITK_DISALLOW_COPY_AND_ASSIGN(IsoContourDistanceImageFilter);
63 
69 
71  itkNewMacro(Self);
72 
75 
77  using InputImageType = typename Superclass::InputImageType;
78  using OutputImageType = typename Superclass::OutputImageType;
79 
82  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
83  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
84 
87  using PixelType = typename OutputImageType::PixelType;
88  using InputPixelType = typename InputImageType::PixelType;
90 
92 
95 
98 
99  using InputSpacingType = typename InputImageType::SpacingType;
100 
108 
111  itkSetMacro(LevelSetValue, PixelRealType);
112  itkGetConstMacro(LevelSetValue, PixelRealType);
114 
117  itkSetMacro(FarValue, PixelType);
118  itkGetConstMacro(FarValue, PixelType);
120 
123  itkSetMacro(NarrowBanding, bool);
124  itkGetConstMacro(NarrowBanding, bool);
125  itkBooleanMacro(NarrowBanding);
127 
129  void SetNarrowBand(NarrowBandType *ptr);
130 
132  { return m_NarrowBand; }
133 
134 #ifdef ITK_USE_CONCEPT_CHECKING
135  // Begin concept checking
136  itkConceptMacro( InputEqualityComparableCheck,
138  itkConceptMacro( OutputEqualityComparableCheck,
140  itkConceptMacro( SameDimensionCheck,
142  itkConceptMacro( DoubleConvertibleToOutputCheck,
144  itkConceptMacro( InputConvertibleToOutputCheck,
146  itkConceptMacro( OutputAdditiveOperatorsCheck,
148  itkConceptMacro( InputOStreamWritableCheck,
150  itkConceptMacro( OutputOStreamWritableCheck,
152  // End concept checking
153 #endif
154 
155 protected:
157  ~IsoContourDistanceImageFilter() override = default;
158  void PrintSelf(std::ostream & os, Indent indent) const override;
159 
160  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
161  ThreadIdType threadId) override;
162 
164  {
165  itkExceptionMacro("This class requires threadId so it must use classic multi-threading model");
166  }
167 
168  void GenerateData() override;
169 
170  static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION ThreaderFullCallback(void *arg);
171 
172  void ThreadedGenerateDataFull(const OutputImageRegionType & outputRegionForThread,
173  ThreadIdType threadId);
174 
175  void ThreadedGenerateDataBand(const OutputImageRegionType & outputRegionForThread,
176  ThreadIdType threadId);
177 
178  void BeforeThreadedGenerateData() override;
179 
180  void GenerateInputRequestedRegion() override;
181 
182  void EnlargeOutputRequestedRegion(DataObject *) override;
183 
186 
187  void ComputeValue( const InputNeighbordIteratorType& inNeigIt,
189  unsigned int center,
190  const std::vector< OffsetValueType >& stride );
191 
192 private:
195 
197 
200  std::vector< RegionType > m_NarrowBandRegion;
201 
202  std::mutex m_Mutex;
203 };
204 } // namespace itk
205 
206 #ifndef ITK_MANUAL_INSTANTIATION
207 #include "itkIsoContourDistanceImageFilter.hxx"
208 #endif
209 
210 #endif
typename NarrowBandType::ConstIterator ConstBandIterator
typename NumericTraits< InputPixelType >::RealType PixelRealType
typename NarrowBandType::RegionType RegionType
Define numeric traits for std::vector.
typename OutputImageType::IndexType IndexType
Compute an approximate distance from an interpolated isocontour to the close grid points...
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
itk::ITK_THREAD_RETURN_TYPE ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
Base class for all process objects that output image data.
typename InputImageType::PixelType InputPixelType
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
typename NodeContainerType::const_iterator ConstIterator
Definition: itkNarrowBand.h:70
typename NarrowBandType::Iterator BandIterator
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
typename OutputImageType::SizeType SizeType
Narrow Band class.
Definition: itkNarrowBand.h:51
unsigned int ThreadIdType
Definition: itkIntTypes.h:99
typename InputImageType::SizeType InputSizeType
typename InputImageType::IndexType InputIndexType
typename OutputImageType::PixelType PixelType
typename InputImageType::SpacingType InputSpacingType
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 itkConceptMacro(name, concept)
void DynamicThreadedGenerateData(const OutputImageRegionType &) override
Base class for all data objects in ITK.
Defines iteration of a local N-dimensional neighborhood of pixels across an itk::Image.
typename NodeContainerType::iterator Iterator
Definition: itkNarrowBand.h:71
typename NarrowBandType::Pointer NarrowBandPointer