STIR
6.2.0
|
Modules | |
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::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::SeparableGaussianArrayFilterTests |
Tests SeparableGaussianArrayFilter functionalityCurrently only very basic tests on normalisation. More... | |
class | stir::SeparableMetzArrayFilterTests |
Tests SeparableMetzArrayFilter functionalityCurrently only very basic tests on normalisation. More... | |
Functions | |
template<class elemT > | |
Array< 1, elemT > & | stir::in_place_log (Array< 1, elemT > &v) |
Replace elements by their logarithm, 1D version. More... | |
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 More... | |
template<class elemT > | |
Array< 1, elemT > & | stir::in_place_exp (Array< 1, elemT > &v) |
Replace elements by their exponentiation, 1D version. More... | |
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 More... | |
template<class elemT > | |
Array< 1, elemT > & | stir::in_place_abs (Array< 1, elemT > &v) |
Replace elements by their absolute value, 1D version. More... | |
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 More... | |
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 More... | |
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. More... | |
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 More... | |
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. More... | |
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. More... | |
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. More... | |
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 More... | |
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. More... | |
template<int num_dimensions, class T > | |
BasicCoordinate< num_dimensions, T > | stir::find_unweighted_centre_of_gravity (const Array< num_dimensions, T > &) |
Compute centre of gravity of an Array but without dividing by its sum. More... | |
template<class T > | |
T | stir::find_unweighted_centre_of_gravity (const Array< 1, T > &) |
Compute centre of gravity of a 1D Array but without dividing by its sum. More... | |
template<int num_dimensions, class T > | |
BasicCoordinate< num_dimensions, T > | stir::find_centre_of_gravity (const Array< num_dimensions, T > &) |
Compute centre of gravity of an Array. More... | |
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. More... | |
template<class T > | |
CartesianCoordinate3D< float > | stir::find_centre_of_gravity_in_mm (const VoxelsOnCartesianGrid< T > &image) |
Computes centre of gravity of an image. More... | |
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. More... | |
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 . More... | |
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 . More... | |
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. More... | |
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 . More... | |
Replace elements by their logarithm, 1D version.
|
inline |
apply log to each element of the multi-dimensional array
Replace elements by their exponentiation, 1D version.
Referenced by stir::BinNormalisationFromAttenuationImage::apply(), and stir::BinNormalisationFromAttenuationImage::undo().
|
inline |
apply exp to each element of the multi-dimensional array
Replace elements by their absolute value, 1D version.
Referenced by stir::ReconstructionTests< target_type >::compare().
|
inline |
store absolute value of each element of the multi-dimensional array
|
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.
Referenced by stir::ScatterEstimation::process_data().
|
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 stir::VectorWithOffset< Array< num_dimensions - 1, elemT > >::get_max_index(), stir::VectorWithOffset< Array< num_dimensions - 1, elemT > >::get_min_index(), and stir::Array< num_dimensions, elemT >::is_regular().
Referenced by stir::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 stir::VectorWithOffset< Array< num_dimensions - 1, elemT > >::get_max_index(), stir::VectorWithOffset< Array< num_dimensions - 1, elemT > >::get_min_index(), and stir::Array< num_dimensions, elemT >::is_regular().
Referenced by stir::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 stir::VectorWithOffset< Array< num_dimensions - 1, elemT > >::begin(), stir::VectorWithOffset< Array< num_dimensions - 1, elemT > >::end(), and stir::in_place_apply_array_function_on_1st_index().
Referenced by stir::SeparableArrayFunctionObject< num_dimensions, elemT >::SeparableArrayFunctionObject().
|
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 stir::apply_array_function_on_1st_index(), stir::VectorWithOffset< Array< num_dimensions - 1, elemT > >::get_max_index(), stir::VectorWithOffset< Array< num_dimensions - 1, elemT > >::get_min_index(), stir::Array< num_dimensions, elemT >::get_regular_range(), and stir::Array< num_dimensions, elemT >::is_regular().
Referenced by stir::SeparableArrayFunctionObject< num_dimensions, elemT >::SeparableArrayFunctionObject().
|
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.
|
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 stir::VectorWithOffset< T >::get_max_index(), and stir::VectorWithOffset< T >::get_min_index().
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:
Referenced by stir::find_unweighted_centre_of_gravity().
BasicCoordinate< num_dimensions, T > stir::find_unweighted_centre_of_gravity | ( | const Array< 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:
References stir::VectorWithOffset< Array< num_dimensions - 1, elemT > >::size().
Referenced by stir::find_centre_of_gravity().
T stir::find_unweighted_centre_of_gravity | ( | const Array< 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 stir::find_unweighted_centre_of_gravity_1d().
BasicCoordinate< num_dimensions, T > stir::find_centre_of_gravity | ( | const Array< 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 stir::error(), stir::find_unweighted_centre_of_gravity(), stir::sum(), and stir::Array< num_dimensions, elemT >::sum().
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.
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.
Referenced by stir::MatchTrackerAndScanner::run().
|
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(), and stir::Array< num_dimensions, elemT >::end_all().
Referenced by stir::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.
Referenced by stir::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(), stir::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.
|
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).
Referenced by stir::convert_array(), and stir::convert_array_Tests::run_tests().