ITK  6.0.0
Insight Toolkit
itkSparseImage.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#ifndef itkSparseImage_h
19#define itkSparseImage_h
20
21#include "itkImage.h"
22#include "itkSparseFieldLayer.h"
23#include "itkObjectStore.h"
24
25namespace itk
26{
66template <typename TNode, unsigned int VImageDimension = 2>
67class ITK_TEMPLATE_EXPORT SparseImage : public Image<TNode *, VImageDimension>
68{
69public:
70 ITK_DISALLOW_COPY_AND_MOVE(SparseImage);
71
78
80 itkNewMacro(Self);
81
83 itkOverrideGetNameOfClassMacro(SparseImage);
84
86 static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
87
89 using NodeType = TNode;
90
92 using typename Superclass::IndexType;
93
97
98 using typename Superclass::IOPixelType;
99
103
108 {
110 }
111
114 const NeighborhoodAccessorFunctorType
116 {
118 }
119
122 NodeType *
123 AddNode(const IndexType & index)
124 {
125 m_NodeList->PushFront(m_NodeStore->Borrow());
126 NodeType * node = m_NodeList->Front();
127 node->m_Index = index;
128 this->SetPixel(index, node);
129 return node;
130 }
135 NodeListType *
137 {
138 return m_NodeList;
139 }
140
143 void
144 Initialize() override;
145
146protected:
147 SparseImage() = default;
148 ~SparseImage() override = default;
149
150 void
151 PrintSelf(std::ostream & os, Indent indent) const override;
152
153private:
155 typename NodeListType::Pointer m_NodeList{ NodeListType::New() };
156
158};
159} // end namespace itk
160
161#ifndef ITK_MANUAL_INSTANTIATION
162# include "itkSparseImage.hxx"
163#endif
164
165#endif
Base class for all data objects in ITK.
Templated n-dimensional image class.
Definition: itkImage.h:89
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Provides accessor interfaces to Get pixels and is meant to be used on pointers contained within Neigh...
A specialized memory management object for allocating and destroying contiguous blocks of objects.
Base class for most ITK classes.
Definition: itkObject.h:62
A very simple linked list that is used to manage nodes in a layer of a sparse field level-set solver.
A storage type for sparse image data.
NodeType * AddNode(const IndexType &index)
void Initialize() override
NeighborhoodAccessorFunctorType GetNeighborhoodAccessor()
NodeListType * GetNodeList()
const NeighborhoodAccessorFunctorType GetNeighborhoodAccessor() const
void PrintSelf(std::ostream &os, Indent indent) const override
~SparseImage() override=default
SparseImage()=default
Implements a weak reference to an object.
static Pointer New()
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....