ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkRegionBasedLevelSetFunctionData.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 itkRegionBasedLevelSetFunctionData_h
19 #define itkRegionBasedLevelSetFunctionData_h
20 
21 #include "itkLightObject.h"
22 
23 #include "itkVector.h"
24 #include "itkListSample.h"
25 #include "itkKdTreeGenerator.h"
26 
27 #include "itkImageRegionIterator.h"
29 
30 namespace itk
31 {
67 template< typename TInputImage, typename TFeatureImage >
68 class ITK_TEMPLATE_EXPORT RegionBasedLevelSetFunctionData:public LightObject
69 {
70 public:
71  ITK_DISALLOW_COPY_AND_ASSIGN(RegionBasedLevelSetFunctionData);
72 
77 
78  static constexpr unsigned int ImageDimension = TFeatureImage::ImageDimension;
79 
81  itkNewMacro(Self);
82 
84 
85  using InputImageType = TInputImage;
86  using InputImagePointer = typename InputImageType::Pointer;
87  using InputImageConstPointer = typename InputImageType::ConstPointer;
88  using InputPixelType = typename InputImageType::PixelType;
92  using InputSpacingType = typename InputImageType::SpacingType;
96 
97  using FeatureImageType = TFeatureImage;
98  using FeatureImagePointer = typename FeatureImageType::Pointer;
99  using FeatureImageConstPointer = typename FeatureImageType::ConstPointer;
100  using FeaturePixelType = typename FeatureImageType::PixelType;
104  using FeatureSpacingType = typename FeatureImageType::SpacingType;
107 
108  // Allocates m_HeavisideFunctionOfLevelSetImage to have same origin,
109  // spacing and size as image. Also sets the m_Start and m_End indices.
110  void CreateHeavisideFunctionOfLevelSetImage(const InputImageType *image);
111 
112  // Checks if the given index lies in the domain of the current
113  // level-set function. The domain is defined by the start and end indices.
114  template< typename TIndex >
115  bool VerifyInsideRegion(const TIndex & featureIndex)
116  {
117  for ( unsigned int j = 0; j < ImageDimension; j++ )
118  {
119  if ( ( featureIndex[j] < static_cast< InputIndexValueType >( this->m_Start[j] ) )
120  || ( featureIndex[j] > static_cast< InputIndexValueType >( this->m_End[j] ) ) )
121  {
122  return false;
123  }
124  }
125  return true;
126  }
127 
128  // Get the index into the domain of the current level-set function
129  InputIndexType GetIndex(const FeatureIndexType & featureIndex);
130 
131  // Get the index in the domain of the feature image
132  FeatureIndexType GetFeatureIndex(const InputIndexType & inputIndex);
133 
136 
140 
141 protected:
144 };
145 } //end namespace itk
146 
147 #ifndef ITK_MANUAL_INSTANTIATION
148 #include "itkRegionBasedLevelSetFunctionData.hxx"
149 #endif
150 #endif
typename FeatureImageType::PixelType FeaturePixelType
typename FeatureImageType::SizeType FeatureSizeType
Light weight base class for most itk classes.
typename FeatureImageType::ConstPointer FeatureImageConstPointer
Helper class used to share data in the ScalarChanAndVeseLevelSetFunction.
unsigned long SizeValueType
Definition: itkIntTypes.h:83
typename InputImageType::PointType InputPointType
typename InputImageType::ConstPointer InputImageConstPointer
typename InputImageType::IndexType InputIndexType
typename InputSizeType::SizeValueType InputSizeValueType
typename InputImageType::SpacingType InputSpacingType
typename FeatureSizeType::SizeValueType FeatureSizeValueType
typename FeatureImageType::PointType FeaturePointType
signed long IndexValueType
Definition: itkIntTypes.h:90
typename FeatureImageType::Pointer FeatureImagePointer
typename InputImageType::PixelType InputPixelType
typename FeatureImageType::SpacingType FeatureSpacingType
typename FeatureImageType::IndexType FeatureIndexType
typename InputImageType::RegionType InputRegionType
typename FeatureImageType::RegionType FeatureRegionType
typename InputIndexType::IndexValueType InputIndexValueType