Orfeo Toolbox  3.16
itkSpatialObjectPoint.txx
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkSpatialObjectPoint.txx,v $
5  Language: C++
6  Date: $Date: 2007-01-28 19:24:57 $
7  Version: $Revision: 1.15 $
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 __itkSpatialObjectPoint_txx
18 #define __itkSpatialObjectPoint_txx
19 
20 #include "itkSpatialObjectPoint.h"
21 
22 namespace itk
23 {
24 
26 template< unsigned int TPointDimension >
29 {
30  m_ID = -1;
31  m_Color.SetRed(1.0); // red by default
32  m_Color.SetGreen(0);
33  m_Color.SetBlue(0);
34  m_Color.SetAlpha(1);
35  for(unsigned int i=0;i<TPointDimension;i++)
36  {
37  m_X[i]=0;
38  }
39 }
40 
42 template< unsigned int TPointDimension >
45 {
46 }
47 
49 template< unsigned int TPointDimension >
52 ::GetColor( void ) const
53 {
54  return m_Color;
55 }
56 
58 template< unsigned int TPointDimension >
59 void
61 ::SetColor( const PixelType & color )
62 {
63  m_Color = color;
64 }
65 
67 template< unsigned int TPointDimension >
68 void
70 ::SetColor(float r, float g, float b, float a)
71 {
72  m_Color.SetRed(r);
73  m_Color.SetGreen(g);
74  m_Color.SetBlue(b);
75  m_Color.SetAlpha(a);
76 }
77 
79 template< unsigned int TPointDimension >
80 void
82 ::SetRed( float r )
83 {
84  m_Color.SetRed(r);
85 }
86 
88 template< unsigned int TPointDimension >
89 float
91 ::GetRed( void ) const
92 {
93  return m_Color.GetRed();
94 }
95 
97 template< unsigned int TPointDimension >
98 void
100 ::SetGreen( float g )
101 {
102  m_Color.SetGreen(g);
103 }
104 
106 template< unsigned int TPointDimension >
107 float
109 ::GetGreen( void ) const
110 {
111  return m_Color.GetGreen();
112 }
113 
115 template< unsigned int TPointDimension >
116 void
118 ::SetBlue( float b )
119 {
120  m_Color.SetBlue(b);
121 }
122 
124 template< unsigned int TPointDimension >
125 float
127 ::GetBlue( void ) const
128 {
129  return m_Color.GetBlue();
130 }
131 
133 template< unsigned int TPointDimension >
134 void
136 ::SetAlpha( float a)
137 {
138  m_Color.SetAlpha(a);
139 }
140 
142 template< unsigned int TPointDimension >
143 float
145 ::GetAlpha( void ) const
146 {
147  return m_Color.GetAlpha();
148 }
149 
151 template< unsigned int TPointDimension >
152 void
154 ::SetID( const int newID )
155 {
156  m_ID = newID;
157 }
158 
160 template< unsigned int TPointDimension >
161 int
163 ::GetID( void ) const
164 {
165  return m_ID;
166 }
167 
168 
170 template< unsigned int TPointDimension >
173 ::GetPosition( void ) const
174 {
175  return m_X;
176 }
177 
179 template< unsigned int TPointDimension >
180 void
182 ::SetPosition( const PointType & newX )
183 {
184  m_X = newX;
185 }
186 
188 template< unsigned int TPointDimension >
189 void
191 ::SetPosition( const double x0, const double x1, const double x2 )
192 {
193  m_X[0] = x0;
194  m_X[1] = x1;
195  m_X[2] = x2;
196 }
197 
199 template< unsigned int TPointDimension >
200 void
202 ::SetPosition( const double x0, const double x1 )
203 {
204  m_X[0] = x0;
205  m_X[1] = x1;
206 }
207 
208 
210 template< unsigned int TPointDimension >
214 {
215  m_ID = rhs.m_ID;
216  m_X = rhs.m_X;
217  m_Color = rhs.m_Color;
218  return * this;
219 }
220 
221 
223 template< unsigned int TPointDimension >
224 void
226 ::Print(std::ostream & os) const
227 {
228  this->PrintSelf(os, 3);
229 }
230 
232 template< unsigned int TPointDimension >
233 void
235 ::PrintSelf(std::ostream & os, Indent indent) const
236 {
237  os << indent << "RGBA: "<< m_Color.GetRed() << " ";
238  os << m_Color.GetGreen() << " ";
239  os << m_Color.GetBlue() << " ";
240  os << m_Color.GetAlpha() << std::endl;
241  os << indent << "Position: ";
242  for(unsigned int i=1;i<TPointDimension;i++)
243  {
244  os << m_X[i-1] << ",";
245  }
246  os << m_X[TPointDimension-1] << std::endl;
247 }
248 
249 
250 } // end namespace itk
251 
252 #endif

Generated at Sun Feb 3 2013 00:08:13 for Orfeo Toolbox with doxygen 1.8.1.1