00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkSparseImage_h_
00018 #define __itkSparseImage_h_
00019
00020 #include "itkImage.h"
00021 #include "itkSparseFieldLayer.h"
00022 #include "itkObjectStore.h"
00023
00024 namespace itk {
00025
00050 template <class TNode, unsigned int VImageDimension=2>
00051 class ITK_EXPORT SparseImage : public Image <TNode*, VImageDimension>
00052 {
00053 public:
00055 typedef SparseImage Self;
00056 typedef Image <TNode*, VImageDimension> Superclass;
00057 typedef SmartPointer<Self> Pointer;
00058 typedef SmartPointer<const Self> ConstPointer;
00059
00061 itkNewMacro(Self);
00062
00064 itkTypeMacro(SparseImage, Image);
00065
00067 itkStaticConstMacro(ImageDimension, unsigned int,
00068 Superclass::ImageDimension);
00069
00071 typedef TNode NodeType;
00072
00074 typedef typename Superclass::IndexType IndexType;
00075
00077 typedef SparseFieldLayer <NodeType> NodeListType;
00078 typedef ObjectStore <NodeType> NodeStoreType;
00079
00082 NodeType *AddNode(const IndexType &index)
00083 {
00084 m_NodeList->PushFront(m_NodeStore->Borrow());
00085 NodeType *node = m_NodeList->Front();
00086 node->m_Index=index;
00087 this->SetPixel(index,node);
00088 return node;
00089 }
00090
00093 NodeListType* GetNodeList()
00094 {
00095 return m_NodeList;
00096 }
00097
00100 virtual void Initialize();
00101
00102 protected:
00103 SparseImage();
00104 ~SparseImage() {};
00105
00106 void PrintSelf(std::ostream& os, Indent indent) const;
00107
00108 private:
00110 typename NodeListType::Pointer m_NodeList;
00111 typename NodeStoreType::Pointer m_NodeStore;
00112
00113 SparseImage(const Self&);
00114 void operator=(const Self&);
00115 };
00116
00117 }
00118
00119 #ifndef ITK_MANUAL_INSTANTIATION
00120 #include "itkSparseImage.txx"
00121 #endif
00122
00123 #endif