Luiza  v03-01
Public Member Functions | Protected Attributes | List of all members
luiza::FitsImageWriter Class Reference

Processor for writing FITS images to output files. More...

#include <FitsImageWriter.h>

Inheritance diagram for luiza::FitsImageWriter:
luiza::Processor

Public Member Functions

virtual FitsImageWriternewProcessor ()
 Return a new instance of the processor. More...
 
virtual void init ()
 Called at the begin of the job before anything is read. More...
 
virtual void startAnalysis (GloriaDataContainer *)
 Called before first data processing loop. More...
 
virtual void processData (GloriaDataContainer *data)
 Called for every data processing loop. More...
 
virtual void check (GloriaDataContainer *data)
 Called for every loop - right after processData() call. More...
 
virtual void concludeAnalysis (GloriaDataContainer *)
 Called after all data processing loops. More...
 
virtual void end ()
 Called after data processing is finished. More...
 
void processImages (GloriaDataContainer *data)
 Routine to do the actual image storage to file. More...
 
- Public Member Functions inherited from luiza::Processor
 Processor (const std::string &typeName)
 Default constructor. More...
 
virtual ~Processor ()
 Destructor.
 
virtual const std::string & type () const
 Return type name for the processor (as set in constructor).
 
virtual const std::string & name () const
 Return name of this processor.
 
virtual const std::string & logLevelName () const
 Return name of the local verbosity level of this processor - "" if not set.
 
virtual StringParameters * parameters ()
 Return parameters defined for this Processor.
 
virtual void printDescription ()
 Print information about this processor in ASCII steering file format.
 
virtual void printDescriptionXML (std::ostream &stream=std::cout)
 Print information about this processor in XML steering file format.
 
template<class T >
void printParameters ()
 Print the parameters and their values depending on the given verbosity level.
 
void printParameters ()
 Print the parameters and their values with verbosity level MESSAGE.
 
const std::string & description ()
 Description of processor.
 
bool isFirstEvent ()
 True if first event in processEvent(evt) - use this e.g. to initialize histograms etc.
 
GloriaCollectionType getGloriaInType (const std::string &colName)
 Return the input type for the collection colName. More...
 
GloriaCollectionType getGloriaOutType (const std::string &colName)
 Return the output type for the collection colName. More...
 
bool isInputCollectionName (const std::string &parameterName)
 Check if parameter defines collection. More...
 
bool isOutputCollectionName (const std::string &parameterName)
 True if the given parameter defines an LCIO output collection */.
 

Protected Attributes

string _imageCollectionName
 Name of the image collection to which images from file should be stored.
 
string _fitsFileNameRoot
 Output file name root.
 
int _bitPix
 Output file pixel format.
 
double _bScale
 Output file pixel scale (BSCALE)
 
int _bZero
 Output file pixel offset (BZERO)
 
int _nLoops
 Loop counter.
 
int _nImages
 Image counter, used to number file name.
 
int _nWritten
 Counter for images successfully written to file.
 
- Protected Attributes inherited from luiza::Processor
std::string _description
 Describes what the processor does. Set in constructor.
 

Additional Inherited Members

- Protected Member Functions inherited from luiza::Processor
void setReturnValue (bool val)
 Set the return value for this processor - typically at end of processEvent(). More...
 
void setReturnValue (const std::string &name, bool val)
 Set a named return value for this processor - typically at end of processEvent() More...
 
template<class T >
void registerProcessorParameter (const std::string &name, const std::string &description, T &parameter, const T &defaultVal, int setSize=0)
 Register a steering variable for this processor - call in constructor of processor. More...
 
void registerInputCollection (const GloriaCollectionType &type, const std::string &name, const std::string &description, std::string &parameter, const std::string &defaultVal, int setSize=0)
 Register parameter describing input collection. More...
 
void registerOutputCollection (const GloriaCollectionType &type, const std::string &name, const std::string &description, std::string &parameter, const std::string &defaultVal, int setSize=0)
 Register parameter describing output collection. More...
 
void registerInputCollections (const GloriaCollectionType &type, const std::string &name, const std::string &description, StringVec &parameter, const StringVec &defaultVal, int setSize=0)
 Register parameter describing input collections. More...
 
template<class T >
void registerOptionalParameter (const std::string &name, const std::string &description, T &parameter, const T &defaultVal, int setSize=0)
 Same as registerProcessorParameter except that the parameter is optional. More...
 
