CFEL - ASG Software Suite  2.5.0
CASS
Functions
cass::CBF Namespace Reference

Functions

void write (const std::string &filename, std::vector< float >::const_iterator data, const std::pair< int, int > &shape)
 write cbf file More...
 
void read (const std::string &filename, std::string &headerstring, std::vector< float > &matrix, std::pair< int, int > &shape)
 read the cbf data into a linearized 2d array More...
 

Function Documentation

void cass::CBF::read ( const std::string &  filename,
std::string &  headerstring,
std::vector< float > &  matrix,
std::pair< int, int > &  shape 
)

read the cbf data into a linearized 2d array

Parameters
[in]filenamethe name of the cbf file to read
[out]headerstringthe complete header of the cbf file
[out]matrixthe output matrix, will be resized to fit the data
[out]shapethe shape of the matrix

open file and determine filesize

create a buffer and copy the whole header to it

parse the header

read the matrix data

Definition at line 191 of file cbf_handle.hpp.

Referenced by jocassview::FileHandler::loadDataFromCBF(), cass::MultiFileInput::readEventData(), and cass::TxtParser::runthis().

void cass::CBF::write ( const std::string &  filename,
std::vector< float >::const_iterator  data,
const std::pair< int, int > &  shape 
)
inline

write cbf file

Parameters
filenamethe filename to write the cbf to
dataiterator to the data that should be written
shapethe shape of the image
Author
Stephan Kassemeyer

cbf parameters:

create the cbf file

find out length of the compressed array:

write image header

write histogram data compress image using the byte offset method and save as octet stream

terminate image data part with the MIME footer

and pad last record of file with zeros:

Definition at line 35 of file cbf_handle.hpp.

References QString::fromStdString().

Referenced by cass::pp1500::aboutToQuit(), cass::pp1500::processEvent(), and jocassview::FileHandler::saveDataToCBF().