NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkFiniteDifferenceVoxel.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef itkFiniteDifferenceVoxel_h
16 #define itkFiniteDifferenceVoxel_h
17 #include <itkContinuousIndex.h>
18 #include <itkPoint.h>
19 
20 namespace itk
21 {
31 template <int Dimension, int VectorSize, typename PixelType, typename PrecisionType>
32 class ITK_EXPORT FiniteDifferenceVoxel {
33 
34  public:
35 
36  typedef ContinuousIndex<PrecisionType, Dimension> ContinuousIndexType;
37  typedef Point<PrecisionType, Dimension> PointType;
38 
40  delete [] plusIndex;
41  delete [] minusIndex;
42  delete [] values;
43  delete [] needsSolving;
44  }
45 
47  values = new PixelType[VectorSize];
48  needsSolving = new bool[VectorSize];
49  for (unsigned int i = 0; i < VectorSize; i++)
50  {
51  values[i] = 0;
52  needsSolving[i] = true;
53  }
54  voxelArrayIndex = 0;
55  voxelIndex.Fill(0);
56  voxelPointInMillimetres.Fill(0);
57  isBoundary = false;
58  isNextToCSF = false;
59  isNextToWM = false;
60  plusIndex = new long int[Dimension];
61  minusIndex = new long int[Dimension];
62  for (unsigned int i = 0; i < Dimension; i++)
63  {
64  plusIndex[i] = 0;
65  minusIndex[i] = 0;
66  }
67  //std::cout << "FiniteDifferenceVoxel():Default constructor, this=" << this << std::endl;
68  }
69 
71  values = new PixelType[VectorSize];
72  needsSolving = new bool[VectorSize];
73  for (unsigned int i = 0; i < VectorSize; i++)
74  {
75  values[i] = another.GetValue(i);
76  needsSolving[i] = another.GetNeedsSolving(i);
77  }
78  voxelArrayIndex = another.GetVoxelArrayIndex();
79  voxelIndex = another.GetVoxelIndex();
80  voxelPointInMillimetres = another.GetVoxelPointInMillimetres();
81  isBoundary = another.GetBoundary();
82  isNextToCSF = another.GetIsNextToCSF();
83  isNextToWM = another.GetIsNextToWM();
84  plusIndex = new long int[Dimension];
85  minusIndex = new long int[Dimension];
86  for (unsigned int i = 0; i < Dimension; i++)
87  {
88  plusIndex[i] = another.GetPlus(i);
89  minusIndex[i] = another.GetMinus(i);
90  }
91  //std::cout << "FiniteDifferenceVoxel():Copy constructor, this=" << this << ", another=" << &another << std::endl;
92  }
93 
94  void operator=(const FiniteDifferenceVoxel& another) {
95  for (unsigned int i = 0; i < VectorSize; i++)
96  {
97  values[i] = another.GetValue(i);
98  needsSolving[i] = another.GetNeedsSolving(i);
99  }
100  voxelArrayIndex = another.GetVoxelArrayIndex();
101  voxelIndex = another.GetVoxelIndex();
102  voxelPointInMillimetres = another.GetVoxelPointInMillimetres();
103  isBoundary = another.GetBoundary();
104  isNextToCSF = another.GetIsNextToCSF();
105  isNextToWM = another.GetIsNextToWM();
106  for (unsigned int i = 0; i < Dimension; i++)
107  {
108  plusIndex[i] = another.GetPlus(i);
109  minusIndex[i] = another.GetMinus(i);
110  }
111  //std::cout << "FiniteDifferenceVoxel():Operator=, this=" << this << ", another=" << &another << std::endl;
112  }
113 
114  void SetPlus(const int& dim, const long int index) {
115  plusIndex[dim] = index;
116  }
117 
118  long int GetPlus (const int& dim) const {
119  return plusIndex[dim];
120  }
121 
122  void SetMinus(const int& dim, const long int index) {
123  minusIndex[dim] = index;
124  }
125 
126  long int GetMinus (const int& dim) const {
127  return minusIndex[dim];
128  }
129 
130  void SetValue(int i, PixelType input) {
131  values[i] = input;
132  }
133 
134  PixelType GetValue (int i) const {
135  return values[i];
136  }
137 
138  void SetNeedsSolving(int i, bool b) {
139  needsSolving[i] = b;
140  }
141 
142  bool GetNeedsSolving(int i) const {
143  return needsSolving[i];
144  }
145 
146  void SetBoundary(bool input) {
147  isBoundary = input;
148  }
149 
150  bool GetBoundary () const {
151  return isBoundary;
152  }
153 
154  void SetIsNextToCSF(bool input) {
155  isNextToCSF = input;
156  }
157 
158  bool GetIsNextToCSF () const {
159  return isNextToCSF;
160  }
161 
162  void SetIsNextToWM(bool input) {
163  isNextToWM = input;
164  }
165 
166  bool GetIsNextToWM () const {
167  return isNextToWM;
168  }
169 
170  void SetVoxelIndex(const ContinuousIndexType& index) {
171  voxelIndex = index;
172  }
173 
174  ContinuousIndexType GetVoxelIndex () const {
175  return voxelIndex;
176  }
177 
178  void SetVoxelArrayIndex(unsigned long int i) {
179  voxelArrayIndex = i;
180  }
181 
182  unsigned long int GetVoxelArrayIndex() const {
183  return voxelArrayIndex;
184  }
185 
186  void SetVoxelPointInMillimetres(PointType& p) {
187  voxelPointInMillimetres = p;
188  }
189 
190  PointType GetVoxelPointInMillimetres() const {
191  return voxelPointInMillimetres;
192  }
193 
195  return sizeof(bool)*VectorSize + sizeof(bool*) + sizeof(PixelType)*VectorSize + sizeof(PixelType*) \
196  + sizeof(unsigned long int) + sizeof(ContinuousIndexType) + sizeof(ContinuousIndexType) \
197  + sizeof(bool)*3 + sizeof(long int *)*2 + sizeof(long int)*2*Dimension \
198  ;
199  }
200 
201  private:
202  bool *needsSolving;
203  PixelType* values;
204  unsigned long int voxelArrayIndex;
205  ContinuousIndexType voxelIndex;
206  PointType voxelPointInMillimetres;
207  bool isBoundary;
208  bool isNextToCSF;
209  bool isNextToWM;
210  long int *plusIndex;
211  long int *minusIndex;
212 };
213 
214 } // end namespace
215 #endif
void SetPlus(const int &dim, const long int index)
Definition: itkFiniteDifferenceVoxel.h:114
Simple data type to hold a voxel value, and indexes that can be used to refer to other voxels...
Definition: itkFiniteDifferenceVoxel.h:32
bool GetIsNextToCSF() const
Definition: itkFiniteDifferenceVoxel.h:158
bool GetIsNextToWM() const
Definition: itkFiniteDifferenceVoxel.h:166
PixelType GetValue(int i) const
Definition: itkFiniteDifferenceVoxel.h:134
void SetBoundary(bool input)
Definition: itkFiniteDifferenceVoxel.h:146
void operator=(const FiniteDifferenceVoxel &another)
Definition: itkFiniteDifferenceVoxel.h:94
GLenum GLenum GLenum input
Definition: glew.h:12016
void SetIsNextToCSF(bool input)
Definition: itkFiniteDifferenceVoxel.h:154
Definition: niftkITKAffineResampleImage.cxx:74
GLboolean GLenum GLenum GLvoid * values
Definition: glew.h:4068
GLdouble GLdouble GLdouble b
Definition: glew.h:7885
FiniteDifferenceVoxel(const FiniteDifferenceVoxel &another)
Definition: itkFiniteDifferenceVoxel.h:70
bool GetBoundary() const
Definition: itkFiniteDifferenceVoxel.h:150
PointType GetVoxelPointInMillimetres() const
Definition: itkFiniteDifferenceVoxel.h:190
~FiniteDifferenceVoxel()
Definition: itkFiniteDifferenceVoxel.h:39
void SetVoxelPointInMillimetres(PointType &p)
Definition: itkFiniteDifferenceVoxel.h:186
Point< PrecisionType, Dimension > PointType
Definition: itkFiniteDifferenceVoxel.h:37
float PixelType
Definition: niftkBreastDCEandADC.cxx:88
ContinuousIndexType GetVoxelIndex() const
Definition: itkFiniteDifferenceVoxel.h:174
GLfloat GLfloat p
Definition: glew.h:14169
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
ContinuousIndex< PrecisionType, Dimension > ContinuousIndexType
Definition: itkFiniteDifferenceVoxel.h:36
void SetValue(int i, PixelType input)
Definition: itkFiniteDifferenceVoxel.h:130
void SetIsNextToWM(bool input)
Definition: itkFiniteDifferenceVoxel.h:162
void SetVoxelArrayIndex(unsigned long int i)
Definition: itkFiniteDifferenceVoxel.h:178
bool GetNeedsSolving(int i) const
Definition: itkFiniteDifferenceVoxel.h:142
void SetMinus(const int &dim, const long int index)
Definition: itkFiniteDifferenceVoxel.h:122
void SetVoxelIndex(const ContinuousIndexType &index)
Definition: itkFiniteDifferenceVoxel.h:170
GLuint index
Definition: glew.h:1798
int GetSizeofObject()
Definition: itkFiniteDifferenceVoxel.h:194
FiniteDifferenceVoxel()
Definition: itkFiniteDifferenceVoxel.h:46
const unsigned int Dimension
Definition: niftkBreastDCEandADC.cxx:89
long int GetMinus(const int &dim) const
Definition: itkFiniteDifferenceVoxel.h:126
void SetNeedsSolving(int i, bool b)
Definition: itkFiniteDifferenceVoxel.h:138
unsigned long int GetVoxelArrayIndex() const
Definition: itkFiniteDifferenceVoxel.h:182
long int GetPlus(const int &dim) const
Definition: itkFiniteDifferenceVoxel.h:118