|
STIR 6.4.0
|

Topics | |
| Implementation details used by Array classes | |
| Functions that implement IO for Array objects | |
Classes | |
| class | stir::Array< num_dimensions, elemT > |
| This class defines multi-dimensional (numeric) arrays. More... | |
| class | stir::ArrayFilter1DUsingConvolution< elemT > |
| This class implements convolution of a 1D array with an arbitrary (i.e. potentially non-symmetric) kernel. More... | |
| class | stir::ArrayFilter1DUsingConvolutionSymmetricKernel< elemT > |
| This class implements convolution of a 1D array with a symmetric kernel. More... | |
| class | stir::ArrayFilterUsingRealDFTWithPadding< num_dimensions, elemT > |
| This class implements convolution of an array of real numbers with an arbitrary (i.e. potentially non-symmetric) kernel using DFTs. More... | |
| class | stir::ArrayFunctionObject< num_dimensions, elemT > |
| A class for operations on n-dimensional Arrays. More... | |
| class | stir::ArrayFunctionObject_1ArgumentImplementation< num_dimensions, elemT > |
| A convenience class for children of ArrayFunctionObject. It implements the 2 argument operator() in terms of the in-place version. More... | |
| class | stir::ArrayFunctionObject_2ArgumentImplementation< num_dimensions, elemT > |
| A convenience class for children of ArrayFunctionObject. It implements the in-place operator() in terms of the 2 argument version. More... | |
| class | stir::BoundaryConditions |
| Preliminary class to specify boundary conditions for filters. More... | |
| class | stir::FullArrayIterator< topleveliterT, restiterT, elemT, _Ref, _Ptr > |
| Class FullArrayIterator implements (forward) iterators that go through all elements of an Array. More... | |
| class | stir::GammaArrayFilter2D< elemT > |
| Gamma correction filter for 2D slices in a 3D volume. More... | |
| class | stir::IndexRange< num_dimensions > |
| This class defines ranges which can be 'irregular'. More... | |
| class | stir::IndexRange2D |
| a 'convenience' class for 2D index ranges. More... | |
| class | stir::IndexRange3D |
| a 'convenience' class for 3D index ranges. Provides an easier constructor for regular ranges. More... | |
| class | stir::IndexRange4D |
| A convenience class for 4D index ranges. More... | |
| class | stir::MaximalArrayFilter3D< elemT > |
| Implements erosion on 3D arrays. More... | |
| class | stir::MedianArrayFilter3D< elemT > |
| Implements median filtering on 3D arrays. More... | |
| class | stir::MinimalArrayFilter3D< elemT > |
| Implements erosion on 3D arrays. More... | |
| class | stir::NumericVectorWithOffset< T, elemT > |
| like VectorWithOffset, but with changes in various numeric operators More... | |
| class | stir::SeparableArrayFunctionObject< num_dimensions, elemT > |
This class implements an n -dimensional ArrayFunctionObject whose operation is separable. More... | |
| class | stir::SeparableGaussianArrayFilter< num_dimensions, elemT > |
Separable Gaussian filtering in n - dimensions. More... | |
| class | stir::SeparableMetzArrayFilter< num_dimensions, elemT > |
Separable Metz filtering in n - dimensions. More... | |
| class | stir::VectorWithOffset< T > |
| A templated class for vectors, but with indices starting not from 0. More... | |
| class | stir::WienerArrayFilter2D< elemT > |
| Applies a 2D Wiener filter on a 3D input array, slice by slice. More... | |
| class | stir::SeparableGaussianArrayFilterTests |
| Tests SeparableGaussianArrayFilter functionality. More... | |
| class | stir::SeparableMetzArrayFilterTests |
| Tests SeparableMetzArrayFilter functionality. More... | |
Functions | |
| template<class elemT> | |
| Array< 1, elemT > & | stir::in_place_log (Array< 1, elemT > &v) |
| Replace elements by their logarithm, 1D version. | |
| template<int num_dimensions, class elemT> | |
| Array< num_dimensions, elemT > & | stir::in_place_log (Array< num_dimensions, elemT > &v) |
| apply log to each element of the multi-dimensional array | |
| template<class elemT> | |
| Array< 1, elemT > & | stir::in_place_exp (Array< 1, elemT > &v) |
| Replace elements by their exponentiation, 1D version. | |
| template<int num_dimensions, class elemT> | |
| Array< num_dimensions, elemT > & | stir::in_place_exp (Array< num_dimensions, elemT > &v) |
| apply exp to each element of the multi-dimensional array | |
| template<class elemT> | |
| Array< 1, elemT > & | stir::in_place_abs (Array< 1, elemT > &v) |
| Replace elements by their absolute value, 1D version. | |
| template<int num_dimensions, class elemT> | |
| Array< num_dimensions, elemT > & | stir::in_place_abs (Array< num_dimensions, elemT > &v) |
| store absolute value of each element of the multi-dimensional array | |
| template<class T, class FUNCTION> | |
| T & | stir::in_place_apply_function (T &v, FUNCTION f) |
| apply any function(object) to each element of the multi-dimensional array | |
| template<int num_dim, typename elemT, typename FunctionObjectPtr> | |
| void | stir::in_place_apply_array_function_on_1st_index (Array< num_dim, elemT > &array, FunctionObjectPtr f) |
| Apply a function object on all possible 1d arrays extracted by keeping all indices fixed, except the first one. | |
| template<int num_dim, typename elemT, typename FunctionObjectPtr> | |
| void | stir::apply_array_function_on_1st_index (Array< num_dim, elemT > &out_array, const Array< num_dim, elemT > &in_array, FunctionObjectPtr f) |
| apply any function(object) to each element of the multi-dimensional array, storing results in a different array | |
| template<int num_dim, typename elemT, typename FunctionObjectPtrIter> | |
| void | stir::in_place_apply_array_functions_on_each_index (Array< num_dim, elemT > &array, FunctionObjectPtrIter start, FunctionObjectPtrIter stop) |
| Apply a sequence of 1d array-function objects on every dimension of the input array. | |
| template<int num_dim, typename elemT, typename FunctionObjectPtrIter> | |
| void | stir::apply_array_functions_on_each_index (Array< num_dim, elemT > &out_array, const Array< num_dim, elemT > &in_array, FunctionObjectPtrIter start, FunctionObjectPtrIter stop) |
| Apply a sequence of 1d array-function objects on every dimension of the input array, store in output array. | |
| template<int num_dim, typename elemT> | |
| void | stir::apply_array_functions_on_each_index (Array< num_dim, elemT > &out_array, const Array< num_dim, elemT > &in_array, ActualFunctionObjectPtrIter start, ActualFunctionObjectPtrIter stop) |
| Apply a sequence of 1d array-function objects of a specific type on every dimension of the input array, store in output array. | |
| template<typename elemT> | |
| void | stir::apply_array_functions_on_each_index (Array< 1, elemT > &out_array, const Array< 1, elemT > &in_array, ActualFunctionObjectPtrIter start, ActualFunctionObjectPtrIter stop) |
| 1d specialisation of above | |
| template<typename elemT, typename FunctionObjectPtrIter> | |
| void | stir::apply_array_functions_on_each_index (Array< 1, elemT > &out_array, const Array< 1, elemT > &in_array, FunctionObjectPtrIter start, FunctionObjectPtrIter stop) |
| 1d specialisation for general function objects | |
| template<class elemT> | |
| void | stir::assign_to_subregion (Array< 3, elemT > &input_array, const BasicCoordinate< 3, int > &mask_location, const BasicCoordinate< 3, int > &half_size, const elemT &value) |
| assign a value to a sub-region of an array | |
| template<class T> | |
| T | stir::find_unweighted_centre_of_gravity_1d (const VectorWithOffset< T > &row) |
| Compute centre of gravity of a vector but without dividing by its sum. | |
| template<int num_dimensions, class T> | |
| BasicCoordinate< num_dimensions, T > | stir::find_unweighted_centre_of_gravity (const ArrayType< num_dimensions, T > &) |
| Compute centre of gravity of an Array but without dividing by its sum. | |
| template<class T> | |
| T | stir::find_unweighted_centre_of_gravity (const ArrayType< 1, T > &) |
| Compute centre of gravity of a 1D Array but without dividing by its sum. | |
| template<int num_dimensions, class T> | |
| BasicCoordinate< num_dimensions, T > | stir::find_centre_of_gravity (const ArrayType< num_dimensions, T > &) |
| Compute centre of gravity of an Array. | |
| template<class T> | |
| void | stir::find_centre_of_gravity_in_mm_per_plane (VectorWithOffset< CartesianCoordinate3D< float > > &allCoG, VectorWithOffset< T > &weights, const VoxelsOnCartesianGrid< T > &image) |
| Computes centre of gravity for each plane. | |
| template<class T> | |
| CartesianCoordinate3D< float > | stir::find_centre_of_gravity_in_mm (const VoxelsOnCartesianGrid< T > &image) |
| Computes centre of gravity of an image. | |
| template<int num_dimensions, class T1, class T2, class scaleT> | |
| void | stir::find_scale_factor (scaleT &scale_factor, const Array< num_dimensions, T1 > &data_in, const NumericInfo< T2 > info_for_out_type) |
| A function that finds a scale factor to use when converting data to a new type. | |
| template<int num_dimensions, class T1, class T2, class scaleT> | |
| Array< num_dimensions, T2 > | stir::convert_array (scaleT &scale_factor, const Array< num_dimensions, T1 > &data_in, const NumericInfo< T2 > info2) |
A function that returns a new Array (of the same dimension) with elements of type T2. | |
| template<int num_dimensions, class T1, class T2, class scaleT> | |
| void | stir::convert_array (Array< num_dimensions, T2 > &data_out, scaleT &scale_factor, const Array< num_dimensions, T1 > &data_in) |
Converts the data_in Array to data_out (with elements of different types) such that data_in == data_out * scale_factor. | |
| template<class InputIteratorT, class T2, class scaleT> | |
| void | stir::find_scale_factor (scaleT &scale_factor, const InputIteratorT &begin, const InputIteratorT &end, const NumericInfo< T2 > info_for_out_type) |
| A function that finds a scale factor to use when converting data to a new type. | |
| template<class OutputIteratorT, class InputIteratorT, class scaleT> | |
| void | stir::convert_range (const OutputIteratorT &out_begin, scaleT &scale_factor, const InputIteratorT &in_begin, const InputIteratorT &in_end) |
Converts the data in the input range to the output range (with elements of different types) such that data_in == data_out * scale_factor. | |
| template<class elemT> | |
| int | stir::index_at_maximum (const VectorWithOffset< elemT > &v) |
| Finds the index where the maximum occurs in a (1-dimensional) vector. | |
| template<class elemT> | |
| BasicCoordinate< 3, int > | stir::indices_at_maximum (const Array< 3, elemT > &input_array) |
| Finds the first (3-dimensional) index where the maximum occurs in a (3-dimensional) array. | |
Replace elements by their absolute value, 1D version.
References stir::VectorWithOffset< T >::get_max_index(), stir::VectorWithOffset< T >::get_min_index(), and in_place_abs().
Referenced by stir::ReconstructionTests< TargetT >::compare(), in_place_abs(), and in_place_abs().
|
inline |
store absolute value of each element of the multi-dimensional array
References stir::VectorWithOffset< T >::get_max_index(), stir::VectorWithOffset< T >::get_min_index(), and in_place_abs().
|
inline |
apply any function(object) to each element of the multi-dimensional array
Each element will be replaced by
Requires that type T has begin_all() and end_all() functions.
References in_place_apply_function().
Referenced by in_place_apply_function(), and stir::ArrayTests::run_tests().
|
inline |
Apply a function object on all possible 1d arrays extracted by keeping all indices fixed, except the first one.
For the 2d case, this amounts to applying a function on all columns of the matrix.
For a 3d case, the following pseudo-code illustrates what happens.
Add a 1D specialisation as the current implementation would be really inefficient in this case.
Add a specialisation such that this function would handle function objects and (smart) pointers to function objects. At the moment, it's only the latter.
References in_place_apply_array_function_on_1st_index().
Referenced by in_place_apply_array_function_on_1st_index(), and in_place_apply_array_functions_on_each_index().
|
inline |
apply any function(object) to each element of the multi-dimensional array, storing results in a different array
References apply_array_function_on_1st_index(), stir::VectorWithOffset< T >::get_max_index(), stir::VectorWithOffset< T >::get_min_index(), and stir::Array< num_dimensions, elemT >::is_regular().
Referenced by apply_array_function_on_1st_index(), apply_array_functions_on_each_index(), and apply_array_functions_on_each_index().
|
inline |
Apply a sequence of 1d array-function objects on every dimension of the input array.
The sequence of function object pointers is specified by iterators. There must be num_dim function objects in the sequence, i.e. stop-start==num_dim.
The n-th function object (**(start+n)) is applied on the n-th index of the array. So, (*start) is applied using in_place_apply_array_function_on_1st_index(array, *start). Similarly, (*(start+1) is applied using in_place_apply_array_function_on_1st_index(array[i], *(start+1)) for every i. And so on.
References in_place_apply_array_function_on_1st_index(), and in_place_apply_array_functions_on_each_index().
Referenced by in_place_apply_array_functions_on_each_index(), and in_place_apply_array_functions_on_each_index().
|
inline |
Apply a sequence of 1d array-function objects on every dimension of the input array, store in output array.
The sequence of function object pointers is specified by iterators. There must be num_dim function objects in the sequence, i.e. stop-start==num_dim.
The n-th function object (**(start+n)) is applied on the n-th indices of the arrays. So, (*start) is applied using
and so on.
References apply_array_function_on_1st_index(), apply_array_functions_on_each_index(), stir::VectorWithOffset< T >::get_max_index(), stir::VectorWithOffset< T >::get_min_index(), stir::Array< num_dimensions, elemT >::get_regular_range(), and stir::Array< num_dimensions, elemT >::is_regular().
Referenced by apply_array_functions_on_each_index(), apply_array_functions_on_each_index(), apply_array_functions_on_each_index(), and apply_array_functions_on_each_index().
|
inline |
Apply a sequence of 1d array-function objects of a specific type on every dimension of the input array, store in output array.
This function uses optimisations possible because ArrayFunctionObject gives information on sizes etc.
References apply_array_function_on_1st_index(), apply_array_functions_on_each_index(), stir::VectorWithOffset< T >::get_max_index(), stir::VectorWithOffset< T >::get_min_index(), stir::Array< num_dimensions, elemT >::get_regular_range(), and stir::Array< num_dimensions, elemT >::is_regular().
|
inline |
assign a value to a sub-region of an array
sets all values for indices between mask_location - half_size and mask_location + half_size to value, taking care of staying inside the index-range of the array.
References assign_to_subregion(), stir::VectorWithOffset< T >::get_max_index(), and stir::VectorWithOffset< T >::get_min_index().
Referenced by assign_to_subregion(), and find_fwhm_in_image().
| T stir::find_unweighted_centre_of_gravity_1d | ( | const VectorWithOffset< T > & | row | ) |
Compute centre of gravity of a vector but without dividing by its sum.
The unweighted centre of gravity is computed as follows:
![\[ C_k = \sum_{i} i A_{i}
\]](form_3.png)
References find_unweighted_centre_of_gravity_1d(), stir::VectorWithOffset< T >::get_max_index(), and stir::VectorWithOffset< T >::get_min_index().
Referenced by find_unweighted_centre_of_gravity(), and find_unweighted_centre_of_gravity_1d().
| BasicCoordinate< num_dimensions, T > stir::find_unweighted_centre_of_gravity | ( | const ArrayType< num_dimensions, T > & | ) |
Compute centre of gravity of an Array but without dividing by its sum.
Each coordinate of the unweighted centre of gravity is computed as follows:
![\[ C_k = \sum_{i_1...i_n} i_k A_{i_1...i_n}
\]](form_4.png)
References find_unweighted_centre_of_gravity(), join(), and stir::Array< num_dimensions, elemT >::sum().
| T stir::find_unweighted_centre_of_gravity | ( | const ArrayType< 1, T > & | ) |
Compute centre of gravity of a 1D Array but without dividing by its sum.
Conceptually the same as the n-dimensional version, but returns a T, not a BasicCoordinate<1,T>.
References find_unweighted_centre_of_gravity(), and find_unweighted_centre_of_gravity_1d().
Referenced by find_centre_of_gravity(), find_unweighted_centre_of_gravity(), and find_unweighted_centre_of_gravity().
| BasicCoordinate< num_dimensions, T > stir::find_centre_of_gravity | ( | const ArrayType< num_dimensions, T > & | ) |
Compute centre of gravity of an Array.
Calls find_unweighted_centre_of_gravity and divides the result with the sum of all the elements in the array.
References error(), find_centre_of_gravity(), find_unweighted_centre_of_gravity(), and sum().
Referenced by find_centre_of_gravity(), find_centre_of_gravity_in_mm(), and find_centre_of_gravity_in_mm_per_plane().
| void stir::find_centre_of_gravity_in_mm_per_plane | ( | VectorWithOffset< CartesianCoordinate3D< float > > & | allCoG, |
| VectorWithOffset< T > & | weights, | ||
| const VoxelsOnCartesianGrid< T > & | image ) |
Computes centre of gravity for each plane.
The result is in mm in STIR physical coordinates, i.e. taking the origin into account.
The result can be used to find the central line of a (uniform) object, for instance a cylinder. The output of this function can by used by linear_regression().
The weight is currently simply the sum of the voxel values in that plane, thresholded to be at least 0. If the weight is 0, the x,y coordinates are simply set to 0.
References find_centre_of_gravity(), find_centre_of_gravity_in_mm_per_plane(), stir::VectorWithOffset< T >::get_max_index(), stir::VectorWithOffset< T >::get_min_index(), stir::DiscretisedDensity< num_dimensions, elemT >::get_physical_coordinates_for_indices(), and sum().
Referenced by find_centre_of_gravity_in_mm_per_plane().
| CartesianCoordinate3D< float > stir::find_centre_of_gravity_in_mm | ( | const VoxelsOnCartesianGrid< T > & | image | ) |
Computes centre of gravity of an image.
The result is in mm in STIR physical coordinates, i.e. taking the origin into account.
References find_centre_of_gravity(), find_centre_of_gravity_in_mm(), and stir::DiscretisedDensity< num_dimensions, elemT >::get_physical_coordinates_for_indices().
Referenced by find_centre_of_gravity_in_mm(), stir::MatchTrackerAndScanner::run(), and stir::zoom_imageTests::run_tests().
|
inline |
A function that finds a scale factor to use when converting data to a new type.
The scale factor is such that (data_in / scale_factor) will fit in the maximum range for the output type.
When input and output types are identical, scale_factor is set to 1.
| scale_factor | a reference to a (float or double) variable which will be set to the scale factor such that (ignoring types) data_in == data_out * scale_factor
|
| data_in | some Array object, elements are of some numeric type T1 |
| info_for_out_type | T2 is the desired output type |
Note that there is an effective threshold at 0 currently (i.e. negative numbers are ignored) when T2 is an unsigned type.
References stir::Array< num_dimensions, elemT >::begin_all(), stir::Array< num_dimensions, elemT >::end_all(), and find_scale_factor().
Referenced by convert_range(), find_scale_factor(), find_scale_factor(), and write_data().
|
inline |
A function that returns a new Array (of the same dimension) with elements of type T2.
Result is (approximately) data_in / scale_factor.
| scale_factor | a reference to a (float or double) variable which will be set to the scale factor such that (ignoring types) data_in == data_out * scale_factor
|
| data_in | some Array object, elements are of some numeric type T1 |
| info2 | T2 is the desired output type |
When the output type is integer, rounding is used.
Note that there is an effective threshold at 0 currently (i.e. negative numbers are cut out) when T2 is an unsigned type.
References convert_array().
Referenced by convert_array(), convert_array(), stir::ecat::ecat6::DiscretisedDensity_to_ECAT6(), stir::ecat::ecat6::ProjData_to_ECAT6(), read_data(), and stir::convert_array_Tests::run_tests().
|
inline |
Converts the data_in Array to data_out (with elements of different types) such that data_in == data_out * scale_factor.
References stir::Array< num_dimensions, elemT >::begin_all(), convert_array(), convert_range(), and stir::Array< num_dimensions, elemT >::end_all().
|
inline |
A function that finds a scale factor to use when converting data to a new type.
This function works with input data given as an iterator range.
References find_scale_factor().
|
inline |
Converts the data in the input range to the output range (with elements of different types) such that data_in == data_out * scale_factor.
Note order of arguments. Output-range occurs first (as standard in STIR).
References convert_range(), find_scale_factor(), and round().
Referenced by convert_array(), convert_range(), and stir::convert_array_Tests::run_tests().
| int stir::index_at_maximum | ( | const VectorWithOffset< elemT > & | v | ) |
Finds the index where the maximum occurs in a (1-dimensional) vector.
If the maximum occurs more than once, the smallest index is returned.
If the vector is empty, the function returns 0.
References stir::VectorWithOffset< T >::get_max_index(), stir::VectorWithOffset< T >::get_min_index(), index_at_maximum(), and stir::VectorWithOffset< T >::size().
Referenced by index_at_maximum().
| BasicCoordinate< 3, int > stir::indices_at_maximum | ( | const Array< 3, elemT > & | input_array | ) |
Finds the first (3-dimensional) index where the maximum occurs in a (3-dimensional) array.
generalise to arbitrary dimensions
implementation currently cycles through the data twice
References stir::Array< num_dimensions, elemT >::find_max(), stir::VectorWithOffset< T >::get_max_index(), stir::VectorWithOffset< T >::get_min_index(), and indices_at_maximum().
Referenced by find_fwhm_in_image(), indices_at_maximum(), maximum_location_per_slice(), and stir::MatchTrackerAndScanner::run().