ITK  6.0.0
Insight Toolkit
itkWhitakerSparseLevelSetImage.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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  * https://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 
19 #ifndef itkWhitakerSparseLevelSetImage_h
20 #define itkWhitakerSparseLevelSetImage_h
21 
22 #include "itkLevelSetSparseImage.h"
23 #include "itkLabelObject.h"
24 #include "itkLabelMap.h"
25 
26 namespace itk
27 {
40 template <typename TOutput, unsigned int VDimension>
41 class ITK_TEMPLATE_EXPORT WhitakerSparseLevelSetImage : public LevelSetSparseImage<TOutput, VDimension>
42 {
43 public:
44  ITK_DISALLOW_COPY_AND_MOVE(WhitakerSparseLevelSetImage);
45 
50 
52  itkNewMacro(Self);
53 
55  itkOverrideGetNameOfClassMacro(WhitakerSparseLevelSetImage);
56 
57  static constexpr unsigned int Dimension = VDimension;
58 
59  using typename Superclass::InputType;
60  using typename Superclass::OutputType;
61  using typename Superclass::OutputRealType;
62  using typename Superclass::GradientType;
63  using typename Superclass::HessianType;
64  using typename Superclass::LevelSetDataType;
65 
66  using typename Superclass::LayerIdType;
67  using typename Superclass::LabelObjectType;
68  using typename Superclass::LabelObjectPointer;
69  using typename Superclass::LabelObjectLengthType;
70  using typename Superclass::LabelObjectLineType;
71 
72  using typename Superclass::LabelMapType;
73  using typename Superclass::LabelMapPointer;
74  using typename Superclass::LabelMapConstPointer;
75  using typename Superclass::RegionType;
76 
77  using typename Superclass::LayerType;
78  using typename Superclass::LayerIterator;
79  using typename Superclass::LayerConstIterator;
80 
81  using typename Superclass::LayerMapType;
82  using typename Superclass::LayerMapIterator;
83  using typename Superclass::LayerMapConstIterator;
84 
86  using Superclass::Evaluate;
88  Evaluate(const InputType & inputIndex) const override;
89 
90 #ifdef ITK_USE_CONCEPT_CHECKING
91  // Begin concept checking
92 
94 
95  // End concept checking
96 #endif // ITK_USE_CONCEPT_CHECKING
97 
98  static inline LayerIdType
100  {
101  return -3;
102  }
103  static inline LayerIdType
105  {
106  return -2;
107  }
108  static inline LayerIdType
110  {
111  return -1;
112  }
113  static inline LayerIdType
115  {
116  return 0;
117  }
118  static inline LayerIdType
120  {
121  return 1;
122  }
123  static inline LayerIdType
125  {
126  return 2;
127  }
128  static inline LayerIdType
130  {
131  return 3;
132  }
133 
135  template <typename TLabel>
138  {
139  using OutputLabelObjectType = LabelObject<TLabel, Dimension>;
140  auto object = OutputLabelObjectType::New();
143  for (LayerIdType status = this->MinusThreeLayer(); status < this->PlusOneLayer(); ++status)
144  {
145  const LabelObjectPointer labelObject = this->m_LabelMap->GetLabelObject(status);
146 
147  for (SizeValueType i = 0; i < labelObject->GetNumberOfLines(); ++i)
148  {
149  object->AddLine(labelObject->GetLine(i));
150  }
151  }
152  object->Optimize();
153 
154  return object;
155  }
156 
157 protected:
159  ~WhitakerSparseLevelSetImage() override = default;
160 
162  void
163  InitializeLayers() override;
164 
165  void
166  InitializeInternalLabelList() override;
167 };
168 } // namespace itk
169 
170 #ifndef ITK_MANUAL_INSTANTIATION
171 # include "itkWhitakerSparseLevelSetImage.hxx"
172 #endif
173 
174 #endif // itkWhitakerSparseLevelSetImage_h
itk::WhitakerSparseLevelSetImage
Derived class for the sparse-field representation of level-set function.
Definition: itkWhitakerSparseLevelSetImage.h:41
itk::WhitakerSparseLevelSetImage::ZeroLayer
static LayerIdType ZeroLayer()
Definition: itkWhitakerSparseLevelSetImage.h:114
itk::WhitakerSparseLevelSetImage::MinusThreeLayer
static LayerIdType MinusThreeLayer()
Definition: itkWhitakerSparseLevelSetImage.h:99
itk::Index
Represent a n-dimensional index in a n-dimensional image.
Definition: itkIndex.h:68
itk::WhitakerSparseLevelSetImage::MinusOneLayer
static LayerIdType MinusOneLayer()
Definition: itkWhitakerSparseLevelSetImage.h:109
itk::LevelSetSparseImage
Base class for the sparse representation of a level-set function on one Image.
Definition: itkLevelSetSparseImage.h:42
itk::WhitakerSparseLevelSetImage::MinusTwoLayer
static LayerIdType MinusTwoLayer()
Definition: itkWhitakerSparseLevelSetImage.h:104
itk::LevelSetSparseImage::LayerIdType
int8_t LayerIdType
Definition: itkLevelSetSparseImage.h:64
itk::SmartPointer< Self >
itk::WhitakerSparseLevelSetImage::PlusTwoLayer
static LayerIdType PlusTwoLayer()
Definition: itkWhitakerSparseLevelSetImage.h:124
itk::LevelSetSparseImage::LabelObjectPointer
typename LabelObjectType::Pointer LabelObjectPointer
Definition: itkLevelSetSparseImage.h:68
itkLabelMap.h
itkLevelSetSparseImage.h
itk::LabelObject
The base class for the representation of a labeled binary object in an image.
Definition: itkLabelObject.h:65
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::WhitakerSparseLevelSetImage::PlusThreeLayer
static LayerIdType PlusThreeLayer()
Definition: itkWhitakerSparseLevelSetImage.h:129
itk::WhitakerSparseLevelSetImage::GetAsLabelObject
LabelObject< TLabel, Dimension >::Pointer GetAsLabelObject()
Definition: itkWhitakerSparseLevelSetImage.h:137
itkLabelObject.h
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::Concept::Convertible
Definition: itkConceptChecking.h:217
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61
New
static Pointer New()
itk::WhitakerSparseLevelSetImage::PlusOneLayer
static LayerIdType PlusOneLayer()
Definition: itkWhitakerSparseLevelSetImage.h:119
itk::LevelSetBase< Index< VDimension >, VDimension, TOutput, ImageBase< VDimension > >::OutputType
TOutput OutputType
Definition: itkLevelSetBase.h:59
itk::GTest::TypedefsAndConstructors::Dimension2::Dimension
constexpr unsigned int Dimension
Definition: itkGTestTypedefsAndConstructors.h:44
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:86
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293