ITK  4.4.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< class TNode, unsigned int VImageDimension = 2 >
67 class ITK_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 
106  NeighborhoodAccessorFunctorType GetNeighborhoodAccessor()
107  { return NeighborhoodAccessorFunctorType(); }
108 
111  const NeighborhoodAccessorFunctorType GetNeighborhoodAccessor() const
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 
128  NodeListType * GetNodeList()
129  {
130  return m_NodeList;
131  }
132 
135  virtual void Initialize();
136 
137 protected:
138  SparseImage();
140 
141  void PrintSelf(std::ostream & os, Indent indent) const;
142 
143 private:
146 
148 
149  SparseImage(const Self &); //purposely not implemented
150  void operator=(const Self &); //purposely not implemented
151 };
152 } // end namespace itk
153 
154 #ifndef ITK_MANUAL_INSTANTIATION
155 #include "itkSparseImage.hxx"
156 #endif
157 
158 #endif
159