CFEL - ASG Software Suite  2.5.0
CASS
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
cass::pp90 Class Reference

Create a radial average of q values from a raw detector image. More...

#include <image_manipulation.h>

+ Inheritance diagram for cass::pp90:
+ Collaboration diagram for cass::pp90:

Classes

struct  temp_t
 define the table row of a single output More...
 

Public Member Functions

 pp90 (const name_t &)
 constructor More...
 
virtual void process (const CASSEvent &evt, result_t &)
 process event More...
 
virtual void loadSettings (size_t unused)
 load the settings of this pp More...
 
- Public Member Functions inherited from cass::Processor
 Processor (const name_t &name)
 constructor More...
 
virtual ~Processor ()
 virtual destructor More...
 
virtual void processEvent (const CASSEvent &event)
 process the event More...
 
virtual const result_tresult (const CASSEvent::id_t eventid=0)
 retrieve a result for a given id. More...
 
virtual void releaseEvent (const CASSEvent &event)
 tell the list that the result for event can be overwritten More...
 
result_t::shared_pointer resultCopy (const uint64_t eventid)
 retrieve histogram for id More...
 
virtual void load ()
 load the general settings More...
 
virtual void aboutToQuit ()
 function that will be called when the processor is about to be deleted More...
 
const names_tdependencies ()
 Define all processors keys a processor depends on. More...
 
void clearDependencies ()
 clear the dependenies More...
 
void clearHistograms ()
 clear the histograms More...
 
virtual void processCommand (std::string command)
 process command in pp More...
 
const name_t name () const
 retrieve the name of this processor More...
 
bool hide () const
 retrieve the hide flag of this processor More...
 
const std::string & comment () const
 retrieve the comment of this processor More...
 

Protected Types

typedef std::vector< temp_ttempArray_t
 define the matrix More...
 
typedef std::vector< result_t::value_tnormfactors_t
 define the normalization factors More...
 

Protected Member Functions

double wlFromConstant (const CASSEvent::id_t &)
 retrieve the constant wavelength More...
 
double wlFromProcessor (const CASSEvent::id_t &id)
 retrieve the wavelength from the processor More...
 
double ddFromConstant (const CASSEvent::id_t &)
 retrieve the constant detector distance More...
 
double ddFromProcessor (const CASSEvent::id_t &id)
 retrieve the detector distance from the processor More...
 
temp_t Q (const double lambda, const double D, const result_t::value_t &pixval, const GeometryInfo::pos_t &pixpos)
 get the bin when the q-value of the pixel is asked More...
 
temp_t R (const double lambda, const double D, const result_t::value_t &pixval, const GeometryInfo::pos_t &pixpos)
 get the bin when the resolution value of the pixel is asked More...
 
temp_t Rad (const double lambda, const double D, const result_t::value_t &pixval, const GeometryInfo::pos_t &pixpos)
 get the bin when the radius of the pixel is asked More...
 
- Protected Member Functions inherited from cass::Processor
virtual void createHistList (result_t::shared_pointer result)
 create result list. More...
 
void setupGeneral ()
 general setup of the processor More...
 
bool setupCondition (bool defaultConditionType=true)
 setup the condition. More...
 
shared_pointer setupDependency (const std::string &depVarName, const name_t &name="")
 setup the dependecy. More...
 

Protected Attributes

shared_pointer _imagePP
 pp containing 2d histogram More...
 
bool _convertCheetahToCASSLayout
 flag whether to convert the positions in the src from cheetah to cass layout More...
 
std::string _filename
 filename of the geometry file More...
 
GeometryInfo::conversion_t _pixPositions_m
 the pixel positions More...
 
double _wavelength
 the wavelength in case its fixed More...
 
shared_pointer _wavelengthPP
 pp containing wavelength in case its not fixed More...
 
std::tr1::function< double(const CASSEvent::id_t &)> _getWavelength
 function that gets the wavelength More...
 
double _detdist
 the detector distance in case its fixed More...
 
shared_pointer _detdistPP
 pp containing detector distance in case its not fixed More...
 
std::tr1::function< double(const CASSEvent::id_t &)> _getDetectorDistance
 function that gets the detectordistance More...
 
