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 typedef WeakPointer<const Self> ConstWeakPointer;
00060
00062 itkNewMacro(Self);
00063
00065 itkTypeMacro(SparseImage, Image);
00066
00068 itkStaticConstMacro(ImageDimension, unsigned int,
00069 Superclass::ImageDimension);
00070
00072 typedef TNode NodeType;
00073
00075 typedef typename Superclass::IndexType IndexType;
00076
00078 typedef SparseFieldLayer <NodeType> NodeListType;
00079 typedef ObjectStore <NodeType> NodeStoreType;
00080
00083 NodeType *AddNode(const IndexType &index)
00084 {
00085 m_NodeList->PushFront(m_NodeStore->Borrow());
00086 NodeType *node = m_NodeList->Front();
00087 node->m_Index=index;
00088 this->SetPixel(index,node);
00089 return node;
00090 }
00091
00094 NodeListType* GetNodeList()
00095 {
00096 return m_NodeList;
00097 }
00098
00101 virtual void Initialize();
00102
00103 protected:
00104 SparseImage();
00105 ~SparseImage() {};
00106
00107 void PrintSelf(std::ostream& os, Indent indent) const;
00108
00109 private:
00111 typename NodeListType::Pointer m_NodeList;
00112 typename NodeStoreType::Pointer m_NodeStore;
00113
00114 SparseImage(const Self&);
00115 void operator=(const Self&);
00116 };
00117
00118 }
00119
00120 #ifndef ITK_MANUAL_INSTANTIATION
00121 #include "itkSparseImage.txx"
00122 #endif
00123
00124 #endif