00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkSparseImage.h,v $ 00005 Language: C++ 00006 Date: $Date: 2005-12-28 19:08:07 $ 00007 Version: $Revision: 1.10 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 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 NeighborhoodAccessorFunctor< Self > 00079 NeighborhoodAccessorFunctorType; 00080 00081 typedef typename Superclass::IOPixelType IOPixelType; 00082 00084 typedef SparseFieldLayer <NodeType> NodeListType; 00085 typedef ObjectStore <NodeType> NodeStoreType; 00086 00089 NeighborhoodAccessorFunctorType GetNeighborhoodAccessor() 00090 { return NeighborhoodAccessorFunctorType(); } 00091 00094 const NeighborhoodAccessorFunctorType GetNeighborhoodAccessor() const 00095 { return NeighborhoodAccessorFunctorType(); } 00096 00099 NodeType *AddNode(const IndexType &index) 00100 { 00101 m_NodeList->PushFront(m_NodeStore->Borrow()); 00102 NodeType *node = m_NodeList->Front(); 00103 node->m_Index=index; 00104 this->SetPixel(index,node); 00105 return node; 00106 } 00108 00111 NodeListType* GetNodeList() 00112 { 00113 return m_NodeList; 00114 } 00115 00118 virtual void Initialize(); 00119 00120 protected: 00121 SparseImage(); 00122 ~SparseImage() {}; 00123 00124 void PrintSelf(std::ostream& os, Indent indent) const; 00125 00126 private: 00128 typename NodeListType::Pointer m_NodeList; 00129 typename NodeStoreType::Pointer m_NodeStore; 00130 00131 SparseImage(const Self&); //purposely not implemented 00132 void operator=(const Self&); //purposely not implemented 00133 }; 00134 00135 }// end namespace itk 00136 00137 #ifndef ITK_MANUAL_INSTANTIATION 00138 #include "itkSparseImage.txx" 00139 #endif 00140 00141 #endif 00142