ITK  5.3.0
Insight Toolkit
itkLevelSetSparseImage.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  * 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 
19 #ifndef itkLevelSetSparseImage_h
20 #define itkLevelSetSparseImage_h
21 
23 #include "itkObjectFactory.h"
24 
25 #include "itkLabelObject.h"
26 #include "itkLabelMap.h"
28 
29 namespace itk
30 {
31 
41 template <typename TOutput, unsigned int VDimension>
42 class ITK_TEMPLATE_EXPORT LevelSetSparseImage : public DiscreteLevelSetImage<TOutput, VDimension>
43 {
44 public:
45  ITK_DISALLOW_COPY_AND_MOVE(LevelSetSparseImage);
46 
51 
54 
55  static constexpr unsigned int Dimension = Superclass::Dimension;
56 
57  using InputType = typename Superclass::InputType;
58  using OutputType = typename Superclass::OutputType;
59  using OutputRealType = typename Superclass::OutputRealType;
60  using GradientType = typename Superclass::GradientType;
61  using HessianType = typename Superclass::HessianType;
62  using LevelSetDataType = typename Superclass::LevelSetDataType;
63 
65  using LayerIdListType = std::list<LayerIdType>;
66 
71 
76 
77  using LayerType = std::map<InputType, OutputType, Functor::LexicographicCompare>;
78  using LayerIterator = typename LayerType::iterator;
79  using LayerConstIterator = typename LayerType::const_iterator;
80 
81  using LayerMapType = std::map<LayerIdType, LayerType>;
82  using LayerMapIterator = typename LayerMapType::iterator;
83  using LayerMapConstIterator = typename LayerMapType::const_iterator;
84 
86  virtual LayerIdType
87  Status(const InputType & inputIndex) const;
88 
90  const LayerType &
91  GetLayer(LayerIdType value) const;
92 
94  LayerType &
95  GetLayer(LayerIdType value);
96 
98  void
99  SetLayer(LayerIdType value, const LayerType & layer);
100 
102  virtual void
103  SetLabelMap(LabelMapType * labelMap);
104  itkGetModifiableObjectMacro(LabelMap, LabelMapType);
106 
108  void
109  Graft(const DataObject * data) override;
110 
112  template <typename TLabel>
114  GetAsLabelObject();
115 
116 protected:
117  LevelSetSparseImage() = default;
118  ~LevelSetSparseImage() override = default;
119 
123 
125  virtual void
126  InitializeLayers() = 0;
127 
128  virtual void
129  InitializeInternalLabelList() = 0;
130 
131  bool
132  IsInsideDomain(const InputType & inputIndex) const override;
133 
135  void
136  Initialize() override;
137 
139  void
140  CopyInformation(const DataObject * data) override;
141 };
142 
143 } // namespace itk
144 
145 #ifndef ITK_MANUAL_INSTANTIATION
146 # include "itkLevelSetSparseImage.hxx"
147 #endif
148 
149 #endif // itkLevelSetSparseImage_h
itk::LabelObject::LengthType
typename LineType::LengthType LengthType
Definition: itkLabelObject.h:91
itkObjectFactory.h
itk::LevelSetSparseImage< int8_t, VDimension >::LayerMapConstIterator
typename LayerMapType::const_iterator LayerMapConstIterator
Definition: itkLevelSetSparseImage.h:83
itk::LevelSetSparseImage::m_LabelMap
LabelMapPointer m_LabelMap
Definition: itkLevelSetSparseImage.h:121
itk::LevelSetSparseImage
Base class for the sparse representation of a level-set function on one Image.
Definition: itkLevelSetSparseImage.h:42
itk::LevelSetSparseImage< int8_t, VDimension >::LabelObjectLineType
typename LabelObjectType::LineType LabelObjectLineType
Definition: itkLevelSetSparseImage.h:70
itk::LevelSetSparseImage< int8_t, VDimension >::LayerMapType
std::map< LayerIdType, LayerType > LayerMapType
Definition: itkLevelSetSparseImage.h:81
itk::int8_t
::int8_t int8_t
Definition: itkIntTypes.h:28
itk::LevelSetSparseImage< int8_t, VDimension >::LabelMapConstPointer
typename LabelMapType::ConstPointer LabelMapConstPointer
Definition: itkLevelSetSparseImage.h:74
itk::DiscreteLevelSetImage< int8_t, VDimension >::HessianType
typename Superclass::HessianType HessianType
Definition: itkDiscreteLevelSetImage.h:57
itkDiscreteLevelSetImage.h
itkLexicographicCompare.h
itk::LevelSetSparseImage< int8_t, VDimension >::LayerIdType
int8_t LayerIdType
Definition: itkLevelSetSparseImage.h:64
itk::LevelSetSparseImage< int8_t, VDimension >::LabelMapPointer
typename LabelMapType::Pointer LabelMapPointer
Definition: itkLevelSetSparseImage.h:73
itk::SmartPointer< Self >
itk::LabelMap
Templated n-dimensional image to store labeled objects.
Definition: itkLabelMap.h:70
itk::LevelSetSparseImage< int8_t, VDimension >::LabelObjectPointer
typename LabelObjectType::Pointer LabelObjectPointer
Definition: itkLevelSetSparseImage.h:68
itk::LevelSetSparseImage::m_InternalLabelList
LayerIdListType m_InternalLabelList
Definition: itkLevelSetSparseImage.h:122
itkLabelMap.h
itk::LevelSetSparseImage< int8_t, VDimension >::LayerIdListType
std::list< LayerIdType > LayerIdListType
Definition: itkLevelSetSparseImage.h:65
itk::LevelSetSparseImage< int8_t, VDimension >::LayerMapIterator
typename LayerMapType::iterator LayerMapIterator
Definition: itkLevelSetSparseImage.h:82
itk::LevelSetSparseImage< int8_t, VDimension >::LayerType
std::map< InputType, OutputType, Functor::LexicographicCompare > LayerType
Definition: itkLevelSetSparseImage.h:77
itk::LabelObject
The base class for the representation of an labeled binary object in an image.
Definition: itkLabelObject.h:65
itk::DiscreteLevelSetImage< int8_t, VDimension >::OutputRealType
typename Superclass::OutputRealType OutputRealType
Definition: itkDiscreteLevelSetImage.h:55
itk::DiscreteLevelSetImage< int8_t, VDimension >::InputType
typename Superclass::InputType InputType
Definition: itkDiscreteLevelSetImage.h:53
itk::LevelSetSparseImage< int8_t, VDimension >::LabelObjectLengthType
typename LabelObjectType::LengthType LabelObjectLengthType
Definition: itkLevelSetSparseImage.h:69
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::LevelSetSparseImage< int8_t, VDimension >::LayerIterator
typename LayerType::iterator LayerIterator
Definition: itkLevelSetSparseImage.h:78
itk::LevelSetBase< Index< VDimension >, VDimension, int8_t, ImageBase< VDimension > >::RegionType
IdentifierType RegionType
Definition: itkLevelSetBase.h:66
itk::DiscreteLevelSetImage< int8_t, VDimension >::OutputType
typename Superclass::OutputType OutputType
Definition: itkDiscreteLevelSetImage.h:54
itk::DiscreteLevelSetImage< int8_t, VDimension >::LevelSetDataType
typename Superclass::LevelSetDataType LevelSetDataType
Definition: itkDiscreteLevelSetImage.h:58
itkLabelObject.h
itk::DiscreteLevelSetImage
Abstract class for a level-set function on one Image.
Definition: itkDiscreteLevelSetImage.h:36
itk::LabelObjectLine
Definition: itkLabelObjectLine.h:42
itk::LevelSetSparseImage< int8_t, VDimension >::LayerConstIterator
typename LayerType::const_iterator LayerConstIterator
Definition: itkLevelSetSparseImage.h:79
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::LevelSetSparseImage::m_Layers
LayerMapType m_Layers
Definition: itkLevelSetSparseImage.h:120
itk::DiscreteLevelSetImage< int8_t, VDimension >::GradientType
typename Superclass::GradientType GradientType
Definition: itkDiscreteLevelSetImage.h:56
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:62
itk::GTest::TypedefsAndConstructors::Dimension2::Dimension
constexpr unsigned int Dimension
Definition: itkGTestTypedefsAndConstructors.h:44
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293