ODIN
|
#include <data.h>
Public Member Functions | |
Data (const TinyVector< int, N_rank > &dimvec, const T &val=0) | |
Data (const STD_string &filename, bool readonly, const TinyVector< int, N_rank > &shape, LONGEST_INT offset=0) | |
Data (const Data< T, N_rank > &d) | |
Data (const Array< T, N_rank > &a) | |
Data (const tjarray< tjvector< T >, T > &a) | |
template<class T_expr > | |
Data (BZ_ETPARM(_bz_ArrayExpr< T_expr >) expr) | |
~Data () | |
Data< T, N_rank > & | operator= (const Data< T, N_rank > &d) |
Data< T, N_rank > & | operator= (const Array< T, N_rank > &a) |
Data< T, N_rank > & | operator= (const T &val) |
template<class T_expr > | |
Data< T, N_rank > & | operator= (BZ_ETPARM(_bz_ArrayExpr< T_expr >) expr) |
Data< T, N_rank > & | operator= (const tjarray< tjvector< T >, T > &a) |
int | read (const STD_string &format, const STD_string &filename, LONGEST_INT offset=0) |
template<typename T2 > | |
int | read (const STD_string &filename, LONGEST_INT offset=0) |
int | write (const STD_string &format, const STD_string &filename, bool autoscale=true) const |
template<typename T2 > | |
int | write (const STD_string &filename, bool autoscale=true) const |
int | write (const STD_string &filename, fopenMode mode=overwriteMode) const |
int | write_asc_file (const STD_string &filename, const Array< T, N_rank > &pre=defaultArray, const Array< T, N_rank > &post=defaultArray) const |
int | read_asc_file (const STD_string &filename) |
int | autowrite (const STD_string &filename, const FileWriteOpts &opts=FileWriteOpts(), const Protocol *prot=0) const |
int | autoread (const STD_string &filename, const FileReadOpts &opts=FileReadOpts(), Protocol *prot=0, ProgressMeter *progmeter=0) |
bool | is_filemapped () const |
operator tjarray< tjvector< T >, T > () const | |
TinyVector< int, N_rank > | create_index (unsigned long index) const |
unsigned long | create_linear_index (const TinyVector< int, N_rank > &indexvec) const |
void | shift (unsigned int shift_dim, int shift) |
void | congrid (const TinyVector< int, N_rank > &newshape, const TinyVector< float, N_rank > *subpixel_shift=0, bool left_to_right=false) |
template<typename T2 , int N_rank2> | |
Data< T2, N_rank2 > & | convert_to (Data< T2, N_rank2 > &dst, bool autoscale=true) const |
T * | c_array () |
This template class holds multidimensional data. In addition to functionality provided by the Blitz Array class, it offers methods to read/write raw data and and other file formats (nifti, vtk, ...) to/from a file. In addition, uing a special constructor, the array can be associated with a block of data on disk using the UNIX mmap functionality. In this case, any changes made to the array will be automatically tranfered to the file. Please note that any attempt to resize such an array will most likely cause a segmentation fault.
Definition at line 148 of file odindata/data.h.
|
inline |
Constructs an array with the given dimensionality and initial value
Definition at line 156 of file odindata/data.h.
Data< T, N_rank >::Data | ( | const STD_string & | filename, |
bool | readonly, | ||
const TinyVector< int, N_rank > & | shape, | ||
LONGEST_INT | offset = 0 |
||
) |
Maps the given file 'filename' into the newly created array via the the mmap function, see the mmap man page for details. The mapping is abolish when the array is destroyed (destructor). Other parameters:
Definition at line 502 of file odindata/data.h.
Copy constructor
Definition at line 185 of file odindata/data.h.
Copy constructor from Blitz::Array
Definition at line 190 of file odindata/data.h.
|
inline |
Constructor from an equivalent tjarray (Arrays). If rank of 'a' is smaller, extent will pe padded with 1 at front.
Definition at line 195 of file odindata/data.h.
|
inline |
Constructor from expression template
Definition at line 209 of file odindata/data.h.
Destructor
Definition at line 535 of file odindata/data.h.
int Data< T, N_rank >::autoread | ( | const STD_string & | filename, |
const FileReadOpts & | opts = FileReadOpts() , |
||
Protocol * | prot = 0 , |
||
ProgressMeter * | progmeter = 0 |
||
) |
Reads data set from file 'filename' assuming the format automatically detected by the given file extension. Extra options can be given by 'opts' and protocol settings will be stored in 'prot'. The progress meter 'progmeter' can be optionally specified to monitor the progress of the operation. Returns number of slices successfully read, or -1 if it fails.
Definition at line 757 of file odindata/data.h.
int Data< T, N_rank >::autowrite | ( | const STD_string & | filename, |
const FileWriteOpts & | opts = FileWriteOpts() , |
||
const Protocol * | prot = 0 |
||
) | const |
Writes data set to file 'filename' in the format automatically detected by the given file extension. Extra options can be given by 'opts' and protocol settings can be overwritten by 'prot'. Returns number of slices, or -1 if it fails.
Definition at line 751 of file odindata/data.h.
T * Data< T, N_rank >::c_array |
Makes array unique and continuous and returns pointer to data
Definition at line 972 of file odindata/data.h.
void Data< T, N_rank >::congrid | ( | const TinyVector< int, N_rank > & | newshape, |
const TinyVector< float, N_rank > * | subpixel_shift = 0 , |
||
bool | left_to_right = false |
||
) |
Interpolate (or extrapolate) the data in the array to the new shape. The interpolation is performed dimension-by-dimension using the GSL spline interpolation routines. Add extra shift 'subpixel_shift' in units of pixels on the destination grid if 'subpixel_shift' is non-null. if 'left_to_right' is set to true, interpolation starts at the most left dimension, i.e. at those with the highest index, down to the lowest index. If set to false, interpolation is performed vice versa.
Definition at line 884 of file odindata/data.h.
Data< T2, N_rank2 > & Data< T, N_rank >::convert_to | ( | Data< T2, N_rank2 > & | dst, |
bool | autoscale = true |
||
) | const |
Converts the array to type 'T2', with dimensionality 'N_rank2' and stores the result in 'dst'. 'dst' will be unique, i.e. no other references to the array exist. In addition to changing 'dst', a reference to the same array is returned for convenience. If 'autoscale' is true, use full range of integer values (if applicable).
Definition at line 783 of file odindata/data.h.
TinyVector< int, N_rank > Data< T, N_rank >::create_index | ( | unsigned long | index | ) | const |
Creates an index vector according to a linear index for the whole array by taking the shape into account.
Definition at line 827 of file odindata/data.h.
unsigned long Data< T, N_rank >::create_linear_index | ( | const TinyVector< int, N_rank > & | indexvec | ) | const |
Creates a linear index from an index vector
Definition at line 834 of file odindata/data.h.
|
inline |
Returns true if the array is associated with a file on disk
Definition at line 357 of file odindata/data.h.
Exports this array into an equivalent tjarray (Arrays)
Definition at line 768 of file odindata/data.h.
|
inline |
Assignment operator for expression templates
Definition at line 249 of file odindata/data.h.
|
inline |
Assignment operator from Blitz::Array
Definition at line 227 of file odindata/data.h.
|
inline |
Assignment operator
Definition at line 222 of file odindata/data.h.
|
inline |
Fills all elements with 'val'
Definition at line 232 of file odindata/data.h.
Data< T, N_rank > & Data< T, N_rank >::operator= | ( | const tjarray< tjvector< T >, T > & | a | ) |
Assignment from an equivalent tjarray (Arrays). If rank of 'a' is smaller, extent will pe padded with 1 at front.
Definition at line 557 of file odindata/data.h.
int Data< T, N_rank >::read | ( | const STD_string & | filename, |
LONGEST_INT | offset = 0 |
||
) |
Reads the array from a raw data file 'filename' of type 'T2'. No resizing is performed prior to reading. Skip the first 'offset' bytes.
Definition at line 596 of file odindata/data.h.
int Data< T, N_rank >::read | ( | const STD_string & | format, |
const STD_string & | filename, | ||
LONGEST_INT | offset = 0 |
||
) |
Reads the array from a raw data file 'filename' of type 'format' which can be one of 's8bit, u8bit, s16bit, u16bit, s32bit, u32bit, float or double'. No resizing is performed prior to reading. Skip the first 'offset' bytes.
Definition at line 577 of file odindata/data.h.
int Data< T, N_rank >::read_asc_file | ( | const STD_string & | filename | ) |
reads in white-space separated data from ASCII file, no resizing is performed prior to reading Return value is -1 if an error occurs.
Definition at line 727 of file odindata/data.h.
void Data< T, N_rank >::shift | ( | unsigned int | shift_dim, |
int | shift | ||
) |
Shift the data by 'shift' pixels in dimension 'shift_dim'. The data is shifted cyclically, i.e. the values which are shifted out at one edge of the array will be shifted in on the other edge.
Definition at line 847 of file odindata/data.h.
int Data< T, N_rank >::write | ( | const STD_string & | filename, |
bool | autoscale = true |
||
) | const |
Writes the array to a raw data file 'filename' of type 'T2'. If 'autoscale' is true, use full range of integer values (if applicable).
Definition at line 671 of file odindata/data.h.
int Data< T, N_rank >::write | ( | const STD_string & | filename, |
fopenMode | mode = overwriteMode |
||
) | const |
Writes the array to a raw data file 'filename' of type the same type as the array is. The mode specifies whether an already existing file is overwritten, or the data is appended.
Definition at line 643 of file odindata/data.h.
int Data< T, N_rank >::write | ( | const STD_string & | format, |
const STD_string & | filename, | ||
bool | autoscale = true |
||
) | const |
Writes the array to a raw data file 'filename' of type 'format' which can be one of 's8bit, u8bit, s16bit, u16bit, s32bit, u32bit, float or double'. If 'autoscale' is true, use full range of integer values (if applicable).
Definition at line 626 of file odindata/data.h.
int Data< T, N_rank >::write_asc_file | ( | const STD_string & | filename, |
const Array< T, N_rank > & | pre = defaultArray , |
||
const Array< T, N_rank > & | post = defaultArray |
||
) | const |
Writes the array as a formatted ASCII file to 'filename', one value per line. If 'pre' is of the same size as this, its values are inserted before the value on each line, and the values of 'post' are inserted after the values of this array on each line. Return value is -1 if an error occurs.
Definition at line 690 of file odindata/data.h.