bool parameterSet (const std::string &name)
 Tests whether the parameter has been set in the steering file.
 
template<class T >
void message (const std::string &message) const
 Print message according to verbosity level. More...
 
template<class T >
void message (const std::basic_ostream< char, std::char_traits< char > > &m) const
 Similar to message(const std::string& message) More...
 
std::stringstream & log () const
 Returns an empty stringstream that is used by the message method.
 
virtual void setProcessorParameters (StringParameters *parameters)
 Allow friend class CCProcessor to change/reset processor parameters.
 
virtual void updateParameters ()
 Allow friend class CCProcessor to update processor parameters.
 
virtual void updateTelescopeParameters (std::string name)
 Allow to update processor parameters for given telescope name. More...
 
virtual void updateTelescopeParameters (GloriaFitsHeader *header)
 Update processor parameters based on FITS header. More...
 

Detailed Description

Processor for writing FITS images to output files.

This processor writes FITS images to output files. Can be used to store analysis results.

Input
Images are taken from the data collection. User has to specify in the steering file:
Parameters
ImageCollectionName- Name of the image collection which should be stored to file. If image collection is marked as 'permanent', it will only be stored at 'concludeAnalysis' stage (not for every loop).
Output
GloriaFitsImages from given collection are stored as FITS files. Output file names consist of file name root, image number (starting from 1) and .fit extension.
Parameters
FitsFileNameRoot- Output file name root, which will be appended by the image number and extension.
BitsPerPixel- Bits per pixel in the output fits file. Possible values are:
Parameters
PixelOffset- BZERO keyword value, used when storing pixel values to fits file. Default is 0.
PixelScale- BSCALE keyword value, used for scaling pixel values when storing to fits file. Default is 1.
Author
L.W. Piotrowski, University of Warsaw

Member Function Documentation

void luiza::FitsImageWriter::check ( GloriaDataContainer data)
virtual

Called for every loop - right after processData() call.

Can be used to check processing and/or produce check plots.

Reimplemented from luiza::Processor.

void luiza::FitsImageWriter::concludeAnalysis ( GloriaDataContainer data)
virtual

Called after all data processing loops.

This method is called to finalize the analysis, after all input data was read (or required number of loops was reached). Analysis of data collected in permanent data collections is possible here.

Reimplemented from luiza::Processor.

References _imageCollectionName, and processImages().

void luiza::FitsImageWriter::end ( )
virtual

Called after data processing is finished.

Called after all input sources are closed for clean up. Notice that processors are called in the inverse order of the init() method so that resources allocated in the first processor also will be available for all following processors.

Reimplemented from luiza::Processor.

void luiza::FitsImageWriter::init ( )
virtual

Called at the begin of the job before anything is read.

Use to initialize the processor, e.g. book histograms.

Reimplemented from luiza::Processor.

References _nImages, _nLoops, _nWritten, luiza::Processor::name(), and luiza::Processor::parameters().

FitsImageWriter * luiza::FitsImageWriter::newProcessor ( )
virtual

Return a new instance of the processor.

Has to be implemented by subclasses.

Implements luiza::Processor.

void luiza::FitsImageWriter::processData ( GloriaDataContainer data)
virtual

Called for every data processing loop.

This is where most of the work (analysis) is done. Data is exchanged between processors via GloriaDataContainer

Reimplemented from luiza::Processor.

References _imageCollectionName, _nLoops, and processImages().

void luiza::FitsImageWriter::processImages ( GloriaDataContainer data)

Routine to do the actual image storage to file.

This routine is called either from processData or from concludeAnalysis, to do the job required. Default is to store images for every loop, but permanent collections are stored only once, at the very end.

References _bitPix, _bScale, _bZero, _fitsFileNameRoot, _imageCollectionName, _nImages, _nWritten, gloria::GloriaFitsHeader::Error(), gloria::GloriaFitsHeader::ErrorMessage(), gloria::GloriaFitsHeader::InputFileName(), luiza::Processor::setReturnValue(), and gloria::GloriaFitsImage::WriteFitsFile().

Referenced by concludeAnalysis(), and processData().

void luiza::FitsImageWriter::startAnalysis ( GloriaDataContainer data)
virtual

Called before first data processing loop.

Can be used to initialize data collections required for analysis, eg. define permanent collections, or fill them with external data (from file, database or net). It is possible as GloriaDataContainer is already defined, contrary to init().

Reimplemented from luiza::Processor.


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