CFEL - ASG Software Suite  2.5.0
CASS
Classes | Typedefs | Functions
cass::GeometryInfo Namespace Reference

Classes

struct  lookupTable_t
 combine info needed for the lookuptable More...
 
struct  pos_t
 combine the position in the lab into a struct More...
 

Typedefs

typedef std::vector< pos_tconversion_t
 define the conversion table type More...
 

Functions

pos_t minus (const pos_t &minuent, const pos_t &subtrahend)
 functor to substract one position from the other More...
 
size_t linearizeComponents (const pos_t &pos, const size_t nCols)
 convert index with 2 components into a linearized index More...
 
conversion_t generateConversionMap (const std::string &filename, const size_t sizeOfSrc, const size_t nSrcCols, const bool convertFromCheetahToCASS)
 parse the geom file and generate a lookup table More...
 
lookupTable_t generateLookupTable (const std::string &filename, const size_t sizeOfSrc, const size_t nSrcCols, const bool convertFromCheetahToCASS)
 generate a lookup table for a new image More...
 

Typedef Documentation

define the conversion table type

Definition at line 29 of file geom_parser.h.

Function Documentation

GeometryInfo::conversion_t cass::GeometryInfo::generateConversionMap ( const std::string &  filename,
const size_t  sizeOfSrc,
const size_t  nSrcCols,
const bool  convertFromCheetahToCASS 
)

parse the geom file and generate a lookup table

in the lookup table each entry corresponsed to the coordinates in the lab

Returns
list of index to pos in lab
Parameters
filenameThe filename of the geomfile
sizeOfSrcthe size of the source image
nSrcColsthe number of columns (fast changing index) in the image
convertFromCheetahToCASSflag to tell whether the geom file uses layout in Cheetah but CASS uses CASS raw image coordinates
Author
Lutz Foucar

open file

Exceptions
invalid_argumentwhen it could not be opened

read the file line by line

if there is no '/' in line skip line

get asic string, value name and value (as string) from line

eliminate whitespace from value name

depending on the value name retrieve the value as right type

if value is fs then parse the string containing the 2 numbers

go through all defined asics

if requested transform the start and end positions from the cheetah layout to the raw cass layout

go through all pixels of this asics module

find the position in the lab frame (in pixel units) of the current position (colInAsic,rowInAsic) in the asic

determine where the current position in the asic is in the src image

find position in the linearized array

check if whats been given in the geomfile goes together with the src

remember what x,y position in the lab does this position in the asic correspond to

Definition at line 60 of file geom_parser.cpp.

References asicInfo_t::corner_x, asicInfo_t::corner_y, asicInfo_t::max_fs, asicInfo_t::max_ss, asicInfo_t::min_fs, asicInfo_t::min_ss, cass::toString(), asicInfo_t::x_fs, asicInfo_t::x_ss, asicInfo_t::y_fs, and asicInfo_t::y_ss.

Referenced by generateLookupTable(), cass::pp208::loadSettings(), and cass::pp90::loadSettings().

GeometryInfo::lookupTable_t cass::GeometryInfo::generateLookupTable ( const std::string &  filename,
const size_t  sizeOfSrc,
const size_t  nSrcCols,
const bool  convertFromCheetahToCASS 
)

generate a lookup table for a new image

generate a lookup table that has the corresponding index in an image that looks like an lab image

Returns
the index lookup table
Parameters
filenameThe filename of the geomfile
sizeOfSrcthe size of the source image
nSrcColsthe number of columns (fast changing index) in the image
convertFromCheetahToCASSflag to tell whether the geom file uses layout in Cheetah but CASS uses CASS raw image coordinates
Author
Lutz Foucar

get the minimum and maximum position in lab x and y

move all values, such that they start at 0 $ pos.x -= min_x $ $ pos.y -= min_y $

get the new maximum value of the shifted lab, which corresponds to the number of pixels that are required in the dest image, since all lab values are in pixel coordinates.

determine the dimensions of the destination image

convert the positions in the lab space (pixel units) to linearized indizes in the destination image $ _lookuptable = round(src2lab.x) + round(src2lab.y)*nDestCols $

check if the boundaries are ok,

Exceptions
outof range if not.

Definition at line 238 of file geom_parser.cpp.

References generateConversionMap(), linearizeComponents(), cass::GeometryInfo::lookupTable_t::lut, cass::GeometryInfo::lookupTable_t::max, cass::max_element(), cass::GeometryInfo::lookupTable_t::min, cass::min_element(), minus(), cass::GeometryInfo::lookupTable_t::nCols, cass::GeometryInfo::lookupTable_t::nRows, cass::toString(), cass::GeometryInfo::pos_t::x, cass::ACQIRIS::x, cass::GeometryInfo::pos_t::y, and cass::ACQIRIS::y.

Referenced by jocassview::TwoDViewer::dataChanged(), and cass::pp1602::setup().

size_t cass::GeometryInfo::linearizeComponents ( const pos_t pos,
const size_t  nCols 
)

convert index with 2 components into a linearized index

Returns
linearized index
Parameters
posthe index in the frame with 2 components
nColsthe number of columns (fast changing index) in the frame
Author
Lutz Foucar

Definition at line 53 of file geom_parser.cpp.

References cass::GeometryInfo::pos_t::x, and cass::GeometryInfo::pos_t::y.

Referenced by generateLookupTable().

GeometryInfo::pos_t cass::GeometryInfo::minus ( const pos_t minuent,
const pos_t subtrahend 
)

functor to substract one position from the other

Returns
the result of the subtraction
Parameters
minuentthe minuent of the subtraction
subtrahendthe subtrahend of the subtraction
Author
Lutz Foucar

Definition at line 45 of file geom_parser.cpp.

References cass::GeometryInfo::pos_t::x, and cass::GeometryInfo::pos_t::y.

Referenced by generateLookupTable().