ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkSparseImage.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 itkSparseImage_h
19 #define itkSparseImage_h
20 
21 #include "itkImage.h"
22 #include "itkSparseFieldLayer.h"
23 #include "itkObjectStore.h"
24 
25 namespace itk
26 {
66 template< typename TNode, unsigned int VImageDimension = 2 >
67 class ITK_TEMPLATE_EXPORT SparseImage:public Image< TNode *, VImageDimension >
68 {
69 public:
71  typedef SparseImage Self;
76 
78  itkNewMacro(Self);
79 
81  itkTypeMacro(SparseImage, Image);
82 
84  itkStaticConstMacro(ImageDimension, unsigned int,
85  Superclass::ImageDimension);
86 
88  typedef TNode NodeType;
89 
91  typedef typename Superclass::IndexType IndexType;
92 
97 
98  typedef typename Superclass::IOPixelType IOPixelType;
99 
103 
107  { return NeighborhoodAccessorFunctorType(); }
108 
112  { return NeighborhoodAccessorFunctorType(); }
113 
116  NodeType * AddNode(const IndexType & index)
117  {
118  m_NodeList->PushFront( m_NodeStore->Borrow() );
119  NodeType *node = m_NodeList->Front();
120  node->m_Index = index;
121  this->SetPixel(index, node);
122  return node;
123  }
125 
129  {
130  return m_NodeList;
131  }
132 
135  virtual void Initialize() ITK_OVERRIDE;
136 
137 protected:
138  SparseImage();
139  ~SparseImage() ITK_OVERRIDE {}
140 
141  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
142 
143 private:
146 
148 
149  ITK_DISALLOW_COPY_AND_ASSIGN(SparseImage);
150 };
151 } // end namespace itk
152 
153 #ifndef ITK_MANUAL_INSTANTIATION
154 #include "itkSparseImage.hxx"
155 #endif
156 
157 #endif
NodeStoreType::Pointer m_NodeStore
SparseImage Self
SparseFieldLayer< NodeType > NodeListType
WeakPointer< const Self > ConstWeakPointer
Image< TNode *, VImageDimension > Superclass
const NeighborhoodAccessorFunctorType GetNeighborhoodAccessor() const
NodeListType::Pointer m_NodeList
SmartPointer< Self > Pointer
Implements a weak reference to an object.
A storage type for sparse image data.
Superclass::IndexType IndexType
ObjectStore< NodeType > NodeStoreType
NeighborhoodAccessorFunctorType GetNeighborhoodAccessor()
Provides accessor interfaces to Get pixels and is meant to be used on pointers contained within Neigh...
SmartPointer< const Self > ConstPointer
Superclass::IOPixelType IOPixelType
NodeType * AddNode(const IndexType &index)
NeighborhoodAccessorFunctor< Self > NeighborhoodAccessorFunctorType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
A very simple linked list that is used to manage nodes in a layer of a sparse field level-set solver...
A specialized memory management object for allocating and destroying contiguous blocks of objects...
Base class for all data objects in ITK.
Templated n-dimensional image class.
Definition: itkImage.h:75
NodeListType * GetNodeList()