#include <itkVariableLengthVector.h>
Collaboration diagram for itk::VariableLengthVector< TValueType >:
This class is templated over the data type. This data-type is meant to a scalar, such as float, double etc...
Arrays
. 1. FixedArray - Compile time fixed length arrays that's intended to represent an enumerated collection of n
entities. 2. Array - Run time resizeable array that is intended to hold a collection of n
entities 3. Vector - Compile time fixed length array that is intended to hold a collection of n
data types. A vector usually has a mathematical meaning. It should only be used when mathematical operations such as addition, multiplication by a scalar, product etc make sense. 4. VariableLengthVector - Run time array that is intended to hold a collection of scalar data types. Again, it should be used only when mathematical operations on it are relevant. If not, use an Array. 5. Point - Represents the spatial coordinates of a spatial location. Operators on Point reflect geometrical concepts.VariableLengthVector< bool >
vnl_vector
to avoid being limited by the explicit template instantiations of vnl_vector and other hacks that vnl folks have been forced to use.
Definition at line 68 of file itkVariableLengthVector.h.
Public Types | |
typedef TValueType | ComponentType |
typedef unsigned int | ElementIdentifier |
typedef NumericTraits< ValueType >::RealType | RealValueType |
typedef VariableLengthVector | Self |
typedef TValueType | ValueType |
Public Member Functions | |
TValueType * | AllocateElements (ElementIdentifier size) const |
void | Fill (TValueType const &v) |
const TValueType * | GetDataPointer () const |
const TValueType & | GetElement (unsigned int i) const |
RealValueType | GetNorm () const |
RealValueType | GetSquaredNorm () const |
const Self & | operator= (const Self &v) |
TValueType const & | operator[] (unsigned int i) const |
TValueType & | operator[] (unsigned int i) |
void | Reserve (ElementIdentifier) |
void | SetData (TValueType *data, unsigned int sz, bool LetArrayManageMemory=false) |
void | SetData (TValueType *data, bool LetArrayManageMemory=false) |
void | SetElement (unsigned int i, const TValueType &value) |
VariableLengthVector (const VariableLengthVector< TValueType > &v) | |
VariableLengthVector (const ValueType *data, unsigned int sz, bool LetArrayManageMemory=false) | |
VariableLengthVector (ValueType *data, unsigned int sz, bool LetArrayManageMemory=false) | |
VariableLengthVector (unsigned int dimension) | |
VariableLengthVector () | |
~VariableLengthVector () | |
unsigned int | GetNumberOfElements (void) const |
unsigned int | Size (void) const |
unsigned int | GetSize (void) const |
void | SetSize (unsigned int sz, bool destroyExistingData=true) |
template<class T> | |
Self | operator * (T s) const |
template<class T> | |
Self & | operator *= (T s) |
bool | operator!= (const Self &v) const |
Self | operator+ (TValueType s) const |
template<class T> | |
Self | operator+ (const VariableLengthVector< T > &v) const |
Self | operator++ (int) |
Self & | operator++ () |
Self & | operator+= (TValueType s) |
template<class T> | |
Self & | operator+= (const VariableLengthVector< T > &v) |
Self & | operator- () |
Self | operator- (TValueType s) const |
template<class T> | |
Self | operator- (const VariableLengthVector< T > &v) const |
Self | operator-- (int) |
Self & | operator-- () |
Self & | operator-= (TValueType s) |
template<class T> | |
Self & | operator-= (const VariableLengthVector< T > &v) |
template<class T> | |
Self | operator/ (T s) const |
template<class T> | |
Self & | operator/= (T s) |
bool | operator== (const Self &v) const |
template<class T> | |
const VariableLengthVector< TValueType > & | operator= (const VariableLengthVector< T > &v) |
typedef TValueType itk::VariableLengthVector< TValueType >::ComponentType |
Definition at line 74 of file itkVariableLengthVector.h.
typedef unsigned int itk::VariableLengthVector< TValueType >::ElementIdentifier |
Typedef used to indicate the number of elements in the vector
Definition at line 79 of file itkVariableLengthVector.h.
typedef NumericTraits< ValueType >::RealType itk::VariableLengthVector< TValueType >::RealValueType |
Definition at line 75 of file itkVariableLengthVector.h.
typedef VariableLengthVector itk::VariableLengthVector< TValueType >::Self |
Definition at line 76 of file itkVariableLengthVector.h.
typedef TValueType itk::VariableLengthVector< TValueType >::ValueType |
The element type stored at each location in the Array.
Definition at line 73 of file itkVariableLengthVector.h.
itk::VariableLengthVector< TValueType >::VariableLengthVector | ( | ) |
Default constructor. It is created with an empty array it has to be allocated later by assignment
itk::VariableLengthVector< TValueType >::VariableLengthVector | ( | unsigned int | dimension | ) |
Constructor with size. Size can only be changed by assignment
itk::VariableLengthVector< TValueType >::VariableLengthVector | ( | ValueType * | data, | |
unsigned int | sz, | |||
bool | LetArrayManageMemory = false | |||
) |
Constructor that initializes array with contents from a user supplied buffer. The pointer to the buffer and the length is specified. By default, the array does not manage the memory of the buffer. It merely points to that location and it is the user's responsibility to delete it. If "LetArrayManageMemory" is true, then this class will free the memory when this object is destroyed.
itk::VariableLengthVector< TValueType >::VariableLengthVector | ( | const ValueType * | data, | |
unsigned int | sz, | |||
bool | LetArrayManageMemory = false | |||
) |
Constructor that initializes array with contents from a user supplied buffer. The pointer to the buffer and the length is specified. By default, the array does not manage the memory of the buffer. It merely points to that location and it is the user's responsibility to delete it. If "LetArrayManageMemory" is true, then this class will free the memory when this object is destroyed.
itk::VariableLengthVector< TValueType >::VariableLengthVector | ( | const VariableLengthVector< T > & | v | ) | [inline] |
Copy constructor. The reason why the copy constructor and the assignment operator are templated is that it will allow implicit casts to be performed. For instance
VariableLengthVector< int > vI;
VariableLengthVector< float > vF( vI );
or for instance vF = static_cast< VariableLengthVector< float > >( vI );
Definition at line 117 of file itkVariableLengthVector.h.
References itk::VariableLengthVector< TValueType >::AllocateElements(), and itk::VariableLengthVector< TValueType >::Size().
itk::VariableLengthVector< TValueType >::VariableLengthVector | ( | const VariableLengthVector< TValueType > & | v | ) |
Copy constructer.. Override the default non-templated copy constructor that the compiler provides
itk::VariableLengthVector< TValueType >::~VariableLengthVector | ( | ) |
This destructor is not virtual for performance reasons. However, this means that subclasses cannot allocate memory.
itk::VariableLengthVector< TValueType >::VariableLengthVector | ( | const VariableLengthVector< T > & | v | ) | [inline] |
Copy constructor. The reason why the copy constructor and the assignment operator are templated is that it will allow implicit casts to be performed. For instance
VariableLengthVector< int > vI;
VariableLengthVector< float > vF( vI );
or for instance vF = static_cast< VariableLengthVector< float > >( vI );
Definition at line 117 of file itkVariableLengthVector.h.
References itk::VariableLengthVector< TValueType >::AllocateElements(), and itk::VariableLengthVector< TValueType >::Size().
TValueType* itk::VariableLengthVector< TValueType >::AllocateElements | ( | ElementIdentifier | size | ) | const |
Allocate memory of certain size and return it.
Referenced by itk::VariableLengthVector< TValueType >::VariableLengthVector().
void itk::VariableLengthVector< TValueType >::Fill | ( | TValueType const & | v | ) |
Set the all the elements of the array to the specified value
Referenced by itk::MeasurementVectorTraits::SetLength().
const TValueType* itk::VariableLengthVector< TValueType >::GetDataPointer | ( | ) | const [inline] |
Definition at line 229 of file itkVariableLengthVector.h.
Referenced by itk::VariableLengthVector< TValueType >::operator=(), and itk::MetaArrayWriter::SetInput().
const TValueType& itk::VariableLengthVector< TValueType >::GetElement | ( | unsigned int | i | ) | const [inline] |
Get one element
Definition at line 172 of file itkVariableLengthVector.h.
RealValueType itk::VariableLengthVector< TValueType >::GetNorm | ( | ) | const |
Returns vector's Euclidean Norm
unsigned int itk::VariableLengthVector< TValueType >::GetNumberOfElements | ( | void | ) | const [inline] |
Definition at line 161 of file itkVariableLengthVector.h.
unsigned int itk::VariableLengthVector< TValueType >::GetSize | ( | void | ) | const [inline] |
Definition at line 190 of file itkVariableLengthVector.h.
Referenced by itk::MeasurementVectorTraits::GetLength().
RealValueType itk::VariableLengthVector< TValueType >::GetSquaredNorm | ( | ) | const |
Returns vector's Squared Euclidean Norm
Self itk::VariableLengthVector< TValueType >::operator * | ( | T | s | ) | const [inline] |
Definition at line 267 of file itkVariableLengthVector.h.
Self& itk::VariableLengthVector< TValueType >::operator *= | ( | T | s | ) | [inline] |
Definition at line 367 of file itkVariableLengthVector.h.
bool itk::VariableLengthVector< TValueType >::operator!= | ( | const Self & | v | ) | const |
Self itk::VariableLengthVector< TValueType >::operator+ | ( | TValueType | s | ) | const [inline] |
Definition at line 287 of file itkVariableLengthVector.h.
Self itk::VariableLengthVector< TValueType >::operator+ | ( | const VariableLengthVector< T > & | v | ) | const [inline] |
Mathematical operators.
Definition at line 236 of file itkVariableLengthVector.h.
References itk::VariableLengthVector< TValueType >::Size().
Self itk::VariableLengthVector< TValueType >::operator++ | ( | int | ) | [inline] |
Definition at line 327 of file itkVariableLengthVector.h.
Self& itk::VariableLengthVector< TValueType >::operator++ | ( | ) | [inline] |
Definition at line 313 of file itkVariableLengthVector.h.
References itk::VariableLengthVector< TValueType >::m_Data.
Self& itk::VariableLengthVector< TValueType >::operator+= | ( | TValueType | s | ) | [inline] |
Definition at line 359 of file itkVariableLengthVector.h.
Self& itk::VariableLengthVector< TValueType >::operator+= | ( | const VariableLengthVector< T > & | v | ) | [inline] |
Definition at line 351 of file itkVariableLengthVector.h.
Self& itk::VariableLengthVector< TValueType >::operator- | ( | ) |
Self itk::VariableLengthVector< TValueType >::operator- | ( | TValueType | s | ) | const [inline] |
Definition at line 296 of file itkVariableLengthVector.h.
Self itk::VariableLengthVector< TValueType >::operator- | ( | const VariableLengthVector< T > & | v | ) | const [inline] |
Definition at line 252 of file itkVariableLengthVector.h.
References itk::VariableLengthVector< TValueType >::Size().
Self itk::VariableLengthVector< TValueType >::operator-- | ( | int | ) | [inline] |
Definition at line 321 of file itkVariableLengthVector.h.
Self& itk::VariableLengthVector< TValueType >::operator-- | ( | ) | [inline] |
Definition at line 305 of file itkVariableLengthVector.h.
References itk::VariableLengthVector< TValueType >::m_Data.
Self& itk::VariableLengthVector< TValueType >::operator-= | ( | TValueType | s | ) | [inline] |
Definition at line 342 of file itkVariableLengthVector.h.
Self& itk::VariableLengthVector< TValueType >::operator-= | ( | const VariableLengthVector< T > & | v | ) | [inline] |
Definition at line 334 of file itkVariableLengthVector.h.
Self itk::VariableLengthVector< TValueType >::operator/ | ( | T | s | ) | const [inline] |
Definition at line 276 of file itkVariableLengthVector.h.
Self& itk::VariableLengthVector< TValueType >::operator/= | ( | T | s | ) | [inline] |
Definition at line 375 of file itkVariableLengthVector.h.
const Self& itk::VariableLengthVector< TValueType >::operator= | ( | const Self & | v | ) |
Assignment operator
const VariableLengthVector< TValueType >& itk::VariableLengthVector< TValueType >::operator= | ( | const VariableLengthVector< T > & | v | ) | [inline] |
Assignment operator
Definition at line 139 of file itkVariableLengthVector.h.
References itk::VariableLengthVector< TValueType >::GetDataPointer(), and itk::VariableLengthVector< TValueType >::SetSize().
bool itk::VariableLengthVector< TValueType >::operator== | ( | const Self & | v | ) | const |
TValueType const& itk::VariableLengthVector< TValueType >::operator[] | ( | unsigned int | i | ) | const [inline] |
Return reference to the element at specified index. No range checking.
Definition at line 169 of file itkVariableLengthVector.h.
TValueType& itk::VariableLengthVector< TValueType >::operator[] | ( | unsigned int | i | ) | [inline] |
Return reference to the element at specified index. No range checking.
Definition at line 166 of file itkVariableLengthVector.h.
void itk::VariableLengthVector< TValueType >::Reserve | ( | ElementIdentifier | ) |
Reserves memory of a certain length.
If the array already contains data, the existing data is copied over and new space is allocated, if necessary. If the length to reserve is less than the current number of elements, then an appropriate number of elements are discarded.
void itk::VariableLengthVector< TValueType >::SetData | ( | TValueType * | data, | |
unsigned int | sz, | |||
bool | LetArrayManageMemory = false | |||
) |
Similar to the previous method. In the above method, the size must be seperately set prior to using user-supplied data. This introduces an unnecessary allocation step to be performed. This method avoids it and should be used to import data whereever possible to avoid this. Set the pointer from which the data is imported. If "LetArrayManageMemory" is false, then the application retains the responsibility of freeing the memory for this data. If "LetArrayManageMemory" is true, then this class will free the memory when this object is destroyed.
void itk::VariableLengthVector< TValueType >::SetData | ( | TValueType * | data, | |
bool | LetArrayManageMemory = false | |||
) |
Set the pointer from which the data is imported. If "LetArrayManageMemory" is false, then the application retains the responsibility of freeing the memory for this data. If "LetArrayManageMemory" is true, then this class will free the memory when this object is destroyed.
Referenced by itk::MetaArrayReader::GetOutput().
void itk::VariableLengthVector< TValueType >::SetElement | ( | unsigned int | i, | |
const TValueType & | value | |||
) | [inline] |
Set one element
Definition at line 176 of file itkVariableLengthVector.h.
void itk::VariableLengthVector< TValueType >::SetSize | ( | unsigned int | sz, | |
bool | destroyExistingData = true | |||
) |
Set the size to that given.
If destroyExistingData
is false:
If the array already contains data, the existing data is copied over and new space is allocated, if necessary. If the length to reserve is less than the current number of elements, then an appropriate number of elements are discarded. If true
, the size is set destructively to the length given. If the length is different from the current length, existing data will be lost. The default is true
.
Referenced by itk::VariableLengthVector< TValueType >::operator=(), and itk::MeasurementVectorTraits::SetLength().
unsigned int itk::VariableLengthVector< TValueType >::Size | ( | void | ) | const [inline] |
Return the number of elements in the Array
Definition at line 159 of file itkVariableLengthVector.h.
Referenced by itk::MeasurementVectorTraits::Assert(), itk::VariableLengthVector< TValueType >::operator+(), itk::VariableLengthVector< TValueType >::operator-(), itk::operator<<(), itk::MetaArrayWriter::SetInput(), and itk::VariableLengthVector< TValueType >::VariableLengthVector().