double _np_m
 the size of one pixel in m More...
 
float _badPixVal
 value of the bad pixels More...
 
std::tr1::function< temp_t(const double, const double, const result_t::value_t &, const GeometryInfo::pos_t &)> _getBin
 function to map the pixel to histogram bin, value and fill flag More...
 
result_t::axe_t _axis
 the axis of the result More...
 
- Protected Attributes inherited from cass::Processor
const name_t _name
 the processors name More...
 
bool _hide
 flag to tell whether this pp should be hidden in the dropdown list More...
 
std::string _comment
 optional comment that one can add to a processor. More...
 
CachedList _resultList
 the list of results More...
 
names_t _dependencies
 the list of dependencies More...
 
shared_pointer _condition
 pointer to the processor that will contain the condition More...
 

Additional Inherited Members

- Public Types inherited from cass::Processor
typedef std::tr1::shared_ptr< Processorshared_pointer
 a shared pointer of this More...
 
typedef std::string name_t
 define the name type More...
 
typedef std::list< name_tnames_t
 define the list of names More...
 
typedef CachedList::item_type result_t
 define the results More...
 
typedef CachedList::item_sp resultsp_t
 define the shared pointer to the result More...
 

Detailed Description

Create a radial average of q values from a raw detector image.

Available PostProcessors:
"90": Radial average from detector image using geom

calculate the Q value for each Pixel using the geom file.

See also
Processor for a list of all commonly available cass.ini settings.
User definable Parameters:

Processor/%name%/{ImageName}
the processor name that contains the histogram containing the cspad image in cass layout. Default is "".

Processor/%name%/{GeometryFilename}
The geom file to use. Default is "cspad.geom".

Processor/%name%/{ConvertCheetahToCASSLayout}
Set this true if the geom file is for a cheetah layout of the data, but the image in ImageName is the image in CASS layout.

Processor/%name%/{Wavelength_A}
The wavelength in Angstroem. Can also be the name of a PP that contains the Wavelength. Default is 1.

Processor/%name%/{DetectorDistance_m}
The detector distance in m. Can also be the name of a PP that contains the detector distance. Default is 60e-2.

Processor/%name%/{PixelSize_m}
The pixel size in m. Default is 110e-6

Processor/%name%/{XNbrBins|XLow|XUp}
properties of the resulting 1D histogram

Processor/%name%/{BadPixelValue}
value of the bad pixel in the image. Default is 0

Processor/%name%/{Output}
One can choose the type of radial average that one wants to have. Default is "Q". Possible values are:

  • "Q": the q-averge in the defintion of q that SAXS people are using. See pp90::Q for details.
  • "Resolution": the radial average in resultion values as defined by the crystallographers. See pp90::R for details.
  • "Radius": the radial average in radii, where the Pixelsize_m parameter is used to determine the radius. If one wants to have the radius in pixel units, one just has to set the PixelSize_m parameter to 1.
Author
Lutz Foucar

Definition at line 567 of file image_manipulation.h.

Member Typedef Documentation

typedef std::vector<result_t::value_t> cass::pp90::normfactors_t
protected

define the normalization factors

Definition at line 674 of file image_manipulation.h.

typedef std::vector<temp_t> cass::pp90::tempArray_t
protected

define the matrix

Definition at line 593 of file image_manipulation.h.

Constructor & Destructor Documentation

pp90::pp90 ( const name_t name)

constructor

Definition at line 550 of file image_manipulation.cpp.

References loadSettings().

Member Function Documentation

double cass::pp90::ddFromConstant ( const CASSEvent::id_t )
inlineprotected

retrieve the constant detector distance

Parameters
idunused

Definition at line 612 of file image_manipulation.h.

References _detdist.

Referenced by loadSettings().

double pp90::ddFromProcessor ( const CASSEvent::id_t id)
protected

retrieve the detector distance from the processor

Parameters
idthe id of the event to get the detector distance from

Definition at line 691 of file image_manipulation.cpp.

References _detdistPP.

Referenced by loadSettings().

void pp90::loadSettings ( size_t  unused)
virtual

load the settings of this pp

Parameters
unusedthis parameter is not used

setup the method to be used

