Orfeo Toolbox  3.16
itkAttributeLabelObject.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkLabelObject.h,v $
5  Language: C++
6  Date: $Date: 2005/01/21 20:13:31 $
7  Version: $Revision: 1.6 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef __itkAttributeLabelObject_h
18 #define __itkAttributeLabelObject_h
19 
20 #include "itkLabelObject.h"
21 
22 namespace itk
23 {
24 
25 
26 namespace Functor {
27 
28 template< class TLabelObject >
30 {
31 public:
32  typedef TLabelObject LabelObjectType;
33  typedef typename LabelObjectType::AttributeValueType AttributeValueType;
34 
35  inline const AttributeValueType operator()( const LabelObjectType * labelObject )
36  {
37  return labelObject->GetAttribute();
38  }
39 
40  inline void operator()( LabelObjectType * labelObject, AttributeValueType value )
41  {
42  labelObject->SetAttribute( value );
43  }
44 };
45 
46 }
47 
48 
58 template < class TLabel, unsigned int VImageDimension, class TAttributeValue >
59 class ITK_EXPORT AttributeLabelObject : public LabelObject< TLabel, VImageDimension >
60 {
61 public:
68 
70  itkNewMacro(Self);
71 
74 
76 
77  itkStaticConstMacro(ImageDimension, unsigned int, VImageDimension);
78 
79  typedef typename Superclass::IndexType IndexType;
80 
81  typedef TLabel LabelType;
82 
83  typedef typename Superclass::LineType LineType;
84 
85  typedef typename Superclass::LengthType LengthType;
86 
87  typedef typename Superclass::LineContainerType LineContainerType;
88 
89  typedef TAttributeValue AttributeValueType;
90 
91  void SetAttribute( const AttributeValueType & v )
92  {
93  m_Attribute = v;
94  }
95 
96  const AttributeValueType & GetAttribute() const
97  {
98  return m_Attribute;
99  }
100 
101  AttributeValueType GetAttribute()
102  {
103  return m_Attribute;
104  }
105 
106 
107  virtual void CopyAttributesFrom( const Self * src )
108  {
109  Superclass::CopyAttributesFrom( src );
110  m_Attribute = src->m_Attribute;
111  }
112 
113 protected:
115  {
116  // how to initialize the attribute ?
117  }
118 
119 
120  void PrintSelf(std::ostream& os, Indent indent) const
121  {
122  Superclass::PrintSelf( os, indent );
123 
124  os << indent << "Attribute: " << m_Attribute << std::endl;
125  }
126 
127 private:
128  AttributeLabelObject(const Self&); //purposely not implemented
129  void operator=(const Self&); //purposely not implemented
130 
132 
133 
134 };
135 
136 } // end namespace itk
137 
138 #endif

Generated at Sat Jun 15 2013 23:25:47 for Orfeo Toolbox with doxygen 1.8.3.1