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
|
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile: itkBloxCoreAtomPixel.h,v $
Language: C++
Date: $Date: 2007-04-06 12:50:58 $
Version: $Revision: 1.24 $
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 __itkBloxCoreAtomPixel_h
#define __itkBloxCoreAtomPixel_h
#include "vnl/vnl_matrix_fixed.h"
#include "vnl/vnl_vector_fixed.h"
#include "vnl/algo/vnl_generalized_eigensystem.h"
#include "itkObject.h"
#include "itkBloxCoreAtomItem.h"
#include "itkBloxBoundaryPointItem.h"
#include "itkPoint.h"
#include "itkCovariantVector.h"
#include "itkBloxPixel.h"
namespace itk
{
/**
* \class BloxCoreAtomPixel
* \brief Holds a linked list of itk::BloxCoreAtomItem's
*
* \ingroup ImageObjects
* */
template <unsigned int NDimensions>
class ITK_EXPORT BloxCoreAtomPixel : public BloxPixel<
BloxCoreAtomItem<NDimensions> >
{
public:
/** Standard class typedefs. */
typedef BloxCoreAtomPixel Self;
typedef BloxPixel< BloxCoreAtomItem<NDimensions> > Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
/** The type of core atom item we process. */
typedef BloxCoreAtomItem<NDimensions> CoreAtomItemType;
/** The type of boundary point item we process. */
typedef BloxBoundaryPointItem<NDimensions> BPItemType;
/** The type used to store the position of the BoundaryPointItem. */
typedef Point<double, NDimensions> PositionType;
/** The type of vector used to store the gradient of the BoundaryPointItem. */
typedef CovariantVector<double, NDimensions> GradientType;
/** VNL type used in eigenanalysis. */
typedef vnl_vector_fixed<double, NDimensions> VectorType;
/** Vector type used to store eigenvalues. */
typedef vnl_vector_fixed<double, NDimensions> EigenvalueType;
/** Matrix type used to store eigenvectors. */
typedef vnl_matrix_fixed<double, NDimensions, NDimensions> EigenvectorType;
/** Generalized matrix type used for several different tasks. */
typedef vnl_matrix_fixed<double, NDimensions, NDimensions> MatrixType;
/** Calculate and store the mean of core atom diameters. */
double CalcMeanCoreAtomDiameter();
/** Perform eigenanalysis on the population of core atoms
* stored in this pixel. */
bool DoCoreAtomEigenanalysis();
/** Perform eigenanalysis on the voted CMatrix */
void DoVotedEigenanalysis();
/** Get statements */
double GetMeanCoreAtomDiameter() {return m_MeanCoreAtomDiameter;}
double GetMeanCoreAtomIntensity() {return m_MeanCoreAtomIntensity;}
EigenvalueType GetEigenvalues() {return m_Eigenvalues;}
EigenvalueType GetVotedEigenvalues() {return m_VotedEigenvalues;}
EigenvectorType GetEigenvectors() {return m_Eigenvectors;}
EigenvectorType GetVotedEigenvectors() {return m_VotedEigenvectors;}
PositionType GetLocationSums() {return m_LocationSums;}
double GetWeightSum() {return m_WeightSum;}
/** Get the raw CMatrix (prior to voting) */
MatrixType* GetRawCMatrixPointer() {return &m_RawCMatrix;}
/** Collect a vote and update m_VotedCMatrix */
void CollectVote(MatrixType* pMatrix, double strength, double count);
/** Re-normalizes the voted CMatrix after all votes are cast */
void NormalizeVotedCMatrix();
/** Calculate location of the pixel based on core atoms voting for
* it.
*/
void CalcWeightedCoreAtomLocation(double weight_factor, Self * votingPixel);
/** Calculate mean intensity os the pixel based on its core atoms. */
void CalcMeanCoreAtomIntensity();
/** Returns the calculated voted location */
PositionType GetVotedLocation();
BloxCoreAtomPixel();
~BloxCoreAtomPixel();
private:
/** Average (arithmetic mean) of core atom diameters stored in this pixel. */
double m_MeanCoreAtomDiameter;
/** The raw CMatrix - this is the matrix that we do eigen analysis on. */
MatrixType m_RawCMatrix;
/** The eigenvalues of the core atom population in this pixel
* These are stored in increasing order of value (not absolute value) from
* indices 0 to n, where n is the number of dimensions in the source image */
EigenvalueType m_Eigenvalues;
/** The eigenvectors of the core atom population in this pixel
* Each eigenvector is a column of this matrix */
EigenvectorType m_Eigenvectors;
/** The CMatrix that collects votes cast by other blox. */
MatrixType m_VotedCMatrix;
/** Same as above, but calculated from the voted CMatrix */
EigenvalueType m_VotedEigenvalues;
/** Same as above, but calculated from the voted CMatrix */
EigenvectorType m_VotedEigenvectors;
/** The number of core atoms in all of the blox's that have voted for
* this blox (its constituency) */
double m_ConstituencySize;
/** Used to compute the voted location of the core atom population */
PositionType m_LocationSums;
/** Used to compute the voted location of the core atom population */
PositionType m_VotedLocation;
/** Total weights used to compute voted location */
double m_WeightSum;
/** Total weights used to compute voted location */
double m_MeanCoreAtomIntensity;
};
} // end namespace itk
// Define instantiation macro for this template.
#define ITK_TEMPLATE_BloxCoreAtomPixel(_, EXPORT, x, y) namespace itk { \
_(1(class EXPORT BloxCoreAtomPixel< ITK_TEMPLATE_1 x >)) \
namespace Templates { typedef BloxCoreAtomPixel< ITK_TEMPLATE_1 x > \
BloxCoreAtomPixel##y; } \
}
#if ITK_TEMPLATE_EXPLICIT
# include "Templates/itkBloxCoreAtomPixel+-.h"
#endif
#if ITK_TEMPLATE_TXX
# include "itkBloxCoreAtomPixel.txx"
#endif
#endif
|