use fixed value for wavelength if value can be converted to double, otherwise use the wavelength from the processor

use fixed value for detector distance if value can be converted to double, otherwise use the detector distance from the processor

if the method is radius, assign dummy entries (but non-zero) to the wavelength and detector distance

check if the input processors have the correct type

setup the pixel position map

create the output histogram the storage where to put the normfactors

Reimplemented from cass::Processor.

Definition at line 556 of file image_manipulation.cpp.

References _axis, _badPixVal, cass::Processor::_condition, _convertCheetahToCASSLayout, _detdist, _detdistPP, _filename, _getBin, _getDetectorDistance, _getWavelength, _imagePP, _np_m, _pixPositions_m, _wavelength, _wavelengthPP, cass::Log::add(), cass::Result< T >::axis(), QSettings::beginGroup(), cass::Processor::createHistList(), ddFromConstant(), ddFromProcessor(), QString::fromStdString(), cass::GeometryInfo::generateConversionMap(), cass::Log::INFO, cass::ACQIRIS::method, cass::Processor::name(), Q(), R(), Rad(), cass::Processor::result(), cass::set1DHist(), cass::Processor::setupCondition(), cass::Processor::setupDependency(), cass::Processor::setupGeneral(), cass::toString(), QSettings::value(), wlFromConstant(), wlFromProcessor(), and cass::Result< float >::xAxis.

Referenced by pp90().

void pp90::process ( const CASSEvent evt,
result_t result 
)
virtual

process event

Get the input histogram and its memory

get the wavelenth and detector distance and return if they are bad

iterate through the src image and determine the pixels bin in the result only when they are not masked

now put the weights into the correct bins and create the nomralization factors

normalize by the number of fills for each bin

normalize by the number of fills for each bin

Reimplemented from cass::Processor.

Definition at line 779 of file image_manipulation.cpp.

References _getBin, _getDetectorDistance, _getWavelength, _imagePP, _pixPositions_m, cass::Result< T >::begin(), cass::Result< T >::datasize(), cass::fuzzyIsNull(), cass::CASSEvent::id(), and cass::Result< T >::lock.

pp90::temp_t pp90::Q ( const double  lambda,
const double  D,
const result_t::value_t pixval,
const GeometryInfo::pos_t pixpos 
)
protected

get the bin when the q-value of the pixel is asked

the q-value will be calculated using formula

\[ Q = \frac{4\pi}{\lambda} \sin\left(\frac{1}{2}\arctan\left(\frac{r}{d}\right)\right) \]

with $\lambda$ being the wavelength in $\AA$, $r$ the radius of the pixel and $d$ the detector distance.

Returns
the struct that tell the bin, value, fill combination
Parameters
lambdathe wavelength
Dthe detector distance
pixvalthe value of the pixel
pixposthe position of the pixel in m

Definition at line 698 of file image_manipulation.cpp.

References _axis, _badPixVal, cass::histogramming::bin(), cass::pp90::temp_t::bin, cass::pp90::temp_t::fill, cass::fuzzycompare(), cass::pp90::temp_t::weight, cass::GeometryInfo::pos_t::x, and cass::GeometryInfo::pos_t::y.

Referenced by loadSettings(), and R().

pp90::temp_t pp90::R ( const double  lambda,
const double  D,
const result_t::value_t pixval,
const GeometryInfo::pos_t pixpos 
)
protected

get the bin when the resolution value of the pixel is asked

the resultion will be calculated as follows

\[ R = \frac{1}{\frac{2}{\lambda}\sin\left(\frac{1}{2}\arctan\left(\frac{r}{d}\right)\right)} \]

with $\lambda$ being the wavelength in $\AA$, $r$ the radius of the pixel and $d$ the detector distance.

Returns
the struct that tell the bin, value, fill combination
Parameters
lambdathe wavelength
Dthe detector distance
pixvalthe value of the pixel
pixposthe position of the pixel in m

Definition at line 722 of file image_manipulation.cpp.

References _axis, _badPixVal, cass::histogramming::bin(), cass::pp90::temp_t::bin, cass::pp90::temp_t::fill, cass::fuzzycompare(), Q(), cass::pp90::temp_t::weight, cass::GeometryInfo::pos_t::x, and cass::GeometryInfo::pos_t::y.

