Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkLabelObject.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkLabelObject.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-08-06 18:07:04 $
00007   Version:   $Revision: 1.6 $
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 __itkLabelObject_h
00018 #define __itkLabelObject_h
00019 
00020 #include <deque>
00021 #include "itkLightObject.h"
00022 #include "itkLabelObjectLine.h"
00023 #include "itkWeakPointer.h"
00024 #include "itkObjectFactory.h"
00025 
00026 namespace itk
00027 {
00028 
00054 template < class TLabel, unsigned int VImageDimension >
00055 class ITK_EXPORT LabelObject : public LightObject
00056 {
00057 public:
00059   typedef LabelObject               Self;
00060   typedef LightObject               Superclass;
00061   typedef Self                      LabelObjectType;
00062   typedef SmartPointer<Self>        Pointer;
00063   typedef SmartPointer<const Self>  ConstPointer;
00064   typedef WeakPointer<const Self>   ConstWeakPointer;
00065 
00067   itkNewMacro(Self);
00068 
00070   itkTypeMacro(LabelObject, LightObject);
00071 
00072   itkStaticConstMacro(ImageDimension, unsigned int, VImageDimension);
00073 
00074   typedef Index< VImageDimension >           IndexType;
00075   typedef TLabel                             LabelType;
00076   typedef LabelObjectLine< VImageDimension > LineType;
00077   typedef typename LineType::LengthType      LengthType;
00078   typedef typename std::deque< LineType >    LineContainerType;
00079   typedef unsigned int                       AttributeType;
00080   typedef unsigned long                      SizeValueType;
00081 
00082   itkStaticConstMacro(LABEL, AttributeType, 0);
00083 
00084   static AttributeType GetAttributeFromName( const std::string & s );
00085   static std::string GetNameFromAttribute( const AttributeType & a );
00086 
00090   const LabelType & GetLabel() const;
00091   void SetLabel( const LabelType & label );
00093 
00098   bool HasIndex( const IndexType & idx ) const;
00099 
00104   void AddIndex( const IndexType & idx );
00105 
00109   void AddLine( const IndexType & idx, const LengthType & length );
00110 
00114   void AddLine( const LineType & line );
00115 
00117   const LineContainerType & GetLineContainer() const;
00118 
00119   LineContainerType & GetLineContainer();
00120 
00121   void SetLineContainer( const LineContainerType & lineContainer );
00122 
00123   SizeValueType GetNumberOfLines() const;
00124 
00125   const LineType & GetLine( SizeValueType i ) const;
00126   
00127   LineType & GetLine( SizeValueType i );
00128 
00129   SizeValueType Size() const;
00130 
00131   bool Empty() const;
00132   
00133   IndexType GetIndex( SizeValueType offset ) const;
00134   
00136   virtual void CopyAttributesFrom( const Self * src );
00137 
00139   void CopyAllFrom( const Self * src );
00140 
00144   void Optimize();
00145 
00146 protected:
00147   LabelObject();
00148   void PrintSelf(std::ostream& os, Indent indent) const;
00149 
00150 private:
00151   LabelObject(const Self&); //purposely not implemented
00152   void operator=(const Self&); //purposely not implemented
00153 
00154   LineContainerType m_LineContainer;
00155   LabelType         m_Label;
00156 };
00157 
00158 } // end namespace itk
00159 
00160 #ifndef ITK_MANUAL_INSTANTIATION
00161 #include "itkLabelObject.txx"
00162 #endif
00163 
00164 #endif
00165 

Generated at Tue Sep 15 03:46:17 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000