ITK  4.13.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 
76 
77  itkStaticConstMacro(ImageDimension, unsigned int, TFeatureImage::ImageDimension);
78 
80  itkNewMacro(Self);
81 
83 
84  typedef TInputImage InputImageType;
85  typedef typename InputImageType::Pointer InputImagePointer;
86  typedef typename InputImageType::ConstPointer InputImageConstPointer;
87  typedef typename InputImageType::PixelType InputPixelType;
88  typedef typename InputImageType::RegionType InputRegionType;
91  typedef typename InputImageType::SpacingType InputSpacingType;
95 
96  typedef TFeatureImage FeatureImageType;
97  typedef typename FeatureImageType::Pointer FeatureImagePointer;
98  typedef typename FeatureImageType::ConstPointer FeatureImageConstPointer;
99  typedef typename FeatureImageType::PixelType FeaturePixelType;
100  typedef typename FeatureImageType::RegionType FeatureRegionType;
103  typedef typename FeatureImageType::SpacingType FeatureSpacingType;
106 
107  // Allocates m_HeavisideFunctionOfLevelSetImage to have same origin,
108  // spacing and size as image. Also sets the m_Start and m_End indices.
109  void CreateHeavisideFunctionOfLevelSetImage(const InputImageType *image);
110 
111  // Checks if the given index lies in the domain of the current
112  // level-set function. The domain is defined by the start and end indices.
113  template< typename TIndex >
114  bool VerifyInsideRegion(const TIndex & featureIndex)
115  {
116  for ( unsigned int j = 0; j < ImageDimension; j++ )
117  {
118  if ( ( featureIndex[j] < static_cast< InputIndexValueType >( this->m_Start[j] ) )
119  || ( featureIndex[j] > static_cast< InputIndexValueType >( this->m_End[j] ) ) )
120  {
121  return false;
122  }
123  }
124  return true;
125  }
126 
127  // Get the index into the domain of the current level-set function
128  InputIndexType GetIndex(const FeatureIndexType & featureIndex);
129 
130  // Get the index in the domain of the feature image
131  FeatureIndexType GetFeatureIndex(const InputIndexType & inputIndex);
132 
135 
139 
140 protected:
143 
144 private:
145  ITK_DISALLOW_COPY_AND_ASSIGN(RegionBasedLevelSetFunctionData);
146 };
147 } //end namespace itk
148 
149 #ifndef ITK_MANUAL_INSTANTIATION
150 #include "itkRegionBasedLevelSetFunctionData.hxx"
151 #endif
152 #endif
Light weight base class for most itk classes.
Helper class used to share data in the ScalarChanAndVeseLevelSetFunction.
signed long IndexValueType
Definition: itkIntTypes.h:150
unsigned long SizeValueType
Definition: itkIntTypes.h:143