Referenced by loadSettings().

pp90::temp_t pp90::Rad ( const double  lambda,
const double  D,
const result_t::value_t pixval,
const GeometryInfo::pos_t pixpos 
)
protected

get the bin when the radius of the pixel is asked

Returns
the struct that tell the bin, value, fill combination
Parameters
lambdaunused
Dunused
pixvalthe value of the pixel
pixposthe position of the pixel in m

Definition at line 748 of file image_manipulation.cpp.

References _axis, _badPixVal, cass::histogramming::bin(), cass::pp90::temp_t::bin, cass::pp90::temp_t::fill, cass::fuzzycompare(), cass::pp90::temp_t::weight, cass::GeometryInfo::pos_t::x, and cass::GeometryInfo::pos_t::y.

Referenced by loadSettings().

double cass::pp90::wlFromConstant ( const CASSEvent::id_t )
inlineprotected

retrieve the constant wavelength

Parameters
idunused

Definition at line 600 of file image_manipulation.h.

References _wavelength.

Referenced by loadSettings().

double pp90::wlFromProcessor ( const CASSEvent::id_t id)
protected

retrieve the wavelength from the processor

Parameters
idthe id of the event to get the wavelength from

Definition at line 684 of file image_manipulation.cpp.

References _wavelengthPP.

Referenced by loadSettings().

Member Data Documentation

result_t::axe_t cass::pp90::_axis
protected

the axis of the result

Definition at line 714 of file image_manipulation.h.

Referenced by loadSettings(), Q(), R(), and Rad().

float cass::pp90::_badPixVal
protected

value of the bad pixels

Definition at line 707 of file image_manipulation.h.

Referenced by loadSettings(), Q(), R(), and Rad().

bool cass::pp90::_convertCheetahToCASSLayout
protected

flag whether to convert the positions in the src from cheetah to cass layout

Definition at line 677 of file image_manipulation.h.

Referenced by loadSettings().

double cass::pp90::_detdist
protected

the detector distance in case its fixed

Definition at line 695 of file image_manipulation.h.

Referenced by ddFromConstant(), and loadSettings().

shared_pointer cass::pp90::_detdistPP
protected

pp containing detector distance in case its not fixed

Definition at line 698 of file image_manipulation.h.

Referenced by ddFromProcessor(), and loadSettings().

std::string cass::pp90::_filename
protected

filename of the geometry file

Definition at line 680 of file image_manipulation.h.

Referenced by loadSettings().

std::tr1::function<temp_t(const double,const double,const result_t::value_t&, const GeometryInfo::pos_t&)> cass::pp90::_getBin
protected

function to map the pixel to histogram bin, value and fill flag

Definition at line 711 of file image_manipulation.h.

Referenced by loadSettings(), and process().

std::tr1::function<double(const CASSEvent::id_t&)> cass::pp90::_getDetectorDistance
protected

function that gets the detectordistance

Definition at line 701 of file image_manipulation.h.

Referenced by loadSettings(), and process().

std::tr1::function<double(const CASSEvent::id_t&)> cass::pp90::_getWavelength
protected

function that gets the wavelength

Definition at line 692 of file image_manipulation.h.

Referenced by loadSettings(), and process().

shared_pointer cass::pp90::_imagePP
protected

pp containing 2d histogram

Definition at line 671 of file image_manipulation.h.

Referenced by loadSettings(), and process().

double cass::pp90::_np_m
protected

the size of one pixel in m

Definition at line 704 of file image_manipulation.h.

Referenced by loadSettings().

GeometryInfo::conversion_t cass::pp90::_pixPositions_m
protected

the pixel positions

Definition at line 683 of file image_manipulation.h.

Referenced by loadSettings(), and process().

double cass::pp90::_wavelength
protected

the wavelength in case its fixed

Definition at line 686 of file image_manipulation.h.

Referenced by loadSettings(), and wlFromConstant().

shared_pointer cass::pp90::_wavelengthPP
protected

pp containing wavelength in case its not fixed

Definition at line 689 of file image_manipulation.h.

Referenced by loadSettings(), and wlFromProcessor().


The documentation for this class was generated from the following files: