KWStyle - itkBloxCoreAtomPixel.h
 
Matrix View
Description

1 /*=========================================================================
2
3 Program:   Insight Segmentation & Registration Toolkit
4 Module:    $RCSfile: itkBloxCoreAtomPixel.h.html,v $
5 Language:  C++
6 Date:      $Date: 2006/01/17 19:15:33 $
7 Version:   $Revision: 1.4 $
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 __itkBloxCoreAtomPixel_h
18 #define __itkBloxCoreAtomPixel_h
19
20 #include "vnl/vnl_matrix_fixed.h"
21 #include "vnl/vnl_vector_fixed.h"
22 #include "vnl/algo/vnl_generalized_eigensystem.h"
23
24 #include "itkObject.h"
25 #include "itkBloxCoreAtomItem.h"
26 #include "itkBloxBoundaryPointItem.h"
27 #include "itkPoint.h"
28 #include "itkCovariantVector.h"
29 #include "itkBloxPixel.h"
30
31 namespace itk
32 {
33
34 /**
35  * \class BloxCoreAtomPixel
36  * \brief Holds a linked list of itk::BloxCoreAtomItem's
37  *
38  * \ingroup ImageObjects
39  * */
40
41 template <unsigned int NDimensions>
42 LEN class ITK_EXPORT BloxCoreAtomPixel : public BloxPixel< BloxCoreAtomItem<NDimensions> >
43 {
44 public:
45
46   /** Standard class typedefs. */
47   typedef BloxCoreAtomPixel                            Self;
48   typedef BloxPixel< BloxCoreAtomItem<NDimensions> >   Superclass; 
49   typedef SmartPointer<Self>                           Pointer;
50   typedef SmartPointer<const Self>                     ConstPointer;
51
52   /** The type of core atom item we process. */
53   typedef BloxCoreAtomItem<NDimensions> CoreAtomItemType;
54
55   /** The type of boundary point item we process. */
56   typedef BloxBoundaryPointItem<NDimensions> BPItemType;
57
58   /** The type used to store the position of the BoundaryPointItem. */
59   typedef Point<double, NDimensions> PositionType;
60
61   /** The type of vector used to store the gradient of the BoundaryPointItem. */
62   typedef CovariantVector<double, NDimensions> GradientType;
63
64   /** VNL type used in eigenanalysis. */
65   typedef vnl_vector_fixed<double, NDimensions> VectorType;
66
67   /** Vector type used to store eigenvalues. */
68   typedef vnl_vector_fixed<double, NDimensions> EigenvalueType;
69
70   /** Matrix type used to store eigenvectors. */
71   typedef vnl_matrix_fixed<double, NDimensions, NDimensions> EigenvectorType;
72
73   /** Generalized matrix type used for several different tasks*/
74   typedef vnl_matrix_fixed<double, NDimensions, NDimensions> MatrixType;
75
76   /** Calculate and store the mean of core atom diameters. */
77   double CalcMeanCoreAtomDiameter();
78
79 LEN   /** Perform eigenanalysis on the population of core atoms stored in this pixel. */
80   bool DoCoreAtomEigenanalysis();
81
82   /** Perform eigenanalysis on the voted CMatrix */
83   void DoVotedEigenanalysis();
84
85   /** Get statements */
86   double GetMeanCoreAtomDiameter() {return m_MeanCoreAtomDiameter;}
87   double GetMeanCoreAtomIntensity() {return m_MeanCoreAtomIntensity;}
88   EigenvalueType GetEigenvalues() {return m_Eigenvalues;}
89   EigenvalueType GetVotedEigenvalues() {return m_VotedEigenvalues;}
90   EigenvectorType GetEigenvectors() {return m_Eigenvectors;}
91   EigenvectorType GetVotedEigenvectors() {return m_VotedEigenvectors;}
92   PositionType GetLocationSums() {return m_LocationSums;}
93   double GetWeightSum() {return m_WeightSum;}
94
95   /** Get the raw CMatrix (prior to voting) */
96   MatrixType* GetRawCMatrixPointer() {return &m_RawCMatrix;}
97
98   /** Collect a vote and update m_VotedCMatrix */
99   void CollectVote(MatrixType* pMatrix, double strength, double count);
100
101   /** Re-normalizes the voted CMatrix after all votes are cast */
102   void NormalizeVotedCMatrix();
103
104   /** Calculate location of the pixel based on core atoms voting for it*/
105   void CalcWeightedCoreAtomLocation(double weight_factor, Self * votingPixel);
106
107   /** Calculate mean intensity os the pixel based on its core atoms*/
108   void CalcMeanCoreAtomIntensity();
109
110   /** Returns the calculated voted location*/
111   PositionType GetVotedLocation();
112
113   BloxCoreAtomPixel();
114   ~BloxCoreAtomPixel();
115
116 private:
117
118   /** Average (arithmetic mean) of core atom diameters stored in this pixel. */
119   double m_MeanCoreAtomDiameter;
120
121   /** The raw CMatrix - this is the matrix that we do eigen analysis on. */
122   MatrixType m_RawCMatrix;
123
124   /** The eigenvalues of the core atom population in this pixel
125    * These are stored in increasing order of value (not absolute value) from
126    * indices 0 to n, where n is the number of dimensions in the source image */
127   EigenvalueType m_Eigenvalues;
128
129   /** The eigenvectors of the core atom population in this pixel
130    * Each eigenvector is a column of this matrix */
131   EigenvectorType m_Eigenvectors;
132
133   /** The CMatrix that collects votes cast by other blox. */
134   MatrixType m_VotedCMatrix;
135
136   /** Same as above, but calculated from the voted CMatrix */
137   EigenvalueType m_VotedEigenvalues;
138
139   /** Same as above, but calculated from the voted CMatrix */
140   EigenvectorType m_VotedEigenvectors;
141
142   /** The number of core atoms in all of the blox's that have voted for
143    * this blox (its constituency) */
144   double m_ConstituencySize;
145
146   /** Used to compute the voted location of the core atom population */
147   PositionType m_LocationSums;
148
149   /** Used to compute the voted location of the core atom population */
150   PositionType m_VotedLocation;
151
152   /** Total weights used to compute voted location */
153   double m_WeightSum;
154
155   /** Total weights used to compute voted location */
156   double m_MeanCoreAtomIntensity;
157 };
158
159
160 // end namespace itk
161
162 #ifndef ITK_MANUAL_INSTANTIATION
163 #include "itkBloxCoreAtomPixel.txx"
164 #endif
165
166 #endif
167

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:00PM
© Kitware Inc.