ITK
4.3.0
Insight Segmentation and Registration Toolkit
|
#include <itkArray.h>
Array class with size defined at construction time.
This class derives from the vnl_vector<> class. Its size is assigned at construction time (run time) and can not be changed afterwards except by using assignment to another Array.
The class is templated over the type of the elements.
Template parameters for class Array:
Definition at line 50 of file itkArray.h.
Public Types | |
typedef Array | Self |
typedef vnl_vector< TValueType > ::size_type | SizeValueType |
typedef TValueType | ValueType |
typedef vnl_vector< TValueType > | VnlVectorType |
Public Member Functions | |
Array () | |
Array (const Array &) | |
Array (SizeValueType dimension) | |
Array (ValueType *data, SizeValueType sz, bool LetArrayManageMemory=false) | |
Array (const ValueType *data, SizeValueType sz, bool LetArrayManageMemory=false) | |
void | Fill (TValueType const &v) |
const TValueType & | GetElement (SizeValueType i) const |
SizeValueType | GetSize (void) const |
const Self & | operator= (const Self &rhs) |
const Self & | operator= (const VnlVectorType &rhs) |
void | SetData (TValueType *data, bool LetArrayManageMemory=false) |
void | SetData (TValueType *data, SizeValueType sz, bool LetArrayManageMemory=false) |
void | SetElement (SizeValueType i, const TValueType &value) |
void | SetSize (SizeValueType sz) |
~Array () | |
template<class TArrayValue > | |
Array (const Array< TArrayValue > &r) | |
SizeValueType | Size (void) const |
unsigned int | GetNumberOfElements (void) const |
Private Attributes | |
bool | m_LetArrayManageMemory |
typedef Array itk::Array< TValueType >::Self |
Definition at line 56 of file itkArray.h.
typedef vnl_vector< TValueType>::size_type itk::Array< TValueType >::SizeValueType |
Definition at line 58 of file itkArray.h.
typedef TValueType itk::Array< TValueType >::ValueType |
The element type stored at each location in the Array.
Definition at line 55 of file itkArray.h.
typedef vnl_vector< TValueType > itk::Array< TValueType >::VnlVectorType |
Definition at line 57 of file itkArray.h.
itk::Array< TValueType >::Array | ( | ) |
Default constructor. It is created with an empty array it has to be allocated later by assignment
itk::Array< TValueType >::Array | ( | const Array< TValueType > & | ) |
Copy constructor. Uses VNL copy construtor with correct setting for memory management.
|
explicit |
Constructor with size. Size can only be changed by assignment
itk::Array< TValueType >::Array | ( | ValueType * | data, |
SizeValueType | 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::Array< TValueType >::Array | ( | const ValueType * | data, |
SizeValueType | 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.
|
inline |
Constructor to initialize an array from another of any data type
Definition at line 92 of file itkArray.h.
itk::Array< TValueType >::~Array | ( | ) |
This destructor is not virtual for performance reasons. However, this means that subclasses cannot allocate memory.
|
inline |
Set the all the elements of the array to the specified value
Definition at line 104 of file itkArray.h.
Referenced by itk::MatchCardinalityImageToImageMetric< TFixedImage, TMovingImage >::GetDerivative(), itk::NumericTraits< Array< T > >::max(), itk::NumericTraits< Array< T > >::min(), itk::NumericTraits< Array< T > >::NonpositiveMin(), itk::NumericTraits< Array< T > >::OneValue(), itk::NumericTraits< Array< T > >::SetLength(), and itk::NumericTraits< Array< T > >::ZeroValue().
|
inline |
Get one element
Definition at line 119 of file itkArray.h.
|
inline |
Return the number of elements in the Array
Definition at line 114 of file itkArray.h.
|
inline |
Definition at line 129 of file itkArray.h.
Referenced by itk::Array< AccumulateType >::Array(), itk::NumericTraits< Array< T > >::GetLength(), itk::OptimizerParametersHelper< TValueType >::MoveDataPointer(), itk::MetaArrayWriter::SetMultiChannelInput(), and itk::Statistics::ProbabilityDistribution::SetParameters().
const Self& itk::Array< TValueType >::operator= | ( | const Self & | rhs | ) |
Copy opertor
const Self& itk::Array< TValueType >::operator= | ( | const VnlVectorType & | rhs | ) |
void itk::Array< 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(), and itk::OptimizerParametersHelper< TValueType >::MoveDataPointer().
void itk::Array< TValueType >::SetData | ( | TValueType * | data, |
SizeValueType | sz, | ||
bool | LetArrayManageMemory = false |
||
) |
Similar to the previous method. In the above method, the size must be separately 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 wherever 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.
|
inline |
Set one element
Definition at line 123 of file itkArray.h.
void itk::Array< TValueType >::SetSize | ( | SizeValueType | sz | ) |
Destructively set the size to that given. Will lose data.
Referenced by itk::Array< AccumulateType >::Array(), itk::TranslationTransform< TScalarType, NDimensions >::GetFixedParameters(), itk::MetaArrayReader::GetMultiChannelOutput(), itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::LabelStatistics::LabelStatistics(), and itk::NumericTraits< Array< T > >::SetLength().
|
inline |
Return the number of elements in the Array
Definition at line 112 of file itkArray.h.
Referenced by itk::Statistics::MeasurementVectorTraits::Assert(), itk::NumericTraits< Array< T > >::max(), itk::NumericTraits< Array< T > >::min(), itk::NumericTraits< Array< T > >::NonpositiveMin(), itk::NumericTraits< Array< T > >::OneValue(), itk::AutomaticTopologyMeshSource< TOutputMesh >::IdentifierArrayHashFunction::operator()(), itk::AutomaticTopologyMeshSource< TOutputMesh >::IdentifierArrayEqualsFunction::operator()(), itk::MetaArrayWriter::SetInput(), itk::DisplacementFieldTransform< TScalar, NDimensions >::SetParameters(), itk::MeshIOBase::SetPixelType(), SimpleMultiResolutionImageRegistrationUI2< TRegistration >::StartNewLevel(), and itk::NumericTraits< Array< T > >::ZeroValue().
|
private |
Definition at line 161 of file itkArray.h.
Referenced by itk::Array< AccumulateType >::Array().