Template class for managing 3D matrices. This class is based on boost multi_array. This class is primarily aimed at providing support for 3D bitmap images. See GridD for general spatial grids if that is what you are after.
Check MultiArray class for a list of added functionality
Inheritance diagram for IMP::algebra::Matrix3D< T >:Public Types | |
|
typedef boost::multi_array_types::index | index |
| typedef MultiArray< T, 3 > | MA3 |
| typedef Matrix3D< T > | This |
Public Types inherited from IMP::algebra::MultiArray< T, 3 > | |
| typedef boost::multi_array< T, D > | BMA |
|
typedef boost::multi_array_types::size_type | size_type |
Public Member Functions | |
| Matrix3D () | |
| Empty constructor. | |
| Matrix3D (int Zdim, int Ydim, int Xdim) | |
| Constructor. | |
| Matrix3D (const This &v) | |
| template<typename T1 > | |
| void | cast_values (Matrix3D< T1 > &out) |
| Cast values. | |
| bool | get_is_valid () const |
| std::string | get_name () const |
| int | get_number_of_columns () const |
| Returns the number of columns in the matrix. | |
| int | get_number_of_rows () const |
| Returns the number of rows in the matrix. | |
| int | get_number_of_slices () const |
| Returns the number of slices in the matrix. | |
| T & | operator() (int k, int j, int i) const |
| template<typename T1 > | |
| T & | operator() (T1 &idx) const |
| This | operator* (const This &v) const |
| Multiplication operator. | |
| This | operator* (const T &v) const |
| Multiplication operator for an array and a scalar. | |
| This & | operator*= (const This &v) |
| Multiplication operator. | |
| This & | operator*= (const T &v) |
| Multiplication operator for an array and a scalar. | |
| This | operator+ (const This &v) const |
| Sum operator. | |
| This | operator+ (const T &v) const |
| Sum operator for an array and a scalar. | |
| This & | operator+= (const This &v) |
| Addition operator. | |
| This & | operator+= (const T &v) |
| Addition operator for an array and a scalar. | |
| This | operator- (const This &v) const |
| Minus operator. | |
| This | operator- (const T &v) const |
| Minus operator for an array and a scalar. | |
| This & | operator-= (const This &v) |
| Substraction operator. | |
| This & | operator-= (const T &v) |
| Substraction operator for an array and a scalar. | |
| This | operator/ (const This &v) const |
| Division operator. | |
| This | operator/ (const T &v) const |
| Division operator for an array and a scalar. | |
| This & | operator/= (const This &v) |
| Division operator. | |
| This & | operator/= (const T &v) |
| Division operator for an array and a scalar. | |
| void | operator= (const This &v) |
| void | pad (This &padded, T val) |
| void | pad (This &padded) |
| template<typename T1 > | |
| void | reshape (const Matrix3D< T1 > &v) |
| Reshapes the matrix copying the size and range of a given one. | |
| void | resize (int Zdim, int Ydim, int Xdim) |
| Resizes the matrix. | |
| template<typename T1 > | |
| void | resize (const Matrix3D< T1 > &v) |
| Resizes the matrix copying the size of a given one. | |
| void | show (std::ostream &out=std::cout) const |
Public Member Functions inherited from IMP::algebra::MultiArray< T, 3 > | |
| MultiArray () | |
| Empty constructor. | |
| bool | almost_equal (const double a, const double b, const double epsilon) |
| void | centered_start () |
| double | compute_avg () const |
| Average of the values in the array. | |
| T | compute_max () const |
| Maximum of the values in the array. | |
| T | compute_max (T1 &max_idx) const |
| Maximum of the values in the array. | |
| T | compute_min () const |
| Minimum of the values in the array. | |
| T | compute_min (T1 &min_idx) const |
| Minimum of the values in the array. | |
| void | compute_stats (double &avg, double &stddev, T &minval, T &maxval) const |
| Compute average, standard deviation, minimum and maximum values. | |
| double | compute_stddev () const |
| Standard deviation of the values in the array. | |
| void | copy (This &v) |
| void | copy_with_casting (MultiArray< U, D > &v) |
| Copy with casting. Use with care! | |
| double | cross_correlation_coefficient (const This &v, bool apply_threshold=false, double threshold=0.0, bool divide_by_stddev=true, bool force_recalc_stats=true, double avg=0.0, double stddev=0.0, double avg_v=0.0, double stddev_v=0.0) |
| Computes the cross correlation coeffcient between two MultiArrays. | |
| void | fill_with_value (T val=0) |
| Fill all the voxels of the array with a given value. | |
| bool | first_element () const |
| Returns the first element. | |
| int | get_finish (const int dim) const |
| int | get_size (const int dim) const |
| int | get_start (const int dim) const |
| void | init_zeros () |
| All the values of the array are set to zero. | |
| bool | is_logical_element (T1 &v) const |
| Returns true if the LOGICAL index belongs to those of the matrix. | |
| bool | is_physical_element (T1 &v) const |
| Returns true if the PHYSICAL index belongs to those of the matrix. | |
| bool | is_void () const |
| Check if the array has some dimensionality or is just empty. | |
| void | normalize () |
| This | operator* (const This &v) const |
| Multiplication operator. | |
| void | operator*= (const This &v) const |
| Multiplication operator. | |
| void | operator*= (const T &v) const |
| Multiplication operator for an array and a scalar. | |
| This | operator+ (const This &v) const |
| Sum operator. | |
| void | operator+= (const This &v) const |
| Addition operator. | |
| void | operator+= (const T &v) const |
| Addition operator for an array and a scalar. | |
| This | operator- (const This &v) const |
| Minus operator. | |
| void | operator-= (const This &v) const |
| Substraction operator. | |
| void | operator-= (const T &v) const |
| Substraction operator for an array and a scalar. | |
| This | operator/ (const This &v) const |
| Division operator. | |
| void | operator/= (const This &v) const |
| Division operator. | |
| void | operator/= (const T &v) const |
| Division operator for an array and a scalar. | |
| void | print_shape (std::ostream &out=std::cout) const |
| Print shape of multidimensional array. | |
| void | read (const std::string &filename) |
| Read from an ASCII file. | |
| void | read_binary (const std::string &filename, bool reversed=false) |
| Read from a binary file. | |
| void | read_binary (std::ifstream &input, bool reversed=false) |
| Read from a input stream in binary mode. | |
| bool | same_shape (const MultiArray< T1, D > &b) const |
| Compares the shape of two multidimensional arrays. | |
| bool | same_size (const MultiArray< T1, D > &b) const |
| Compares the size of two multidimensional arrays. | |
| bool | same_start (const MultiArray< T1, D > &b) const |
| Compares the origin of two multidimensional arrays. | |
| void | set_start (const int dim, const int value) |
| void | set_start (const T1 &v) |
| T | squared_difference (const This &v) const |
| T | sum_elements () const |
| Computes the sum of all the array elements. | |
| T | sum_squared_elements () const |
| void | write (const std::string &filename) const |
| Write to an ASCII file. | |
| void | write_binary (const std::string &filename, bool reversed=false) |
| Write to a binary file. | |
| void | write_binary (std::ofstream &out, bool reversed=false) |
| Write to a output stream in binary mode. | |
Friends | |
| This | operator* (const T &X, const This &a1) |
| Multiplication operator for a scalar and an array. | |
| This | operator+ (const T &X, const This &a1) |
| Sum operator for a scalar and an array. | |
| This | operator- (const T &X, const This &a1) |
| Minus operator for a scalar and an array. | |
| This | operator/ (const T &X, const This &a1) |
| Division operator for a scalar and an array. | |
| IMP::algebra::Matrix3D< T >::Matrix3D | ( | ) |
Empty constructor.
| IMP::algebra::Matrix3D< T >::Matrix3D | ( | int | Zdim, |
| int | Ydim, | ||
| int | Xdim | ||
| ) |
Constructor.
| void IMP::algebra::Matrix3D< T >::cast_values | ( | Matrix3D< T1 > & | out | ) |
Cast values.
| int IMP::algebra::Matrix3D< T >::get_number_of_columns | ( | ) | const |
Returns the number of columns in the matrix.
| int IMP::algebra::Matrix3D< T >::get_number_of_rows | ( | ) | const |
Returns the number of rows in the matrix.
| int IMP::algebra::Matrix3D< T >::get_number_of_slices | ( | ) | const |
Returns the number of slices in the matrix.
| T& IMP::algebra::Matrix3D< T >::operator() | ( | int | k, |
| int | j, | ||
| int | i | ||
| ) | const |
Access operator. The returned element is the LOGICAL element of the matrix, NOT the direct one
| [in] | k | first index |
| [in] | j | second index |
| [in] | i | third index |
| T& IMP::algebra::Matrix3D< T >::operator() | ( | T1 & | idx | ) | const |
Access operator. The returned element is the LOGICAL element of the matrix, NOT the direct one
| [in] | idx | must be a class supporting access via [] |
| This IMP::algebra::Matrix3D< T >::operator* | ( | const This & | v | ) | const |
Multiplication operator.
| This IMP::algebra::Matrix3D< T >::operator* | ( | const T & | v | ) | const |
Multiplication operator for an array and a scalar.
Reimplemented from IMP::algebra::MultiArray< T, 3 >.
| This& IMP::algebra::Matrix3D< T >::operator*= | ( | const This & | v | ) |
Multiplication operator.
| This& IMP::algebra::Matrix3D< T >::operator*= | ( | const T & | v | ) |
Multiplication operator for an array and a scalar.
| This IMP::algebra::Matrix3D< T >::operator+ | ( | const This & | v | ) | const |
Sum operator.
| This IMP::algebra::Matrix3D< T >::operator+ | ( | const T & | v | ) | const |
Sum operator for an array and a scalar.
Reimplemented from IMP::algebra::MultiArray< T, 3 >.
| This& IMP::algebra::Matrix3D< T >::operator+= | ( | const This & | v | ) |
Addition operator.
| This& IMP::algebra::Matrix3D< T >::operator+= | ( | const T & | v | ) |
Addition operator for an array and a scalar.
| This IMP::algebra::Matrix3D< T >::operator- | ( | const This & | v | ) | const |
Minus operator.
| This IMP::algebra::Matrix3D< T >::operator- | ( | const T & | v | ) | const |
Minus operator for an array and a scalar.
Reimplemented from IMP::algebra::MultiArray< T, 3 >.
| This& IMP::algebra::Matrix3D< T >::operator-= | ( | const This & | v | ) |
Substraction operator.
| This& IMP::algebra::Matrix3D< T >::operator-= | ( | const T & | v | ) |
Substraction operator for an array and a scalar.
| This IMP::algebra::Matrix3D< T >::operator/ | ( | const This & | v | ) | const |
Division operator.
| This IMP::algebra::Matrix3D< T >::operator/ | ( | const T & | v | ) | const |
Division operator for an array and a scalar.
Reimplemented from IMP::algebra::MultiArray< T, 3 >.
| This& IMP::algebra::Matrix3D< T >::operator/= | ( | const This & | v | ) |
Division operator.
| This& IMP::algebra::Matrix3D< T >::operator/= | ( | const T & | v | ) |
Division operator for an array and a scalar.
| void IMP::algebra::Matrix3D< T >::pad | ( | This & | padded, |
| T | val | ||
| ) |
Pad with a given value. Padding is defined as doubling the size in each dimension and fill the new values with the value.
| [out] | padded | the output MultiArray |
| [in] | val | the value to pad with |
| void IMP::algebra::Matrix3D< T >::pad | ( | This & | padded | ) |
Pad the MultiArray. Padding is defined as doubling the size in each dimension and fill the new values with the previous average value.
| [in] | padded | the MultiArray padded |
| void IMP::algebra::Matrix3D< T >::reshape | ( | const Matrix3D< T1 > & | v | ) |
Reshapes the matrix copying the size and range of a given one.
| [in] | v | Matrix3D whose shape to copy |
| void IMP::algebra::Matrix3D< T >::resize | ( | int | Zdim, |
| int | Ydim, | ||
| int | Xdim | ||
| ) |
Resizes the matrix.
| [in] | Zdim | Number of slices |
| [in] | Ydim | Number of rows |
| [in] | Xdim | Number of columns |
| void IMP::algebra::Matrix3D< T >::resize | ( | const Matrix3D< T1 > & | v | ) |
Resizes the matrix copying the size of a given one.
| [in] | v | Matrix3D whose size to copy |
Multiplication operator for a scalar and an array.
Sum operator for a scalar and an array.
Minus operator for a scalar and an array.
Division operator for a scalar and an array.