Numerical vector class. More...
#include <cmtkVector.h>

Public Types | |
| typedef Vector< T > | Self |
| This class. | |
| typedef SmartPointer< Self > | SmartPtr |
| Smart pointer to igsFloatVector. | |
Public Member Functions | |
| Vector * | Clone (const size_t len=0, const size_t from=0) const |
| Clone (sub)vector. | |
| ~Vector () | |
| Destructor. | |
| Vector & | SetDim (const size_t dim, const bool zero=true) |
| Set vector dimension. | |
| Vector & | AdjustDimension (const size_t dim, const bool zero=true) |
| Adjust vector dimension. | |
| Vector & | operator= (const Vector &other) |
| Vector assignment. | |
| void | CopyToOffset (const Vector &other, const size_t offs=0, size_t len=0) |
| Copy another vector to given offset. | |
| int | operator== (const Vector &other) const |
| Test for vector equality. | |
| int | operator!= (const Vector &other) const |
| Test for vector inequality. | |
| T | EuclidNorm () const |
| Calculate Euclid's vector norm. | |
| T | MaxNorm () const |
| Calculate maximum vector norm. | |
| void | Clear () |
| Set all vector elements to zero. | |
| void | SetAll (const T value) |
| Set all vector elements to constant value. | |
| T & | operator[] (const size_t index) |
| Get vector element by coordinate index. | |
| const T & | operator[] (const size_t index) const |
| Get constant vector element by coordinate index. | |
| Vector< T > & | operator+= (const Vector< T > &delta) |
| Increment vector by another. | |
| Vector< T > & | operator-= (const Vector< T > &delta) |
| Decrement vector by another. | |
| Vector< T > & | operator*= (const T a) |
| Multiply by a scalar. | |
| void | Print (FILE *const fp=NULL, const char *format=" %f") const |
| void | Sort (const size_t from=0, const size_t len=0) |
| Sort values in the vector. | |
Constructors | |
| Vector (const size_t dim=0, const T value=0) | |
| Create constant (zero-)vector. | |
| Vector (const size_t dim, T *const elements, const bool freeElements=true) | |
| Create vector from existing array. | |
| Vector (const Vector &other, const size_t len=0, const size_t from=0) | |
| Create vector from other vector (also subvector). | |
Public Attributes | |
| size_t | Dim |
| Vector dimension. | |
| T * | Elements |
| Vector elements. | |
Static Private Member Functions | |
| static int | Compare (const void *a, const void *b) |
| Compare two vector elements; this is needed for sorting. | |
Private Attributes | |
| bool | FreeElements |
| Flag for memory deallocation of value array. | |
Numerical vector class.
Definition at line 61 of file cmtkVector.h.
| typedef Vector<T> cmtk::Vector< T >::Self |
This class.
Definition at line 71 of file cmtkVector.h.
| typedef SmartPointer<Self> cmtk::Vector< T >::SmartPtr |
Smart pointer to igsFloatVector.
Definition at line 74 of file cmtkVector.h.
| cmtk::Vector< T >::Vector | ( | const size_t | dim = 0, |
| const T | value = 0 |
||
| ) | [inline] |
Create constant (zero-)vector.
Definition at line 79 of file cmtkVector.h.
| cmtk::Vector< T >::Vector | ( | const size_t | dim, |
| T *const | elements, | ||
| const bool | freeElements = true |
||
| ) | [inline] |
Create vector from existing array.
Definition at line 101 of file cmtkVector.h.
| cmtk::Vector< T >::Vector | ( | const Vector< T > & | other, |
| const size_t | len = 0, |
||
| const size_t | from = 0 |
||
| ) | [inline] |
Create vector from other vector (also subvector).
Definition at line 109 of file cmtkVector.h.
| cmtk::Vector< T >::~Vector | ( | ) | [inline] |
Destructor.
Definition at line 129 of file cmtkVector.h.
| Vector& cmtk::Vector< T >::AdjustDimension | ( | const size_t | dim, |
| const bool | zero = true |
||
| ) | [inline] |
Adjust vector dimension.
Unlike SetDim(), this function preserves the values of elements in the vector if they are still in the valid index range after size adjustment.
| dim | The number of elements to be stored in this vector after returning from this function. |
| zero | If this parameter is true, all new vector elements are set to the zero value in their respective data type. |
Definition at line 184 of file cmtkVector.h.
Referenced by cmtk::Xform::GetParamVector().
| void cmtk::Vector< T >::Clear | ( | ) | [inline] |
Set all vector elements to zero.
Definition at line 299 of file cmtkVector.h.
Referenced by cmtk::GroupwiseRegistrationFunctionalBase::ForceZeroSumGradient().
| Vector* cmtk::Vector< T >::Clone | ( | const size_t | len = 0, |
| const size_t | from = 0 |
||
| ) | const [inline] |
Clone (sub)vector.
Definition at line 123 of file cmtkVector.h.
| static int cmtk::Vector< T >::Compare | ( | const void * | a, |
| const void * | b | ||
| ) | [inline, static, private] |
Compare two vector elements; this is needed for sorting.
Definition at line 403 of file cmtkVector.h.
| void cmtk::Vector< T >::CopyToOffset | ( | const Vector< T > & | other, |
| const size_t | offs = 0, |
||
| size_t | len = 0 |
||
| ) | [inline] |
Copy another vector to given offset.
| other | Vector from which the specified elements are copied. |
| offs | Destination offset. Copying starts at this position in this instance. |
| len | Number of elements to be copied. If zero, all elements are copied until the end of one of the vectors is reached. |
Definition at line 241 of file cmtkVector.h.
Referenced by cmtk::SymmetricElasticFunctional_Template< VM >::GetParamVector(), cmtk::ImagePairSymmetricNonrigidRegistrationFunctionalTemplate< VM, W >::GetParamVector(), and cmtk::Xform::GetParamVector().
| T cmtk::Vector< T >::EuclidNorm | ( | ) | const [inline] |
Calculate Euclid's vector norm.
Definition at line 269 of file cmtkVector.h.
Referenced by cmtk::ActiveShapeModel::Decompose(), and cmtk::BestDirectionOptimizer::Optimize().
| T cmtk::Vector< T >::MaxNorm | ( | ) | const [inline] |
Calculate maximum vector norm.
Definition at line 286 of file cmtkVector.h.
Referenced by cmtk::SplineWarpGroupwiseRegistrationRMIFunctional::EvaluateWithGradient(), cmtk::SplineWarpCongealingFunctional::EvaluateWithGradient(), cmtk::GroupwiseRegistrationFunctionalBase::ForceZeroSumGradient(), and cmtk::BestDirectionOptimizer::Optimize().
| int cmtk::Vector< T >::operator!= | ( | const Vector< T > & | other ) | const [inline] |
Test for vector inequality.
Definition at line 263 of file cmtkVector.h.
| Vector<T>& cmtk::Vector< T >::operator*= | ( | const T | a ) | [inline] |
Multiply by a scalar.
Definition at line 355 of file cmtkVector.h.
| Vector<T>& cmtk::Vector< T >::operator+= | ( | const Vector< T > & | delta ) | [inline] |
Increment vector by another.
Definition at line 327 of file cmtkVector.h.
| Vector<T>& cmtk::Vector< T >::operator-= | ( | const Vector< T > & | delta ) | [inline] |
Decrement vector by another.
Definition at line 341 of file cmtkVector.h.
| Vector& cmtk::Vector< T >::operator= | ( | const Vector< T > & | other ) | [inline] |
Vector assignment.
Definition at line 213 of file cmtkVector.h.
| int cmtk::Vector< T >::operator== | ( | const Vector< T > & | other ) | const [inline] |
Test for vector equality.
Definition at line 250 of file cmtkVector.h.
| T& cmtk::Vector< T >::operator[] | ( | const size_t | index ) | [inline] |
Get vector element by coordinate index.
Definition at line 315 of file cmtkVector.h.
| const T& cmtk::Vector< T >::operator[] | ( | const size_t | index ) | const [inline] |
Get constant vector element by coordinate index.
Definition at line 321 of file cmtkVector.h.
| void cmtk::Vector< T >::Print | ( | FILE *const | fp = NULL, |
| const char * | format = " %f" |
||
| ) | const [inline] |
Definition at line 366 of file cmtkVector.h.
| void cmtk::Vector< T >::SetAll | ( | const T | value ) | [inline] |
Set all vector elements to constant value.
Definition at line 305 of file cmtkVector.h.
Referenced by cmtk::CreateEntropyMinimizationIntensityCorrectionFunctional(), and cmtk::CreateEntropyMinimizationIntensityCorrectionFunctionalDevice().
| Vector& cmtk::Vector< T >::SetDim | ( | const size_t | dim, |
| const bool | zero = true |
||
| ) | [inline] |
Set vector dimension.
If the current vector dimension is not equal to the requested dimension, the elements array is deleted and a new one is allocated. In any case, there is no guarantee that the data stored in the vector before this call remains unchanged. This is even true for initial elements.
| dim | The number of elements to be stored in this vector after returning from this function. |
| zero | If this parameter is true, all vector elements are set to the zero value in their respective data type. |
Definition at line 148 of file cmtkVector.h.
Referenced by cmtk::ParametricPlane::GetParameters(), cmtk::SymmetricElasticFunctional_Template< VM >::GetParamVector(), cmtk::ImagePairSymmetricNonrigidRegistrationFunctionalTemplate< VM, W >::GetParamVector(), and cmtk::GroupwiseRegistrationFunctionalBase::GetParamVector().
| void cmtk::Vector< T >::Sort | ( | const size_t | from = 0, |
| const size_t | len = 0 |
||
| ) | [inline] |
Sort values in the vector.
Using the two parameters, from and len, this function can be used to sort only a subrange of values in this vector. In particular, it can be used to sort the first len elements if from == 0.
| from | Index of first element in the range to sort. |
| len | Number of elements to be sorted. |
Definition at line 389 of file cmtkVector.h.
Referenced by cmtk::ReformatVolume::GetTransformedReferenceJacobianAvgThread().
| size_t cmtk::Vector< T >::Dim |
Vector dimension.
Definition at line 65 of file cmtkVector.h.
Referenced by cmtk::CoordMult(), cmtk::Vector< Types::Coordinate >::CopyToOffset(), cmtk::SplineWarpGroupwiseRegistrationRMIFunctional::EvaluateWithGradient(), cmtk::SplineWarpCongealingFunctional::EvaluateWithGradient(), cmtk::ProtocolCallback::ExecuteWithData(), cmtk::SymmetricElasticFunctional_Template< VM >::GetParamVector(), cmtk::ImagePairSymmetricNonrigidRegistrationFunctionalTemplate< VM, W >::GetParamVector(), cmtk::Xform::GetParamVector(), cmtk::operator*(), cmtk::operator+(), cmtk::Vector< Types::Coordinate >::operator+=(), cmtk::operator-(), cmtk::Vector< Types::Coordinate >::operator-=(), cmtk::Vector< Types::Coordinate >::operator=(), cmtk::Vector< Types::Coordinate >::operator==(), cmtk::BestDirectionOptimizer::Optimize(), cmtk::ImagePairAffineRegistrationCommandLine::OutputResult(), cmtk::AffineRegistrationCommandLine::OutputResult(), cmtk::ImagePairAffineRegistrationCommandLine::OutputResultParameters(), cmtk::AffineRegistrationCommandLine::OutputResultParameters(), and cmtk::Vector< Types::Coordinate >::Vector().
| T* cmtk::Vector< T >::Elements |
Vector elements.
Definition at line 68 of file cmtkVector.h.
Referenced by cmtk::CoordMult(), cmtk::Vector< Types::Coordinate >::CopyToOffset(), cmtk::SymmetricElasticFunctional_Template< VM >::EvaluateAt(), cmtk::ImagePairSymmetricNonrigidRegistrationFunctionalTemplate< VM, W >::EvaluateAt(), cmtk::SymmetricElasticFunctional_Template< VM >::EvaluateWithGradient(), cmtk::SplineWarpMultiChannelRegistrationFunctional< TMetricFunctional >::EvaluateWithGradient(), cmtk::SplineWarpGroupwiseRegistrationRMIFunctional::EvaluateWithGradient(), cmtk::SplineWarpCongealingFunctional::EvaluateWithGradient(), cmtk::ParallelElasticFunctional< VM >::EvaluateWithGradient(), cmtk::ImagePairSymmetricNonrigidRegistrationFunctionalTemplate< VM, W >::EvaluateWithGradient(), cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::EvaluateWithGradient(), cmtk::operator*(), cmtk::operator+(), cmtk::Vector< Types::Coordinate >::operator+=(), cmtk::operator-(), cmtk::Vector< Types::Coordinate >::operator-=(), cmtk::Vector< Types::Coordinate >::operator=(), cmtk::Vector< Types::Coordinate >::operator==(), cmtk::operator>>(), cmtk::ImagePairAffineRegistrationCommandLine::OutputResult(), cmtk::AffineRegistrationCommandLine::OutputResult(), cmtk::ImagePairAffineRegistrationCommandLine::OutputResultParameters(), cmtk::AffineRegistrationCommandLine::OutputResultParameters(), cmtk::Registration2d2d::Register(), cmtk::GroupwiseRegistrationFunctionalBase::SetParamVector(), and cmtk::Vector< Types::Coordinate >::Vector().
bool cmtk::Vector< T >::FreeElements [private] |
Flag for memory deallocation of value array.
Definition at line 400 of file cmtkVector.h.
1.7.2