claraty::Image< T > Class Template Reference
[Data Structure]
#include <image.h>
Inheritance diagram for claraty::Image< T >:


Public Types | |
| enum | Interpolation_t { BILINEAR, NOINTERP, CHECK_BOUNDS } |
| enum | SIZE_TYPE { SQUARE, EQUALS, NCOLS_EQUALS_NROWS } |
| typedef T | value_type |
| typedef value_type * | pointer |
| typedef const value_type * | const_pointer |
| typedef N_2D_Array_Iterator< T > | iterator |
| typedef N_2D_Array_const_Iterator< T > | const_iterator |
| typedef value_type & | reference |
| typedef const value_type & | const_reference |
| typedef size_t | size_type |
| typedef ptrdiff_t | difference_type |
Public Member Functions | |
| template<class I, class R> | |
| void | bilinear_xy_ret (I x, I y, R &ret) const |
| template<class I, class R> | |
| void | bilinear_xy_ret (const N_2D_Point< I > &pt, R &ret) const |
| template<class I> | |
| double | bilinear_xy (I x, I y) const |
| template<class I> | |
| double | bilinear_xy (const N_2D_Point< I > &pt) const |
| virtual bool | io_headers (FDM_Map &map) |
| T * | get_raster () |
| const T * | get_raster () const |
| void | copy_into_columns (const Vector< T > *columns[]) |
| operator vnl_matrix_ref () | |
| Matrix & | operator+= (const T &rhs) |
| template<class rhsType> | |
| Matrix & | operator+= (const Matrix< rhsType > &rhs) |
| Matrix & | operator-= (const T &rhs) |
| template<class rhsType> | |
| Matrix & | operator-= (const Matrix< rhsType > &rhs) |
| Matrix & | operator *= (const T &rhs) |
| Matrix & | operator/= (const T &rhs) |
| Matrix | operator- () const |
| Matrix | transpose () const |
| T | sum_of_squares () const |
| Matrix | transpose_times (const Matrix< T > &B) const |
| Vector< T > | row (int r) const |
| Vector< T > | column (int c) const |
| T | min_value (int *min_row=NULL, int *min_col=NULL) const |
| T | max_value (int *max_row=NULL, int *max_col=NULL) const |
| Matrix | abs () const |
| T | average () const |
| T | sum () const |
| template<class In> | |
| N_2D_Array & | set_diagonal (int size, In start) |
| N_2D_Array & | set_diagonal (const N_2D_Array< T > &a) |
| int | get_size () const |
| int | ncols () const |
| int | get_num_of_cols () const |
| int | nrows () const |
| int | get_num_of_rows () const |
| bool | is_square () const |
| void | resize (int newNumRows, int newNumCols) |
| bool | is_subarray () const |
| iterator | begin () |
| const_iterator | begin () const |
| iterator | end () |
| const_iterator | end () const |
| N_2D_Array & | displace_subarray (int delta_x, int delta_y) |
| N_2D_Array & | resize_subarray (int left, int top, int width, int height) |
| N_2D_Array & | associate_subarray (const N_2D_Array &parent, int left, int top, int width, int height) |
| int | get_full_num_cols () const |
| int | get_full_num_rows () const |
| void | dissociate (int new_nrows=-1, int new_ncols=-1) |
| N_2D_Array< T > | get_row (int row) const |
| N_2D_Array< T > | get_col (int col) const |
| const T * | get_row_pointer (int row) const |
| iterator | column_iterator (int col) |
| const_iterator | column_iterator (int col) const |
| T & | operator() (int r, int c) |
| const T & | operator() (int r, int c) const |
| T & | rc (int row, int column) |
| const T & | rc (int row, int column) const |
| T & | xy (int x, int y) |
| const T & | xy (int x, int y) const |
| T & | xy (const N_2D_Point_i &p) |
| const T & | xy (const N_2D_Point_i &p) const |
| void | write (std::ostream &os) const |
| operator void * () const | |
| N_2D_Array | operator== (const N_2D_Array &rhs) const |
| bool | io (FDM_Map map) |
| int | get_width () const |
| int | get_height () const |
| void | set_interpolation_type (Interpolation_t itype) |
| Interpolation_t | get_interpolation_type () const |
| void | set_maximum_value (T val) |
| T | get_maximum_value () const |
| Get the maximum effective pixel value (not computed, nor enforced). | |
| double | pixel (double x, double y) const |
| template<class I> | |
| double | pixel (const N_2D_Point< I > &pt) const |
Protected Member Functions | |
| template<class BinOp> | |
| Matrix & | scalar_apply (BinOp op, const T &rhs) |
| T & | element (int i) |
| const T & | element (int i) const |
| T * | get_data () |
| const T * | get_data () const |
| template<class In> | |
| void | _copy (In start) |
| void | _copy (T filler) |
| template<class rhsType> | |
| int | _check_size (SIZE_TYPE type, const N_2D_Array< rhsType > &rhs) const |
| void | _init_special (int nr, int nc, T *data, int memwidth) |
| void | _drop_memory () |
| void | _init_index (bool allocate=true) |
| bool | _is_noncontiguous () const |
Protected Attributes | |
| int | _num_of_rows |
| int | _num_of_cols |
| int | _mem_width |
| int | _mem_height |
| T * | _elements |
| T ** | _index |
| T * | _mem_base |
| Reference_Count * | _ref_count |
| bool | _isSubarray |
Private Attributes | |
| Interpolation_t | _interpolation |
| T | maximum_value |
Detailed Description
template<class T>
class claraty::Image< T >
An Image templatized by pixel type. Image inherits from Matrix, which provides various math operations, and which in turn inherits from Array_2D, which provides accessors, and subarray functionality. Subimages can be created using the appropriate constructor, and moved/resized using functions inherited from Array_2D.Image adds the capability to access interpolated pixel values, through the pixel() function, and the set_interpolation_type function. Interpolation of INTERP_NONE simply returns the nearest pixel (rounds the (x,y) input); BILINEAR returns the bilinearly interpolated pixel.
Note that the superclasses accessor function, operator(), takes its parameters in row-major order. Pixels in images are typically accessed in column-major order, i.e. image(h, v), rather than image(row, col). Since operator() is inherited from parent classes, using this operator on images requires one to use row-major access, i.e. image(v, h) or image(row, col). For the more traditional argument ordering, use the pixel() function, which takes its arguments in column-major order, i.e. image.pixel(h, v), which is equivalent to image(v, h). Keep in mind, however, the Image is constructed with (width, height), which is opposite of the operator() pixel access, but equivalent to pixel(x,y) access.
Definition at line 126 of file image.h.
Member Typedef Documentation
typedef T claraty::N_2D_Array< T >::value_type [inherited] |
Definition at line 64 of file 2d_array.h.
typedef value_type* claraty::N_2D_Array< T >::pointer [inherited] |
Definition at line 65 of file 2d_array.h.
typedef const value_type* claraty::N_2D_Array< T >::const_pointer [inherited] |
Definition at line 66 of file 2d_array.h.
typedef N_2D_Array_Iterator<T> claraty::N_2D_Array< T >::iterator [inherited] |
Definition at line 67 of file 2d_array.h.
typedef N_2D_Array_const_Iterator<T> claraty::N_2D_Array< T >::const_iterator [inherited] |
Definition at line 68 of file 2d_array.h.
typedef value_type& claraty::N_2D_Array< T >::reference [inherited] |
Definition at line 69 of file 2d_array.h.
typedef const value_type& claraty::N_2D_Array< T >::const_reference [inherited] |
Definition at line 70 of file 2d_array.h.
typedef size_t claraty::N_2D_Array< T >::size_type [inherited] |
Definition at line 71 of file 2d_array.h.
typedef ptrdiff_t claraty::N_2D_Array< T >::difference_type [inherited] |
Definition at line 72 of file 2d_array.h.
Member Enumeration Documentation
| enum claraty::Image::Interpolation_t |
enum claraty::N_2D_Array::SIZE_TYPE [inherited] |
Constructor & Destructor Documentation
| claraty::Image< T >::Image | ( | ) | [inline] |
Creates an Image of zero width and height, and interpolation NOINTERP.
Definition at line 136 of file image.h.
00136 : Matrix<T>(), _interpolation(NOINTERP), 00137 maximum_value(0) { }
| claraty::Image< T >::Image | ( | int | nrows, | |
| int | ncols | |||
| ) | [inline] |
Constructs an Image of specified width and height, filling the Image with all zeros, and interpolation NOINTERP.
Definition at line 145 of file image.h.
00146 : Matrix<T>(nrows, ncols), _interpolation(NOINTERP), 00147 maximum_value(0) { }
| claraty::Image< T >::Image | ( | int | nrows, | |
| int | ncols, | |||
| In | start | |||
| ) | [inline] |
Constructs an Image of specified width and height, with specified fill value(s), and interpolation NOINTERP. examples: Image<char> my_image(640, 480, (char) 25); int my_array[] = {0,1,2,3,4,5}; Image<double> my_image(2, 3, my_array);
- Parameters:
-
[in] nrows The width of the Image. [in] ncols The height the height of the Image. [in] start Either a single value of type T, with which the Image will be filled, or any iterator accessible sequence (an array, iteratable vector, etc.)
Definition at line 162 of file image.h.
00163 : Matrix<T>(nrows, ncols, start), _interpolation(NOINTERP), 00164 maximum_value(0) { }
| claraty::Image< T >::Image | ( | const Image< T > & | rhs | ) | [inline] |
Copy constructor; does a deep copy of the Image on the right hand side to the new Image.
- Parameters:
-
[in] rhs The right hand side image from which a new Image is constructed.
Definition at line 171 of file image.h.
00172 : Matrix<T>(rhs), _interpolation(rhs._interpolation), 00173 maximum_value(rhs.maximum_value) { }
| claraty::Image< T >::Image | ( | const N_2D_Array< T > & | srcArray | ) | [inline] |
Definition at line 174 of file image.h.
00175 : Matrix<T>(srcArray), _interpolation(NOINTERP), 00176 maximum_value(0) { }
| claraty::Image< T >::Image | ( | const Image< T > & | parent, | |
| int | left, | |||
| int | top, | |||
| int | width, | |||
| int | height | |||
| ) | [inline] |
Constructs an Image (deep copy) from the subimage of another Image. An Image created from the subimage of another Image is a deep copy; all data is copied over so subsequent changes in the parent/child do not affect the other Image.
- Parameters:
-
[in] parent The parent Image. [in] left The left coordinate of upper left corner of subimage window. [in] top The top coordinate of upper left corner of subimage window. [in] width The width of the subimage window. [in] height The height of the subimage window.
Definition at line 189 of file image.h.
00190 : Matrix<T>(parent, left, top, width, height), 00191 _interpolation(parent._interpolation), 00192 maximum_value(parent.maximum_value) { }
| claraty::Image< T >::Image | ( | ) | [inline] |
Creates an Image of zero width and height, and interpolation NOINTERP.
Definition at line 136 of file image.h.
00136 : Matrix<T>(), _interpolation(NOINTERP), 00137 maximum_value(0) { }
| claraty::Image< T >::Image | ( | int | nrows, | |
| int | ncols | |||
| ) | [inline] |
Constructs an Image of specified width and height, filling the Image with all zeros, and interpolation NOINTERP.
Definition at line 145 of file image.h.
00146 : Matrix<T>(nrows, ncols), _interpolation(NOINTERP), 00147 maximum_value(0) { }
| claraty::Image< T >::Image | ( | int | nrows, | |
| int | ncols, | |||
| In | start | |||
| ) | [inline] |
Constructs an Image of specified width and height, with specified fill value(s), and interpolation NOINTERP. examples: Image<char> my_image(640, 480, (char) 25); int my_array[] = {0,1,2,3,4,5}; Image<double> my_image(2, 3, my_array);
- Parameters:
-
[in] nrows The width of the Image. [in] ncols The height the height of the Image. [in] start Either a single value of type T, with which the Image will be filled, or any iterator accessible sequence (an array, iteratable vector, etc.)
Definition at line 162 of file image.h.
00163 : Matrix<T>(nrows, ncols, start), _interpolation(NOINTERP), 00164 maximum_value(0) { }
| claraty::Image< T >::Image | ( | const Image< T > & | rhs | ) | [inline] |
Copy constructor; does a deep copy of the Image on the right hand side to the new Image.
- Parameters:
-
[in] rhs The right hand side image from which a new Image is constructed.
Definition at line 171 of file image.h.
00172 : Matrix<T>(rhs), _interpolation(rhs._interpolation), 00173 maximum_value(rhs.maximum_value) { }
| claraty::Image< T >::Image | ( | const N_2D_Array< T > & | srcArray | ) | [inline] |
Definition at line 174 of file image.h.
00175 : Matrix<T>(srcArray), _interpolation(NOINTERP), 00176 maximum_value(0) { }
| claraty::Image< T >::Image | ( | const Image< T > & | parent, | |
| int | left, | |||
| int | top, | |||
| int | width, | |||
| int | height | |||
| ) | [inline] |
Constructs an Image (deep copy) from the subimage of another Image. An Image created from the subimage of another Image is a deep copy; all data is copied over so subsequent changes in the parent/child do not affect the other Image.
- Parameters:
-
[in] parent The parent Image. [in] left The left coordinate of upper left corner of subimage window. [in] top The top coordinate of upper left corner of subimage window. [in] width The width of the subimage window. [in] height The height of the subimage window.
Definition at line 189 of file image.h.
00190 : Matrix<T>(parent, left, top, width, height), 00191 _interpolation(parent._interpolation), 00192 maximum_value(parent.maximum_value) { }
Member Function Documentation
| int claraty::Image< T >::get_width | ( | ) | const [inline] |
Returns the width of the Image (number of columns).
- Returns:
- the width of the Image (number of columns)
Definition at line 200 of file image.h.
Referenced by claraty::Camera::_verify_resize_image(), claraty::Rescale_Op< T >::filter(), claraty::Gamma_Op::gamma_correct(), and claraty::Image_IO_Pgm_Simple::save().
00200 { return this->get_num_of_cols(); }
| int claraty::Image< T >::get_height | ( | ) | const [inline] |
Returns the height of the Image (number of rows).
- Returns:
- the height of the Image (number of rows)
Definition at line 205 of file image.h.
Referenced by claraty::Camera::_verify_resize_image(), claraty::Image< T >::bilinear_xy_ret(), claraty::Rescale_Op< T >::filter(), claraty::Gamma_Op::gamma_correct(), and claraty::Image_IO_Pgm_Simple::save().
00205 { return this->get_num_of_rows(); }
| void claraty::Image< T >::set_interpolation_type | ( | Interpolation_t | itype | ) | [inline] |
Set the interpolation type to use when accessing a pixel in the Image. Interpolation type can by NOINTERP (return the nearest pixel) or BILINEAR (return a bilinearly interpolated pixel).
- Parameters:
-
[in] itype The interpolation type to use (NOINTERP, BILINEAR)
Definition at line 215 of file image.h.
Referenced by claraty::Resample_Op::resample().
00215 { 00216 _interpolation = itype; 00217 }
| Interpolation_t claraty::Image< T >::get_interpolation_type | ( | ) | const [inline] |
Returns the interpolation type being used by the Image.
- Returns:
- the interpolation type being used by the Image.
Definition at line 222 of file image.h.
00222 { return _interpolation; }
| void claraty::Image< T >::set_maximum_value | ( | T | val | ) | [inline] |
Set the effective maximum pixel value (not enforced) - this is the full saturated, or white reference value for this image.
Definition at line 228 of file image.h.
Referenced by claraty::Image_IO_Factory::load_image().
00228 { maximum_value = val; }
| T claraty::Image< T >::get_maximum_value | ( | ) | const [inline] |
Get the maximum effective pixel value (not computed, nor enforced).
Definition at line 231 of file image.h.
Referenced by claraty::Image_IO_Factory::compute_sigbits().
00231 { return maximum_value; }
| double claraty::Image< T >::pixel | ( | double | x, | |
| double | y | |||
| ) | const |
Returns the interpolated (according to interpolation type) pixel at x, y. This is more expensive than normal (non-interpolated operator(x,y)) access even w/ NOINTERP interpolation.
- Parameters:
-
[in] x The pixel x value to access (the column value). [in] y The pixel y value to access (the row value).
- Returns:
- The pixel at x,y, interpolated according to the current interpolation type (note: always a double, regardless of Image pixel type.
Definition at line 331 of file image.h.
References claraty::Image< T >::_interpolation, claraty::Image< T >::BILINEAR, claraty::Image< T >::bilinear_xy(), claraty::Image< T >::CHECK_BOUNDS, claraty::Image< T >::NOINTERP, and claraty::N_2D_Array< T >::xy().
Referenced by claraty::Image< T >::pixel(), and claraty::Resample_Op::resample().
00332 { 00333 switch (_interpolation) { 00334 case NOINTERP: 00335 return this->xy(static_cast<int>(x), static_cast<int>(y)); 00336 break; 00337 case CHECK_BOUNDS: 00338 if (x < 0 || y < 0 || static_cast<int>(ceil(x)) >= this->get_width() || 00339 static_cast<int>(ceil(y)) >= this->get_height()) 00340 return 0.0; 00341 return this->xy(static_cast<int>(x), static_cast<int>(y)); 00342 break; 00343 case BILINEAR: 00344 return bilinear_xy(x, y); 00345 break; 00346 default: 00347 // throw exception 00348 break; 00349 } 00350 return 0.0; 00351 }
Here is the call graph for this function:

| double claraty::Image< T >::pixel | ( | const N_2D_Point< I > & | pt | ) | const |
Definition at line 356 of file image.h.
References claraty::Image< T >::pixel(), claraty::N_2D_Point< T >::x(), and claraty::N_2D_Point< T >::y().
00356 { 00357 return this->pixel(pt.x(), pt.y()); 00358 }
Here is the call graph for this function:

| void claraty::Image< T >::bilinear_xy_ret | ( | I | x, | |
| I | y, | |||
| R & | ret | |||
| ) | const |
Definition at line 282 of file image.h.
References claraty::Image< T >::get_height(), and claraty::N_2D_Array< T >::xy().
Referenced by claraty::Image< T >::bilinear_xy(), and claraty::Image< T >::bilinear_xy_ret().
00283 { 00284 int x1 = static_cast<int>(ceil(x)); 00285 int y1 = static_cast<int>(ceil(y)); 00286 00287 if (x < 0 || y < 0 || x1 >= this->get_width() || y1 >= this->get_height()) { 00288 ret= 0.0; return; 00289 } 00290 00291 int x0 = static_cast<int>(x); // no need for floor, we checked for > 0 00292 int y0 = static_cast<int>(y); 00293 00294 double fx = x - x0; 00295 double fy = y - y0; 00296 00297 T p00 = this->xy(x0, y0), p01 = this->xy(x0, y1); 00298 00299 R fx0 = p00 + fx * (this->xy(x1, y0) - p00); 00300 R fx1 = p01 + fx * (this->xy(x1, y1) - p01); 00301 00302 ret= fx0 + fy * (fx1 - fx0); 00303 }
Here is the call graph for this function:

| void claraty::Image< T >::bilinear_xy_ret | ( | const N_2D_Point< I > & | pt, | |
| R & | ret | |||
| ) | const |
Definition at line 307 of file image.h.
References claraty::Image< T >::bilinear_xy_ret(), claraty::N_2D_Point< T >::x(), and claraty::N_2D_Point< T >::y().
00308 { 00309 bilinear_xy_ret(pt.x(), pt.y(), ret); 00310 }
Here is the call graph for this function:

Definition at line 314 of file image.h.
References claraty::Image< T >::bilinear_xy_ret().
Referenced by claraty::Image< T >::pixel().
00315 { 00316 double ret; 00317 bilinear_xy_ret(x, y, ret); 00318 return ret; 00319 }
Here is the call graph for this function:

| double claraty::Image< T >::bilinear_xy | ( | const N_2D_Point< I > & | pt | ) | const |
Definition at line 323 of file image.h.
References claraty::Image< T >::bilinear_xy_ret().
00324 { 00325 double ret; 00326 bilinear_xy_ret(pt, ret); 00327 return ret; 00328 }
Here is the call graph for this function:

| virtual bool claraty::Image< T >::io_headers | ( | FDM_Map & | map | ) | [inline, virtual] |
| T* claraty::Image< T >::get_raster | ( | ) | [inline] |
Definition at line 271 of file image.h.
Referenced by claraty::Convolve_Op< TEMPLATE_REFS >::filter(), claraty::Image_IO_Factory::move_raster_to_image(), claraty::Image_IO_Factory::rasterize_image(), claraty::RGB_Image< T >::RGB_Image(), and claraty::Image_IO_Pgm_Simple::save().
00271 { return this->get_data(); }
| const T* claraty::Image< T >::get_raster | ( | ) | const [inline] |
| void claraty::Matrix< T >::copy_into_columns | ( | const Vector< T > * | columns[] | ) | [inherited] |
Definition at line 446 of file matrix.h.
References claraty::N_2D_Array< T >::get_num_of_cols(), and claraty::N_2D_Array< T >::get_num_of_rows().
Referenced by claraty::Matrix< uint16_t >::Matrix(), and claraty::Matrix_NxM< T, Nrows, Ncols >::Matrix_NxM().
00447 { 00448 for (int i = 0; i < this->get_num_of_cols(); i++) 00449 for (int j = 0; j < this->get_num_of_rows(); j++) 00450 this->operator()(j, i) = (*columns[i])[j]; 00451 }
Here is the call graph for this function:

| claraty::Matrix< T >::operator vnl_matrix_ref | ( | ) | [inline, inherited] |
| Matrix& claraty::Matrix< T >::operator+= | ( | const T & | rhs | ) | [inline, inherited] |
Definition at line 137 of file matrix.h.
00137 { 00138 return scalar_apply(cl_plus<T>(), rhs); 00139 }
| Matrix& claraty::Matrix< T >::operator+= | ( | const Matrix< rhsType > & | rhs | ) | [inline, inherited] |
Definition at line 156 of file matrix.h.
00156 { 00157 if (_check_size(N_2D_Array<T>::EQUALS, rhs) == OK) 00158 cl_transform(rhs.begin(), rhs.end(), this->begin(), this->begin(), cl_plus<T>()); 00159 return *this; 00160 }
| Matrix& claraty::Matrix< T >::operator-= | ( | const T & | rhs | ) | [inline, inherited] |
Definition at line 140 of file matrix.h.
00140 { 00141 return scalar_apply(cl_minus<T>(), rhs); 00142 }
| Matrix& claraty::Matrix< T >::operator-= | ( | const Matrix< rhsType > & | rhs | ) | [inline, inherited] |
Definition at line 164 of file matrix.h.
00164 { 00165 if (_check_size(N_2D_Array<T>::EQUALS, rhs) == OK) 00166 cl_transform(this->begin(), this->end(), rhs.begin(), this->begin(), cl_minus<T>()); 00167 return *this; 00168 }
| Matrix& claraty::Matrix< T >::operator *= | ( | const T & | rhs | ) | [inline, inherited] |
Definition at line 143 of file matrix.h.
00143 { 00144 return scalar_apply(cl_multiplies<T>(), rhs); 00145 }
| Matrix& claraty::Matrix< T >::operator/= | ( | const T & | rhs | ) | [inline, inherited] |
Definition at line 146 of file matrix.h.
00146 { 00147 return scalar_apply(cl_divides<T>(), rhs); 00148 }
| Matrix< T > claraty::Matrix< T >::operator- | ( | ) | const [inline, inherited] |
Reimplemented in claraty::Matrix_NxM< T, Nrows, Ncols >.
Definition at line 485 of file matrix.h.
References claraty::N_2D_Array< T >::ncols(), and claraty::N_2D_Array< T >::nrows().
00486 { 00487 Matrix<T> tmp(*this); 00488 for (int r = 0; r < this->nrows(); r++) 00489 for (int c = 0; c < this->ncols(); c++) 00490 tmp(r, c) = -(*this)(r,c); 00491 return tmp; 00492 }
Here is the call graph for this function:

| Matrix< T > claraty::Matrix< T >::transpose | ( | ) | const [inherited] |
Reimplemented from claraty::N_2D_Array< T >.
Reimplemented in claraty::Matrix_NxM< T, Nrows, Ncols >.
Definition at line 312 of file matrix.h.
References claraty::N_2D_Array< T >::get_num_of_cols(), and claraty::N_2D_Array< T >::get_num_of_rows().
Referenced by claraty::RMatrix< T >::RMatrix().
00313 { 00314 Matrix tmp(this->get_num_of_cols(), this->get_num_of_rows()); 00315 N_2D_Array_Iterator<T> it = tmp.begin(); 00316 for (int i = 0; i < this->get_num_of_cols(); ++i) 00317 for (int j = 0; j < this->get_num_of_rows(); ++j, ++it) 00318 *it = this->operator()(j, i); 00319 return tmp; 00320 }
Here is the call graph for this function:

| T claraty::Matrix< T >::sum_of_squares | ( | ) | const [inherited] |
Definition at line 324 of file matrix.h.
References claraty::N_2D_Array< T >::begin(), and claraty::N_2D_Array< T >::end().
00325 { 00326 N_2D_Array_const_Iterator<T> it = this->begin(), last = this->end(); 00327 double f = 0.0; 00328 for (; it != last; ++it) 00329 f += (*it)*(*it); 00330 return static_cast<T>(f); 00331 }
Here is the call graph for this function:

| Matrix< T > claraty::Matrix< T >::transpose_times | ( | const Matrix< T > & | B | ) | const [inherited] |
Definition at line 383 of file matrix.h.
References claraty::N_2D_Array< T >::get_num_of_cols(), and claraty::N_2D_Array< T >::get_num_of_rows().
00384 { 00385 // For A'*B, A and B must have the same number of rows 00386 if (this->get_num_of_rows() != B.get_num_of_rows()){ 00387 // size mismatch 00388 std::cerr << "matrix::transpose_times: size mismatch" << std::endl; 00389 } else { 00390 // Multiply A' times B 00391 Matrix<T> result(this->get_num_of_cols(), B.get_num_of_cols()); 00392 00393 for (int i=0; i<this->get_num_of_cols(); i++){ 00394 for (int j=0; j<B.get_num_of_cols(); j++){ 00395 result(i,j) = 0.0; 00396 for (int k=0; k<this->get_num_of_rows(); k++){ 00397 result(i,j) += (*this)(k,i) * B(k,j); 00398 } 00399 } 00400 } 00401 return result; 00402 } 00403 Matrix<T> result; 00404 return result; 00405 }
Here is the call graph for this function:

| Vector<T> claraty::Matrix< T >::row | ( | int | r | ) | const [inline, inherited] |
Definition at line 174 of file matrix.h.
00174 { 00175 assert(r < this->nrows()); 00176 return Vector<T>(this->ncols(), this->get_row_pointer(r)); 00177 }
| Vector<T> claraty::Matrix< T >::column | ( | int | c | ) | const [inline, inherited] |
Definition at line 179 of file matrix.h.
00179 { 00180 assert(c < this->ncols()); 00181 return Vector<T>(this->nrows(), this->column_iterator(c), COL_VECTOR); 00182 }
| T claraty::Matrix< T >::min_value | ( | int * | min_row = NULL, |
|
| int * | min_col = NULL | |||
| ) | const [inline, inherited] |
Definition at line 234 of file matrix.h.
References claraty::N_2D_Array< T >::begin(), claraty::N_2D_Array< T >::end(), and claraty::N_2D_Array< T >::get_num_of_cols().
Referenced by claraty::Rescale_Op< T >::filter().
00235 { 00236 int min_index = 0; 00237 N_2D_Array_const_Iterator<T> it = this->begin(), last = this->end(); 00238 T min_value = *it; 00239 ++it; 00240 for (int i = 1; it != last; ++it, ++i) 00241 if (min_value > *it) { 00242 min_value = *it; 00243 min_index = i; 00244 } 00245 if (min_row != NULL) 00246 *min_row = min_index / this->get_num_of_cols(); 00247 if (min_col != NULL) 00248 *min_col = min_index % this->get_num_of_cols(); 00249 return min_value; 00250 }
Here is the call graph for this function:

| T claraty::Matrix< T >::max_value | ( | int * | max_row = NULL, |
|
| int * | max_col = NULL | |||
| ) | const [inline, inherited] |
Definition at line 253 of file matrix.h.
References claraty::N_2D_Array< T >::end(), claraty::N_2D_Array< T >::get_num_of_cols(), and claraty::N_2D_Array< T >::get_num_of_rows().
Referenced by claraty::Image_IO_Factory::compute_sigbits(), and claraty::Rescale_Op< T >::filter().
00254 { 00255 int max_index = 0; 00256 T max_value = 0; 00257 00258 // If non-zero size iterate over values to find the max, otherwise return 0 00259 if(this->get_num_of_cols() > 0 && this->get_num_of_rows() > 0) { 00260 N_2D_Array_const_Iterator<T> it = this->begin(), last = this->end(); 00261 max_value = *it; 00262 ++it; 00263 for (int i = 1; it != last; ++it, ++i) 00264 if (max_value < *it) { 00265 max_value = *it; 00266 max_index = i; 00267 } 00268 if (max_row != NULL) 00269 *max_row = max_index / this->get_num_of_cols(); 00270 if (max_col != NULL) 00271 *max_col = max_index % this->get_num_of_cols(); 00272 return max_value; 00273 } 00274 else { 00275 // Zero size 00276 if (max_row != NULL) 00277 *max_row = 0; 00278 if (max_col != NULL) 00279 *max_col = 0; 00280 return(0); 00281 } 00282 00283 }
Here is the call graph for this function:

| Matrix< T > claraty::Matrix< T >::abs | ( | ) | const [inline, inherited] |
Definition at line 287 of file matrix.h.
References claraty::cl_transform(), claraty::N_2D_Array< T >::end(), and claraty::N_2D_Array< T >::get_num_of_cols().
00288 { 00289 Matrix<T> tmp(this->get_num_of_rows(), this->get_num_of_cols()); 00290 cl_transform(this->begin(), this->end(), tmp.begin(), cl_abs_op<T>()); 00291 return tmp; 00292 }
Here is the call graph for this function:

| T claraty::Matrix< T >::average | ( | ) | const [inherited] |
Definition at line 296 of file matrix.h.
References claraty::cl_accumulate(), claraty::N_2D_Array< T >::end(), and claraty::Matrix< T >::sum().
00297 { 00298 T sum = 0; 00299 return cl_accumulate(this->begin(), this->end(), sum) / this->get_size(); 00300 }
Here is the call graph for this function:

| T claraty::Matrix< T >::sum | ( | ) | const [inherited] |
Definition at line 304 of file matrix.h.
References claraty::cl_accumulate(), and claraty::N_2D_Array< T >::end().
Referenced by claraty::Matrix< T >::average().
00305 { 00306 T sum = 0; 00307 return cl_accumulate(this->begin(), this->end(), sum); 00308 }
Here is the call graph for this function:

| Matrix& claraty::Matrix< T >::scalar_apply | ( | BinOp | op, | |
| const T & | rhs | |||
| ) | [inline, protected, inherited] |
Definition at line 194 of file matrix.h.
Referenced by claraty::Matrix< uint16_t >::operator *=(), claraty::Matrix< uint16_t >::operator+=(), claraty::Matrix< uint16_t >::operator-=(), and claraty::Matrix< uint16_t >::operator/=().
00194 { 00195 if (this->is_subarray()) 00196 cl_apply(*this, cl_bind2nd(op, rhs)); 00197 else 00198 cl_transform(this->get_data(), this->get_data() + this->get_size(), 00199 this->get_data(), cl_bind2nd(op, rhs)); 00200 return *this; 00201 }
| N_2D_Array< T > & claraty::N_2D_Array< T >::set_diagonal | ( | int | size, | |
| In | start | |||
| ) | [inherited] |
Definition at line 516 of file 2d_array.h.
References claraty::N_2D_Array< T >::_num_of_cols, and claraty::N_2D_Array< T >::is_square().
Referenced by claraty::Matrix< uint16_t >::Matrix(), and claraty::N_2D_Array< uint16_t >::set_diagonal().
00517 { 00518 if (!is_square()) 00519 std::cerr << "matrix error: cannot set diagonal on a non-square matrix" 00520 << std::endl; 00521 else if (size!=_num_of_cols) 00522 std::cerr << "matrix error: number of diagonal elements (" << size << ") " 00523 << "is not the same as matrix dimension of " << _num_of_cols 00524 << std::endl; 00525 else 00526 for (int i = 0; i < _num_of_cols; ++i, ++start) 00527 operator()(i, i) = *start; 00528 return *this; 00529 }
Here is the call graph for this function:

| N_2D_Array& claraty::N_2D_Array< T >::set_diagonal | ( | const N_2D_Array< T > & | a | ) | [inline, inherited] |
Definition at line 143 of file 2d_array.h.
00143 { 00144 return set_diagonal(a.get_size(), a.begin()); 00145 }
| int claraty::N_2D_Array< T >::get_size | ( | ) | const [inline, inherited] |
Definition at line 149 of file 2d_array.h.
Referenced by claraty::match_orientations(), claraty::operator *(), claraty::N_2D_Array< T >::operator==(), claraty::N_2D_Array< uint16_t >::resize(), claraty::Matrix< uint16_t >::scalar_apply(), and claraty::N_2D_Array< uint16_t >::set_diagonal().
00149 { return _num_of_rows*_num_of_cols; }
| int claraty::N_2D_Array< T >::ncols | ( | ) | const [inline, inherited] |
Definition at line 152 of file 2d_array.h.
Referenced by claraty::Matrix< uint16_t >::column(), claraty::N_2D_Array< uint16_t >::dissociate(), claraty::N_2D_Array< T >::io(), claraty::match_orientations(), claraty::Image_IO_Factory::move_raster_to_image(), claraty::operator *(), claraty::Matrix< uint16_t >::operator vnl_matrix_ref(), claraty::Matrix< T >::operator-(), claraty::Image_IO_Factory::rasterize_image(), claraty::RGB_Image< T >::RGB_Image(), claraty::Matrix< uint16_t >::row(), and claraty::Image_IO_Factory::save_image().
00152 { return _num_of_cols; }
| int claraty::N_2D_Array< T >::get_num_of_cols | ( | ) | const [inline, inherited] |
Definition at line 153 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_check_size(), claraty::Matrix< T >::abs(), claraty::cat_col(), claraty::cat_row(), claraty::Stereovision::compute_point_image(), claraty::Matrix< T >::copy_into_columns(), claraty::Transform_Op< T >::filter(), claraty::Non_Maxima_Sup_Op::filter(), claraty::Convolve_Op< TEMPLATE_REFS >::filter(), claraty::Image< uint16_t >::get_width(), claraty::Resample_Op::halfsample(), claraty::inverse(), claraty::matrix_cholesky(), claraty::matrix_cholesky_backsubstitute(), claraty::Matrix< T >::max_value(), claraty::Matrix< T >::min_value(), claraty::operator *(), claraty::N_2D_Array< T >::operator=(), claraty::Resample_Op::resample(), claraty::RMatrix< T >::RMatrix(), claraty::to_float(), claraty::Matrix< T >::transpose(), claraty::Matrix< T >::transpose_times(), and claraty::N_2D_Array< T >::write().
00153 { return _num_of_cols; }
| int claraty::N_2D_Array< T >::nrows | ( | ) | const [inline, inherited] |
Definition at line 156 of file 2d_array.h.
Referenced by claraty::Matrix< uint16_t >::column(), claraty::N_2D_Array< uint16_t >::dissociate(), claraty::N_2D_Array< T >::io(), claraty::match_orientations(), claraty::Image_IO_Factory::move_raster_to_image(), claraty::operator *(), claraty::Matrix< uint16_t >::operator vnl_matrix_ref(), claraty::Matrix< T >::operator-(), claraty::Image_IO_Factory::rasterize_image(), claraty::RGB_Image< T >::RGB_Image(), claraty::Matrix< uint16_t >::row(), and claraty::Image_IO_Factory::save_image().
00156 { return _num_of_rows; }
| int claraty::N_2D_Array< T >::get_num_of_rows | ( | ) | const [inline, inherited] |
Definition at line 157 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_check_size(), claraty::cat_col(), claraty::cat_row(), claraty::Stereovision::compute_point_image(), claraty::Matrix< T >::copy_into_columns(), claraty::Transform_Op< T >::filter(), claraty::Non_Maxima_Sup_Op::filter(), claraty::Convolve_Op< TEMPLATE_REFS >::filter(), claraty::Image< uint16_t >::get_height(), claraty::Resample_Op::halfsample(), claraty::matrix_cholesky(), claraty::matrix_cholesky_backsubstitute(), claraty::Matrix< T >::max_value(), claraty::operator *(), claraty::N_2D_Array< T >::operator=(), claraty::Resample_Op::resample(), claraty::RMatrix< T >::RMatrix(), claraty::to_float(), claraty::Matrix< T >::transpose(), claraty::Matrix< T >::transpose_times(), and claraty::N_2D_Array< T >::write().
00157 { return _num_of_rows; }
| bool claraty::N_2D_Array< T >::is_square | ( | ) | const [inline, inherited] |
Definition at line 159 of file 2d_array.h.
Referenced by claraty::det(), claraty::inverse(), and claraty::N_2D_Array< T >::set_diagonal().
00159 { return _num_of_rows == _num_of_cols; }
| void claraty::N_2D_Array< T >::resize | ( | int | newNumRows, | |
| int | newNumCols | |||
| ) | [inline, inherited] |
Reimplemented in claraty::Matrix_NxM< T, Nrows, Ncols >.
Definition at line 168 of file 2d_array.h.
Referenced by claraty::Camera::_verify_resize_image(), claraty::N_2D_Array< uint16_t >::dissociate(), claraty::Transform_Op< T >::filter(), claraty::Rescale_Op< T >::filter(), claraty::Non_Maxima_Sup_Op::filter(), claraty::Convolve_Op< TEMPLATE_REFS >::filter(), claraty::Gamma_Op::gamma_correct(), claraty::Resample_Op::halfsample(), claraty::Image_IO_Pgm_Simple::load(), claraty::Image_IO_Factory::load_image(), claraty::Wheel_Locomotor_Model::map_mechanism_model_to_wheel_locomotor_model(), claraty::Mass_Properties::Mass_Properties(), claraty::Matrix< uint16_t >::operator=(), claraty::N_2D_Array< T >::operator=(), and claraty::Resample_Op::resample().
00168 { 00169 if (_num_of_rows != newNumRows || _num_of_cols != newNumCols) { 00170 if (_isSubarray) { 00171 std::cerr << "N_2D_Array::resize cannot be used on a subarray!" 00172 << std::endl; 00173 // throw exception 00174 } else if (_ref_count->get_value() != 1) { 00175 std::cerr << "N_2D_Array::resize cannot be used on an array being " 00176 "shared by subarrays" << std::endl; 00177 // throw exception 00178 } else if (get_size() == newNumRows * newNumCols && 00179 get_size() != 0) { 00180 delete [] _index; 00181 _num_of_rows = newNumRows; 00182 _num_of_cols = newNumCols; 00183 _mem_width = newNumCols; 00184 _mem_height = newNumRows; 00185 _init_index(true); 00186 } else { 00187 // total array size is different - reallocate everything. technically, 00188 // we could check the number of rows, and save a new/delete cycle on 00189 // the _index, but it's not that big of a deal if we're reallocating 00190 // the underlying data space anyway. 00191 delete [] _mem_base; 00192 delete [] _index; 00193 _init(newNumRows, newNumCols); 00194 } 00195 } 00196 }
| bool claraty::N_2D_Array< T >::is_subarray | ( | ) | const [inline, inherited] |
Definition at line 198 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_copy(), claraty::N_2D_Array< uint16_t >::get_data(), claraty::N_2D_Array< T >::N_2D_Array(), claraty::Image_IO_Factory::rasterize_image(), claraty::RGB_Image< T >::RGB_Image(), and claraty::Image_IO_Pgm_Simple::save().
00198 { return _isSubarray; }
| iterator claraty::N_2D_Array< T >::begin | ( | ) | [inline, inherited] |
Definition at line 201 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_copy(), claraty::Tsai_Camera_Model::io(), claraty::Matrix_NxM< T, Nrows, Ncols >::Matrix_NxM(), claraty::Matrix< T >::min_value(), claraty::N_2D_Array< T >::N_2D_Array(), claraty::N_2D_Array< T >::operator void *(), claraty::operator+(), claraty::Matrix< uint16_t >::operator+=(), claraty::operator-(), claraty::Matrix< uint16_t >::operator-=(), claraty::N_2D_Array< T >::operator=(), claraty::N_2D_Array< T >::operator==(), claraty::N_2D_Array< uint16_t >::set_diagonal(), claraty::Matrix< T >::sum_of_squares(), claraty::to_float(), and claraty::N_2D_Array< T >::transpose().
00201 { 00202 return iterator(_elements, _is_noncontiguous(), _num_of_cols, _mem_width); 00203 }
| const_iterator claraty::N_2D_Array< T >::begin | ( | ) | const [inline, inherited] |
Definition at line 204 of file 2d_array.h.
00204 { 00205 return const_iterator(_elements, _is_noncontiguous(), _num_of_cols, 00206 _mem_width); 00207 }
| iterator claraty::N_2D_Array< T >::end | ( | ) | [inline, inherited] |
Definition at line 208 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_copy(), claraty::Matrix< T >::abs(), claraty::Matrix< T >::average(), claraty::Matrix< T >::max_value(), claraty::Matrix< T >::min_value(), claraty::N_2D_Array< T >::operator void *(), claraty::Matrix< uint16_t >::operator+=(), claraty::operator-(), claraty::Matrix< uint16_t >::operator-=(), claraty::Matrix< T >::sum(), claraty::Matrix< T >::sum_of_squares(), and claraty::to_float().
00208 { 00209 return iterator(_elements + _num_of_rows * _mem_width, 00210 _is_noncontiguous(), _num_of_cols, _mem_width); 00211 }
| const_iterator claraty::N_2D_Array< T >::end | ( | ) | const [inline, inherited] |
Definition at line 212 of file 2d_array.h.
00212 { 00213 return const_iterator(_elements + _num_of_rows * _mem_width, 00214 _is_noncontiguous(), _num_of_cols, _mem_width); 00215 }
| N_2D_Array< T > & claraty::N_2D_Array< T >::displace_subarray | ( | int | delta_x, | |
| int | delta_y | |||
| ) | [inherited] |
Definition at line 534 of file 2d_array.h.
References claraty::N_2D_Array< T >::_elements, claraty::N_2D_Array< T >::_index, claraty::N_2D_Array< T >::_isSubarray, claraty::N_2D_Array< T >::_mem_width, and claraty::N_2D_Array< T >::_num_of_rows.
00535 { 00536 if (!_isSubarray) { // @@ This should throw an exception 00537 std::cerr << "N_2D_Array::displace_subarray requires *this to be a subarray!" 00538 << std::endl; 00539 return *this; 00540 } 00541 size_t offset = delta_y * _mem_width + delta_x; 00542 _elements += offset; 00543 for (int i = 0; i < _num_of_rows; i++) 00544 _index[i] += offset; 00545 return *this; 00546 }
| N_2D_Array< T > & claraty::N_2D_Array< T >::resize_subarray | ( | int | left, | |
| int | top, | |||
| int | width, | |||
| int | height | |||
| ) | [inherited] |
Definition at line 550 of file 2d_array.h.
References claraty::N_2D_Array< T >::_elements, claraty::N_2D_Array< T >::_index, claraty::N_2D_Array< T >::_init_index(), claraty::N_2D_Array< T >::_isSubarray, claraty::N_2D_Array< T >::_mem_base, claraty::N_2D_Array< T >::_mem_width, claraty::N_2D_Array< T >::_num_of_cols, and claraty::N_2D_Array< T >::_num_of_rows.
00552 { 00553 if (!_isSubarray) { // @@ This should throw an exception 00554 std::cerr << "N_2D_Array::resize_subarray requires *this to be a subarray!" 00555 << std::endl; 00556 return *this; 00557 } 00558 _num_of_cols = width; 00559 _elements = _mem_base + top * _mem_width + left; 00560 if (height == _num_of_rows) { 00561 // same number of rows - don't reallocate the _index 00562 _init_index(false); 00563 } else { 00564 _num_of_rows = height; 00565 delete [] _index; 00566 _init_index(); 00567 } 00568 return *this; 00569 }
Here is the call graph for this function:

| N_2D_Array< T > & claraty::N_2D_Array< T >::associate_subarray | ( | const N_2D_Array< T > & | parent, | |
| int | left, | |||
| int | top, | |||
| int | width, | |||
| int | height | |||
| ) | [inherited] |
Definition at line 573 of file 2d_array.h.
References claraty::N_2D_Array< T >::_elements, claraty::N_2D_Array< T >::_index, claraty::N_2D_Array< T >::_init_index(), claraty::N_2D_Array< T >::_isSubarray, claraty::N_2D_Array< T >::_mem_base, claraty::N_2D_Array< T >::_mem_height, claraty::N_2D_Array< T >::_mem_width, claraty::N_2D_Array< T >::_num_of_cols, claraty::N_2D_Array< T >::_num_of_rows, claraty::N_2D_Array< T >::_ref_count, and claraty::Reference_Count::increment().
00576 { 00577 if (_isSubarray || _elements != NULL || _index != NULL) { 00578 std::cerr << "N_2D_Array::associate_subarray: this function can only be used " 00579 "on uninitialized arrays" << std::endl; 00580 return *this; 00581 } 00582 delete _ref_count; 00583 _ref_count = parent._ref_count; 00584 _ref_count->increment(); 00585 _isSubarray = true; 00586 00587 _num_of_rows = height; 00588 _num_of_cols = width; 00589 _mem_width = parent._mem_width; 00590 _mem_height = parent._mem_height; 00591 _mem_base = parent._mem_base; 00592 _elements = parent._elements + top * _mem_width + left; 00593 _init_index(); 00594 return *this; 00595 }
Here is the call graph for this function:

| int claraty::N_2D_Array< T >::get_full_num_cols | ( | ) | const [inline, inherited] |
| int claraty::N_2D_Array< T >::get_full_num_rows | ( | ) | const [inline, inherited] |
| void claraty::N_2D_Array< T >::dissociate | ( | int | new_nrows = -1, |
|
| int | new_ncols = -1 | |||
| ) | [inline, inherited] |
Definition at line 251 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::io().
00251 { 00252 int nrows = new_nrows, ncols = new_ncols; 00253 if(nrows < 0) { 00254 nrows = _num_of_rows; 00255 } 00256 if(ncols < 0) { 00257 ncols = _num_of_cols; 00258 } 00259 00260 if (_isSubarray) { 00261 _isSubarray = false; 00262 _num_of_rows = 0; // force re-allocation / compaction 00263 _num_of_cols = 0; 00264 } 00265 if (_ref_count->get_value() != 1) { 00266 _ref_count->decrement(); 00267 _mem_base = 0; // to prevent destruction of shared space on resize 00268 _num_of_rows = 0; // force re-allocation 00269 _num_of_cols = 0; 00270 _ref_count = new Reference_Count(1); // get an independent reference count 00271 } 00272 // Resize if necessary 00273 if((nrows != _num_of_rows) || (ncols != _num_of_cols)) { 00274 resize(nrows, ncols); 00275 } 00276 }
| N_2D_Array< T > claraty::N_2D_Array< T >::get_row | ( | int | row | ) | const [inherited] |
Definition at line 600 of file 2d_array.h.
References claraty::N_2D_Array< T >::_index, claraty::N_2D_Array< T >::_num_of_cols, and claraty::N_2D_Array< T >::_num_of_rows.
00601 { 00602 if (row < 0 || row > _num_of_rows) { 00603 std::cerr << "array error: row " << row << " exceeds matrix number of rows = " 00604 << _num_of_cols << std::endl; 00605 return N_2D_Array<T>(); 00606 } 00607 else 00608 return N_2D_Array<T>(1, _num_of_cols, _index[row]); 00609 }
| N_2D_Array< T > claraty::N_2D_Array< T >::get_col | ( | int | col | ) | const [inherited] |
Definition at line 613 of file 2d_array.h.
References claraty::N_2D_Array< T >::_num_of_cols, and claraty::N_2D_Array< T >::_num_of_rows.
00614 { 00615 if (col < 0 || col > _num_of_cols) { 00616 std::cerr << "array error: col " << col << " exceeds matrix number of columns = " 00617 << _num_of_cols << std::endl; 00618 return N_2D_Array<T>(); 00619 } 00620 else { 00621 N_2D_Array<T> col_array(_num_of_rows, 1); 00622 for (int row = 0; row < _num_of_rows; row++) 00623 col_array(row, 0) = operator()(row, col); 00624 return col_array; 00625 } 00626 }
| const T* claraty::N_2D_Array< T >::get_row_pointer | ( | int | row | ) | const [inline, inherited] |
Definition at line 283 of file 2d_array.h.
Referenced by claraty::operator *(), and claraty::Matrix< uint16_t >::row().
00283 { return _index[row]; }
| iterator claraty::N_2D_Array< T >::column_iterator | ( | int | col | ) | [inline, inherited] |
Definition at line 285 of file 2d_array.h.
Referenced by claraty::Matrix< uint16_t >::column(), and claraty::operator *().
00285 { 00286 return iterator(_elements + col, true, 1, _mem_width); 00287 }
| const_iterator claraty::N_2D_Array< T >::column_iterator | ( | int | col | ) | const [inline, inherited] |
Definition at line 288 of file 2d_array.h.
00288 { 00289 return const_iterator(_elements + col, true, 1, _mem_width); 00290 }
| T& claraty::N_2D_Array< T >::operator() | ( | int | r, | |
| int | c | |||
| ) | [inline, inherited] |
Reimplemented in claraty::Matrix_NxM< T, Nrows, Ncols >.
Definition at line 296 of file 2d_array.h.
Referenced by claraty::N_2D_Array< uint16_t >::rc(), and claraty::N_2D_Array< uint16_t >::xy().
00296 { return _index[r][c]; }
| const T& claraty::N_2D_Array< T >::operator() | ( | int | r, | |
| int | c | |||
| ) | const [inline, inherited] |
Reimplemented in claraty::Matrix_NxM< T, Nrows, Ncols >.
Definition at line 297 of file 2d_array.h.
00297 { return _index[r][c]; }
| T& claraty::N_2D_Array< T >::rc | ( | int | row, | |
| int | column | |||
| ) | [inline, inherited] |
Definition at line 301 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::write().
00301 { return operator()(row, column); }
| const T& claraty::N_2D_Array< T >::rc | ( | int | row, | |
| int | column | |||
| ) | const [inline, inherited] |
| T& claraty::N_2D_Array< T >::xy | ( | int | x, | |
| int | y | |||
| ) | [inline, inherited] |
Definition at line 304 of file 2d_array.h.
Referenced by claraty::Image< T >::bilinear_xy_ret(), claraty::Image< T >::pixel(), and claraty::N_2D_Array< uint16_t >::xy().
00304 { return operator()(y, x); }
| const T& claraty::N_2D_Array< T >::xy | ( | int | x, | |
| int | y | |||
| ) | const [inline, inherited] |
| T& claraty::N_2D_Array< T >::xy | ( | const N_2D_Point_i & | p | ) | [inline, inherited] |
| const T& claraty::N_2D_Array< T >::xy | ( | const N_2D_Point_i & | p | ) | const [inline, inherited] |
| void claraty::N_2D_Array< T >::write | ( | std::ostream & | os | ) | const [inherited] |
Definition at line 697 of file 2d_array.h.
References claraty::N_2D_Array< T >::get_num_of_cols(), claraty::N_2D_Array< T >::get_num_of_rows(), and claraty::N_2D_Array< T >::rc().
00698 { 00699 std::ios::fmtflags oldBase; 00700 int oldPrecision; 00701 00702 os << "size: (" << get_num_of_rows() << ", " << get_num_of_cols() 00703 << " )" << std::endl; 00704 os.setf(std::ios::showpoint); 00705 00706 if (sizeof(T)==1) { 00707 oldBase = os.setf(std::ios::hex, std::ios::basefield); 00708 } 00709 else { 00710 oldPrecision = os.precision(); 00711 os.precision(4); 00712 } 00713 00714 if (get_num_of_cols() != 0) 00715 for (int i = 0; i < get_num_of_rows(); ++i) { 00716 os << "[ "; 00717 for (int j = 0; j < get_num_of_cols(); ++j) { 00718 const T& el = rc(i, j); 00719 os << " " << std::setw(8) << el; 00720 } 00721 os << " ]" << std::endl; 00722 } 00723 if (sizeof(T)==1) 00724 os.setf(oldBase, std::ios::basefield); 00725 else 00726 os.precision(oldPrecision); 00727 }
Here is the call graph for this function:

| claraty::N_2D_Array< T >::operator void * | ( | ) | const [inherited] |
Definition at line 630 of file 2d_array.h.
References claraty::N_2D_Array< T >::begin(), and claraty::N_2D_Array< T >::end().
00631 { 00632 // Bool operator but using void * instead to avoid direct conversion to int 00633 // so when you type 3*array, you do not get 3, rather you get a compile error 00634 00635 for (const_iterator it = begin(); it != end(); ++it) 00636 if (*it == 0) 00637 return (void *)false; 00638 return (void *)true; 00639 }
Here is the call graph for this function:

| N_2D_Array< T > claraty::N_2D_Array< T >::operator== | ( | const N_2D_Array< T > & | rhs | ) | const [inherited] |
Definition at line 678 of file 2d_array.h.
References claraty::N_2D_Array< T >::_check_size(), claraty::N_2D_Array< T >::_num_of_cols, claraty::N_2D_Array< T >::_num_of_rows, claraty::N_2D_Array< T >::begin(), claraty::N_2D_Array< T >::EQUALS, ERROR, claraty::N_2D_Array< T >::get_size(), and claraty::N_2D_Array< T >::N_2D_Array().
00679 { 00680 if (this == &rhs) return N_2D_Array(_num_of_rows, _num_of_cols, (T)true); 00681 00682 if (_check_size(EQUALS, rhs) == ERROR) { 00683 // MUST THROW AN EXCEPTION HERE, BUT FOR NOW 00684 return N_2D_Array(1, 1, (T)false); 00685 } 00686 00687 N_2D_Array result(_num_of_rows, _num_of_cols); 00688 const_iterator it_lhs = begin(), it_rhs = rhs.begin(); 00689 iterator it_res = result.begin(); 00690 for (int i = 0; i < get_size(); ++i, ++it_lhs, ++it_rhs, ++it_res) 00691 *it_res = (*it_lhs == *it_rhs); 00692 return result; 00693 }
Here is the call graph for this function:

| bool claraty::N_2D_Array< T >::io | ( | FDM_Map | map | ) | [inherited] |
Reimplemented in claraty::Camera_Image< Pixel_Type >, claraty::Camera_Image< float >, and claraty::Camera_Image< uint16_t >.
Definition at line 806 of file 2d_array.h.
References claraty::N_2D_Array< T >::_index, claraty::N_2D_Array< T >::dissociate(), claraty::FDM_Array::element(), claraty::FDM_Map::field(), claraty::FDM_Map::field_node(), claraty::FDM_Map::is_read(), claraty::N_2D_Array< T >::ncols(), and claraty::N_2D_Array< T >::nrows().
Referenced by claraty::io_object().
00807 { 00808 int nr = nrows(), nc = ncols(); 00809 00810 bool ok = true; 00811 00812 ok &= map.field("nrows", nr); 00813 ok &= map.field("ncols", nc); 00814 00815 // If we're reading, dissociate from any sharing and set to the new 00816 // size. If the memory isn't shared and the size hasn't changed, 00817 // this does nothing. 00818 if (map.is_read()) { 00819 dissociate(nr, nc); 00820 } 00821 00822 FDM_Array a = map.field_node("elements"); 00823 00824 for (int r = 0; r < nr; r++) 00825 for (int c = 0; c < nc; c++) 00826 ok &= a.element(_index[r][c]); 00827 00828 return ok; 00829 }
Here is the call graph for this function:

| T& claraty::N_2D_Array< T >::element | ( | int | i | ) | [inline, protected, inherited] |
Definition at line 331 of file 2d_array.h.
Referenced by claraty::N_1D_Array< T >::operator()(), and claraty::N_1D_Array< T >::operator[]().
00331 { return _elements[i]; }
| const T& claraty::N_2D_Array< T >::element | ( | int | i | ) | const [inline, protected, inherited] |
| T* claraty::N_2D_Array< T >::get_data | ( | ) | [inline, protected, inherited] |
Definition at line 336 of file 2d_array.h.
Referenced by claraty::Image< uint16_t >::get_raster(), claraty::Matrix< uint16_t >::operator vnl_matrix_ref(), and claraty::Matrix< uint16_t >::scalar_apply().
00336 { assert(!is_subarray()); return _mem_base; }
| const T* claraty::N_2D_Array< T >::get_data | ( | ) | const [inline, protected, inherited] |
| void claraty::N_2D_Array< T >::_copy | ( | In | start | ) | [protected, inherited] |
Definition at line 448 of file 2d_array.h.
References claraty::N_2D_Array< T >::_elements, claraty::N_2D_Array< T >::_num_of_cols, claraty::N_2D_Array< T >::_num_of_rows, claraty::N_2D_Array< T >::begin(), claraty::N_2D_Array< T >::end(), and claraty::N_2D_Array< T >::is_subarray().
Referenced by claraty::Matrix_NxM< T, Nrows, Ncols >::Matrix_NxM(), claraty::N_2D_Array< T >::N_2D_Array(), claraty::N_2D_Array< uint16_t >::N_2D_Array(), claraty::Matrix_NxM< T, Nrows, Ncols >::operator=(), claraty::Matrix< uint16_t >::operator=(), and claraty::N_2D_Array< T >::operator=().
00449 { 00450 if (is_subarray()) { 00451 iterator it = begin(), last = end(); 00452 for (; it != last; ++it, ++start) 00453 *it = (int)*start; // compiler warning *it is an int 00454 } else { 00455 T *it = _elements, *last = _elements + _num_of_rows * _num_of_cols; 00456 for (; it != last; ++it, ++start) 00457 *it = (int)*start; // compiler waring *it is an int 00458 } 00459 }
Here is the call graph for this function:

| void claraty::N_2D_Array< T >::_copy | ( | T | filler | ) | [protected, inherited] |
Definition at line 463 of file 2d_array.h.
References claraty::N_2D_Array< T >::begin(), and claraty::N_2D_Array< T >::end().
00464 { 00465 iterator it = begin(), last = end(); 00466 for (; it != last; ++it) 00467 *it = filler; 00468 }
Here is the call graph for this function:

| int claraty::N_2D_Array< T >::_check_size | ( | SIZE_TYPE | type, | |
| const N_2D_Array< rhsType > & | rhs | |||
| ) | const [protected, inherited] |
Definition at line 770 of file 2d_array.h.
References claraty::N_2D_Array< T >::_num_of_cols, claraty::N_2D_Array< T >::_num_of_rows, claraty::N_2D_Array< T >::EQUALS, ERROR, claraty::N_2D_Array< T >::get_num_of_cols(), claraty::N_2D_Array< T >::get_num_of_rows(), claraty::N_2D_Array< T >::NCOLS_EQUALS_NROWS, OK, and claraty::N_2D_Array< T >::SQUARE.
Referenced by claraty::Matrix_NxM< T, Nrows, Ncols >::Matrix_NxM(), claraty::Matrix< uint16_t >::operator+=(), claraty::Matrix< uint16_t >::operator-=(), and claraty::N_2D_Array< T >::operator==().
00772 { 00773 int status = ERROR; 00774 00775 switch (operation) { 00776 case EQUALS: 00777 status = ((_num_of_rows == rhs.get_num_of_rows()) && 00778 (_num_of_cols == rhs.get_num_of_cols())) ? OK : ERROR; 00779 break; 00780 case NCOLS_EQUALS_NROWS: 00781 status = (_num_of_cols == rhs.get_num_of_rows()) ? OK : ERROR; 00782 break; 00783 case SQUARE: 00784 status = (_num_of_rows == _num_of_cols) ? OK : ERROR; 00785 break; 00786 } // switch 00787 00788 if (status==ERROR) 00789 std::cerr << "Array 2D error: array dimensions do not match lhs(" << _num_of_rows 00790 << "x" << _num_of_cols << "), rhs (" << rhs.get_num_of_rows() << "x" 00791 << rhs.get_num_of_cols() << ")" << std::endl; 00792 00793 return status; 00794 }
Here is the call graph for this function:

| void claraty::N_2D_Array< T >::_init_special | ( | int | nr, | |
| int | nc, | |||
| T * | data, | |||
| int | memwidth | |||
| ) | [protected, inherited] |
Definition at line 387 of file 2d_array.h.
References claraty::N_2D_Array< T >::_elements, claraty::N_2D_Array< T >::_init_index(), claraty::N_2D_Array< T >::_mem_base, claraty::N_2D_Array< T >::_mem_width, claraty::N_2D_Array< T >::_num_of_cols, and claraty::N_2D_Array< T >::_num_of_rows.
Referenced by claraty::Matrix_NxM< T, Nrows, Ncols >::_init().
00388 { 00389 _num_of_rows = n_rows; 00390 _num_of_cols = n_cols; 00391 _mem_width = memwidth; 00392 00393 _elements = data; 00394 _mem_base = data; 00395 00396 _init_index(); 00397 }
Here is the call graph for this function:

| void claraty::N_2D_Array< T >::_drop_memory | ( | ) | [inline, protected, inherited] |
Definition at line 355 of file 2d_array.h.
Referenced by claraty::Matrix_NxM< T, Nrows, Ncols >::~Matrix_NxM().
| void claraty::N_2D_Array< T >::_init_index | ( | bool | allocate = true |
) | [protected, inherited] |
Definition at line 429 of file 2d_array.h.
References claraty::N_2D_Array< T >::_elements, claraty::N_2D_Array< T >::_index, claraty::N_2D_Array< T >::_mem_width, and claraty::N_2D_Array< T >::_num_of_rows.
Referenced by claraty::N_2D_Array< T >::_init(), claraty::N_2D_Array< T >::_init_special(), claraty::N_2D_Array< T >::associate_subarray(), claraty::N_2D_Array< T >::N_2D_Array(), claraty::N_2D_Array< uint16_t >::resize(), and claraty::N_2D_Array< T >::resize_subarray().
00430 { 00431 // Allocate memory for the row pointers. These are needed to address the 00432 // individual elements of the matrix using the index ** 00433 00434 typedef T* p_T; 00435 00436 if (allocate) 00437 _index = new p_T[_num_of_rows]; 00438 00439 // Initialize index vector that points to the beginning of every row 00440 int i; 00441 T *p_row; 00442 for (i = 0, p_row = _elements; i < _num_of_rows; i++, p_row += _mem_width) 00443 _index[i]= p_row; 00444 }
| bool claraty::N_2D_Array< T >::_is_noncontiguous | ( | ) | const [inline, protected, inherited] |
Definition at line 367 of file 2d_array.h.
Referenced by claraty::N_2D_Array< uint16_t >::begin(), and claraty::N_2D_Array< uint16_t >::end().
00367 { 00368 return _num_of_cols != _mem_width; 00369 }
Member Data Documentation
Interpolation_t claraty::Image< T >::_interpolation [private] |
Definition at line 275 of file image.h.
Referenced by claraty::Image< uint16_t >::get_interpolation_type(), claraty::Image< T >::pixel(), and claraty::Image< uint16_t >::set_interpolation_type().
T claraty::Image< T >::maximum_value [private] |
Definition at line 276 of file image.h.
Referenced by claraty::Image< uint16_t >::get_maximum_value(), and claraty::Image< uint16_t >::set_maximum_value().
int claraty::N_2D_Array< T >::_num_of_rows [protected, inherited] |
Definition at line 77 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_check_size(), claraty::N_2D_Array< T >::_copy(), claraty::N_2D_Array< T >::_init(), claraty::N_2D_Array< T >::_init_index(), claraty::N_2D_Array< T >::_init_special(), claraty::N_2D_Array< T >::associate_subarray(), claraty::N_2D_Array< T >::displace_subarray(), claraty::N_2D_Array< uint16_t >::dissociate(), claraty::N_2D_Array< uint16_t >::end(), claraty::N_2D_Array< T >::get_col(), claraty::N_2D_Array< uint16_t >::get_num_of_rows(), claraty::N_2D_Array< T >::get_row(), claraty::N_2D_Array< uint16_t >::get_size(), claraty::N_2D_Array< uint16_t >::is_square(), claraty::N_2D_Array< T >::N_2D_Array(), claraty::N_2D_Array< uint16_t >::nrows(), claraty::N_2D_Array< T >::operator==(), claraty::N_2D_Array< uint16_t >::resize(), claraty::N_2D_Array< T >::resize_subarray(), and claraty::N_2D_Array< T >::transpose().
int claraty::N_2D_Array< T >::_num_of_cols [protected, inherited] |
Definition at line 77 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_check_size(), claraty::N_2D_Array< T >::_copy(), claraty::N_2D_Array< T >::_init(), claraty::N_2D_Array< T >::_init_special(), claraty::N_2D_Array< uint16_t >::_is_noncontiguous(), claraty::N_2D_Array< T >::associate_subarray(), claraty::N_2D_Array< uint16_t >::begin(), claraty::N_2D_Array< uint16_t >::dissociate(), claraty::N_2D_Array< uint16_t >::end(), claraty::N_2D_Array< T >::get_col(), claraty::N_2D_Array< uint16_t >::get_num_of_cols(), claraty::N_2D_Array< T >::get_row(), claraty::N_2D_Array< uint16_t >::get_size(), claraty::N_2D_Array< uint16_t >::is_square(), claraty::N_2D_Array< T >::N_2D_Array(), claraty::N_2D_Array< uint16_t >::ncols(), claraty::N_2D_Array< T >::operator==(), claraty::N_2D_Array< uint16_t >::resize(), claraty::N_2D_Array< T >::resize_subarray(), claraty::N_2D_Array< T >::set_diagonal(), and claraty::N_2D_Array< T >::transpose().
int claraty::N_2D_Array< T >::_mem_width [protected, inherited] |
Definition at line 77 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_init(), claraty::N_2D_Array< T >::_init_index(), claraty::N_2D_Array< T >::_init_special(), claraty::N_2D_Array< uint16_t >::_is_noncontiguous(), claraty::N_2D_Array< T >::associate_subarray(), claraty::N_2D_Array< uint16_t >::begin(), claraty::N_2D_Array< uint16_t >::column_iterator(), claraty::N_2D_Array< T >::displace_subarray(), claraty::N_2D_Array< uint16_t >::end(), claraty::N_2D_Array< uint16_t >::get_full_num_cols(), claraty::N_2D_Array< T >::N_2D_Array(), claraty::N_2D_Array< uint16_t >::resize(), and claraty::N_2D_Array< T >::resize_subarray().
int claraty::N_2D_Array< T >::_mem_height [protected, inherited] |
Definition at line 77 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_init(), claraty::N_2D_Array< T >::associate_subarray(), claraty::N_2D_Array< uint16_t >::get_full_num_rows(), and claraty::N_2D_Array< uint16_t >::resize().
T* claraty::N_2D_Array< T >::_elements [protected, inherited] |
Definition at line 79 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_copy(), claraty::N_2D_Array< uint16_t >::_drop_memory(), claraty::N_2D_Array< T >::_init(), claraty::N_2D_Array< T >::_init_index(), claraty::N_2D_Array< T >::_init_special(), claraty::N_2D_Array< T >::associate_subarray(), claraty::N_2D_Array< uint16_t >::begin(), claraty::N_2D_Array< uint16_t >::column_iterator(), claraty::N_2D_Array< T >::displace_subarray(), claraty::N_2D_Array< uint16_t >::element(), claraty::N_2D_Array< uint16_t >::end(), claraty::N_2D_Array< T >::N_2D_Array(), and claraty::N_2D_Array< T >::resize_subarray().
T** claraty::N_2D_Array< T >::_index [protected, inherited] |
Definition at line 80 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_init(), claraty::N_2D_Array< T >::_init_index(), claraty::N_2D_Array< T >::associate_subarray(), claraty::N_2D_Array< T >::displace_subarray(), claraty::N_2D_Array< T >::get_row(), claraty::N_2D_Array< uint16_t >::get_row_pointer(), claraty::N_2D_Array< T >::io(), claraty::N_2D_Array< uint16_t >::operator()(), claraty::N_2D_Array< uint16_t >::resize(), claraty::N_2D_Array< T >::resize_subarray(), and claraty::N_2D_Array< uint16_t >::~N_2D_Array().
T* claraty::N_2D_Array< T >::_mem_base [protected, inherited] |
Definition at line 82 of file 2d_array.h.
Referenced by claraty::N_2D_Array< uint16_t >::_drop_memory(), claraty::N_2D_Array< T >::_init(), claraty::N_2D_Array< T >::_init_special(), claraty::N_2D_Array< T >::associate_subarray(), claraty::N_2D_Array< uint16_t >::dissociate(), claraty::N_2D_Array< uint16_t >::get_data(), claraty::N_2D_Array< uint16_t >::resize(), claraty::N_2D_Array< T >::resize_subarray(), and claraty::N_2D_Array< uint16_t >::~N_2D_Array().
Reference_Count* claraty::N_2D_Array< T >::_ref_count [protected, inherited] |
Definition at line 83 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::associate_subarray(), claraty::N_2D_Array< uint16_t >::dissociate(), claraty::N_2D_Array< T >::N_2D_Array(), claraty::N_2D_Array< uint16_t >::N_2D_Array(), claraty::N_2D_Array< uint16_t >::resize(), and claraty::N_2D_Array< uint16_t >::~N_2D_Array().
bool claraty::N_2D_Array< T >::_isSubarray [protected, inherited] |
Definition at line 85 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_init(), claraty::N_2D_Array< T >::associate_subarray(), claraty::N_2D_Array< T >::displace_subarray(), claraty::N_2D_Array< uint16_t >::dissociate(), claraty::N_2D_Array< uint16_t >::is_subarray(), claraty::N_2D_Array< T >::N_2D_Array(), claraty::N_2D_Array< uint16_t >::N_2D_Array(), claraty::N_2D_Array< uint16_t >::resize(), and claraty::N_2D_Array< T >::resize_subarray().
The documentation for this class was generated from the following file: