/usr/include/InsightToolkit/SpatialObject/itkSpatialObjectPoint.txx is in libinsighttoolkit3-dev 3.20.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | /*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: itkSpatialObjectPoint.txx
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __itkSpatialObjectPoint_txx
#define __itkSpatialObjectPoint_txx
#include "itkSpatialObjectPoint.h"
namespace itk
{
/** Constructor */
template< unsigned int TPointDimension >
SpatialObjectPoint< TPointDimension >
::SpatialObjectPoint( void )
{
m_ID = -1;
m_Color.SetRed(1.0); // red by default
m_Color.SetGreen(0);
m_Color.SetBlue(0);
m_Color.SetAlpha(1);
for(unsigned int i=0;i<TPointDimension;i++)
{
m_X[i]=0;
}
}
/** Destructor */
template< unsigned int TPointDimension >
SpatialObjectPoint< TPointDimension >
::~SpatialObjectPoint( void )
{
}
/** Return the color of the point */
template< unsigned int TPointDimension >
const typename SpatialObjectPoint< TPointDimension >::PixelType &
SpatialObjectPoint< TPointDimension >
::GetColor( void ) const
{
return m_Color;
}
/** Set the color of the point */
template< unsigned int TPointDimension >
void
SpatialObjectPoint< TPointDimension >
::SetColor( const PixelType & color )
{
m_Color = color;
}
/** Set the color of the point */
template< unsigned int TPointDimension >
void
SpatialObjectPoint< TPointDimension >
::SetColor(float r, float g, float b, float a)
{
m_Color.SetRed(r);
m_Color.SetGreen(g);
m_Color.SetBlue(b);
m_Color.SetAlpha(a);
}
/** Set the red channel of the point */
template< unsigned int TPointDimension >
void
SpatialObjectPoint< TPointDimension >
::SetRed( float r )
{
m_Color.SetRed(r);
}
/** Return the red channel of the point */
template< unsigned int TPointDimension >
float
SpatialObjectPoint< TPointDimension >
::GetRed( void ) const
{
return m_Color.GetRed();
}
/** Set the green channel of the point */
template< unsigned int TPointDimension >
void
SpatialObjectPoint< TPointDimension >
::SetGreen( float g )
{
m_Color.SetGreen(g);
}
/** Return the green channel of the point */
template< unsigned int TPointDimension >
float
SpatialObjectPoint< TPointDimension >
::GetGreen( void ) const
{
return m_Color.GetGreen();
}
/** Set the blue channel of the point */
template< unsigned int TPointDimension >
void
SpatialObjectPoint< TPointDimension >
::SetBlue( float b )
{
m_Color.SetBlue(b);
}
/** Return the blue channel of the point */
template< unsigned int TPointDimension >
float
SpatialObjectPoint< TPointDimension >
::GetBlue( void ) const
{
return m_Color.GetBlue();
}
/** Set the alpha value of the point */
template< unsigned int TPointDimension >
void
SpatialObjectPoint< TPointDimension >
::SetAlpha( float a)
{
m_Color.SetAlpha(a);
}
/** Return the alpha value of the point */
template< unsigned int TPointDimension >
float
SpatialObjectPoint< TPointDimension >
::GetAlpha( void ) const
{
return m_Color.GetAlpha();
}
/** Set the Identification number of a point */
template< unsigned int TPointDimension >
void
SpatialObjectPoint< TPointDimension >
::SetID( const int newID )
{
m_ID = newID;
}
/** Get the Identification number of a point */
template< unsigned int TPointDimension >
int
SpatialObjectPoint< TPointDimension >
::GetID( void ) const
{
return m_ID;
}
/** Return the position of a point */
template< unsigned int TPointDimension >
const typename SpatialObjectPoint< TPointDimension >::PointType &
SpatialObjectPoint< TPointDimension >
::GetPosition( void ) const
{
return m_X;
}
/** Set the position : n-D case */
template< unsigned int TPointDimension >
void
SpatialObjectPoint< TPointDimension >
::SetPosition( const PointType & newX )
{
m_X = newX;
}
/** Set the position : 3D case */
template< unsigned int TPointDimension >
void
SpatialObjectPoint< TPointDimension >
::SetPosition( const double x0, const double x1, const double x2 )
{
m_X[0] = x0;
m_X[1] = x1;
m_X[2] = x2;
}
/** Set the position : 2D case */
template< unsigned int TPointDimension >
void
SpatialObjectPoint< TPointDimension >
::SetPosition( const double x0, const double x1 )
{
m_X[0] = x0;
m_X[1] = x1;
}
/** Copy a point to another point */
template< unsigned int TPointDimension >
typename SpatialObjectPoint< TPointDimension >::Self &
SpatialObjectPoint< TPointDimension >
::operator=(const SpatialObjectPoint & rhs)
{
m_ID = rhs.m_ID;
m_X = rhs.m_X;
m_Color = rhs.m_Color;
return * this;
}
/** PrintSelfMethod */
template< unsigned int TPointDimension >
void
SpatialObjectPoint< TPointDimension >
::Print(std::ostream & os) const
{
this->PrintSelf(os, 3);
}
/** PrintSelfMethod */
template< unsigned int TPointDimension >
void
SpatialObjectPoint< TPointDimension >
::PrintSelf(std::ostream & os, Indent indent) const
{
os << indent << "RGBA: "<< m_Color.GetRed() << " ";
os << m_Color.GetGreen() << " ";
os << m_Color.GetBlue() << " ";
os << m_Color.GetAlpha() << std::endl;
os << indent << "Position: ";
for(unsigned int i=1;i<TPointDimension;i++)
{
os << m_X[i-1] << ",";
}
os << m_X[TPointDimension-1] << std::endl;
}
} // end namespace itk
#endif
|