ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
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{
65
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
111
114 const NeighborhoodAccessorFunctorType
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 }
131
132
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:
156
158};
159} // end namespace itk
160
161#ifndef ITK_MANUAL_INSTANTIATION
162# include "itkSparseImage.hxx"
163#endif
164
165#endif
static constexpr ImageDimensionType ImageDimension
void SetPixel(const IndexType &index, const TPixel &value)
Set a pixel value.
Definition itkImage.h:208
Index< VImageDimension > IndexType
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.
SmartPointer< Self > Pointer
Implements transparent reference counting.
A very simple linked list that is used to manage nodes in a layer of a sparse field level-set solver.
NodeType * AddNode(const IndexType &index)
void Initialize() override
NeighborhoodAccessorFunctorType GetNeighborhoodAccessor()
NodeListType * GetNodeList()
WeakPointer< const Self > ConstWeakPointer
SmartPointer< Self > Pointer
const NeighborhoodAccessorFunctorType GetNeighborhoodAccessor() const
SmartPointer< const Self > ConstPointer
void PrintSelf(std::ostream &os, Indent indent) const override
~SparseImage() override=default
Image< TNode *, VImageDimension > Superclass
NeighborhoodAccessorFunctor< Self > NeighborhoodAccessorFunctorType
SparseFieldLayer< NodeType > NodeListType
SparseImage()=default
ObjectStore< NodeType > NodeStoreType
Implements a weak reference to an object.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....