|
ddt
0.1
|
#include <imageHandling.hpp>
Public Types | |
| enum | CutLevelType { AUTO, MINMAX, USERDEFINED } |
| enum | ColorScalingType { LINEAR_SCALE, LOG_SCALE, SQRT_SCALE } |
Public Member Functions | |
| ImageHandling () | |
| virtual | ~ImageHandling () |
| void | set_logger (ddt::DdtLogger *logger) |
| bool | LoadFile (const std::string &file_name, int position=0) |
| bool | LoadImageExtensionsAsOne (const std::string &file_name) |
| void | set_CutLevelType (const CutLevelType cut_level_type) |
| CutLevelType | get_CutLevelType () |
| std::string | get_CutLevelTypeStr () |
| bool | ApplyCutLevelsMinMax () |
| bool | ApplyCutLevelsAuto () |
| bool | ApplyCutLevelsManual (const double min_value, const double max_value) |
| bool | ResetCutLevels () |
| bool | LoadColorMaps (std::string color_map_folder, std::string color_map_name="standard") |
| bool | LoadActualColorMap (std::string color_map_name) |
| bool | LoadActualConfigurationMap (std::string configuration_map_name) |
| bool | LoadConfigurationMaps (std::string configuration_map_source) |
| int | StoreActualImageAsBias (const std::string slot_name="") |
| int | LoadFileAsBias (const std::string file_name) |
| bool | LoadFileAsBiasInSlot (const std::string file_name, const int slot) |
| std::string | GetBiasSlotName (const int slot) |
| bool | GetBiasEnabled () const |
| void | EnableBias (const bool enable_bias) |
| void | ApplyBias (const int slot) |
| int | GetCurrentSelectedBiasSlot () const |
| void | ClearAllBiasImages () |
| void | ClearSelectedBiasImage (const int slot) |
| void | DisplaySelectedBiasImage (const int slot) |
| void | set_RotateFlag (const bool rot_flag) |
| bool | get_RotateFlag () |
| void | set_FlipXFlag (const bool flip_flag) |
| bool | get_FlipXFlag () |
| void | set_FlipYFlag (const bool flip_flag) |
| bool | get_FlipYFlag () |
| void * | get_ImageData () |
| cpl_image * | get_Image () |
| cpl_table * | get_BinaryTable () |
| int | get_ImageWidth () |
| int | get_ImageHeight () |
| int | get_NumberExtensions () |
| int | get_NumberAxis () const |
| bool | get_LastSegment () const |
| FitsExtension * | get_FitsExtensionInfo (const int extension_number) |
| FitsExtension | get_PrimaryHDUInfo () const |
| void | set_CutLevelMin (const double min_value) |
| void | set_CutLevelMax (const double max_value) |
| double | get_CutLevelMin () |
| double | get_CutLevelMax () |
| double | get_ImagePixelMin () |
| double | get_ImagePixelMax () |
| std::list< std::string > | get_ColorMaps () |
| ddt::colorMap_t * | get_ActualColorMap () |
| ddt::colorMapARGB_t * | get_ActualColorMapARGB () |
| std::string | get_ActualColorMapName () |
| ddt::scalingLut_t * | get_ScalingLut () |
| ddt::scalingLut_t * | get_LinearScalingLut () |
| ddt::scalingLut_t * | get_LogarithmicScalingLut () |
| ddt::scalingLut_t * | get_SqrtScalingLut () |
| ColorScalingType | get_ColorScalingType () |
| void | set_ColorScalingTypeLinear () |
| void | set_ColorScalingTypeLogarithmic () |
| void | set_ColorScalingTypeSquareRoot () |
| void | set_ColorScalingType (ColorScalingType scaling_type) |
| std::string | get_ColorScalingTypeStr () |
| double | ImagePixelFromImage (const double x_image, double y_image) |
| double | ImagePixelFromCanvas (const double x_canvas, const double y_canvas, double *x_image, double *y_image) |
| void | ConvertCanvasToImage (const double x_canvas, const double y_canvas, double *x_image, double *y_image) |
| void | ConvertImageToCanvas (const double x_image, const double y_image, double *x_canvas, double *y_canvas) |
| bool | WorldCoordinatesDegreesFromImage (const double x_image, const double y_image, double *alpha, double *delta) |
| bool | WorldCoordinatesDegreesFromCanvas (const double x_canvas, const double y_canvas, double *alpha, double *delta) |
| CplStatistics * | GetStatisticsCplImageWindow (int llx, int lly, int urx, int ury) |
| bool | get_AttachedToStream () |
| bool | ReprossImage () |
| void | GetHistogramFromImage (int min_value, int max_value, std::vector< int > &distribution) |
| void | GetHistogramBinsFromImage (int min_value, int max_value, std::vector< int > &distribution) |
| void | GetCutValuesPercentageFromImage (const double percentage, double *min_value, double *max_value) |
| void | AttachDataStream (std::string data_stream_id) |
| void | DetachDataStream (std::string data_stream_id) |
| cpl_apertures * | GetCircularObjects (double sigma) |
| bool | GetObjectCentroidPos (cpl_apertures *apertures, double x_image, double y_image, double *x_centroid, double *y_centroid) |
| bool | GetObjectInformation (double x_image, double y_image, int size, double *x_axis_angle, double *background, double *peak_above_background, double *fwhm_x, double *fwhm_y) |
| bool | GetGaussianParameters (double x_image, double y_image, int size, double *background, double *gaussian_volume, double *correlation, double *gaussian_coord_x, double *gaussian_coord_y, double *sigma_x, double *sigma_y) |
| std::string | GetEquinox () |
| signal_t * | ImageAvailableInBufferSignal () |
| signal_t * | CutLevelChangedSignal () |
| std::vector< std::string > | GetFITSHeader () |
| double | GetPixelToDegreesScalingFactor () |
Protected Attributes | |
| ddt::DdtLogger * | logger |
Class to wrap the usage of image handling functions.
This class allows to load a data file or attach to a data stream. It offers access to image properties and the possibility to process the image data (e.g. flip / rotate etc.).
To distinguish between color scaling types.
| ImageHandling::ImageHandling | ( | ) |
Constructor
|
virtual |
Destructor
| void ImageHandling::ApplyBias | ( | const int | slot | ) |
Apply the BIAS identified by the slot number on the current image
| slot | the BIAS slot number (starting with 0) |
| bool ImageHandling::ApplyCutLevelsAuto | ( | ) |
Apply cut levels based on the median filtered image min/max values
| bool ImageHandling::ApplyCutLevelsManual | ( | const double | min_value, |
| const double | max_value | ||
| ) |
Apply cut levels based manually
| bool ImageHandling::ApplyCutLevelsMinMax | ( | ) |
Apply cut levels based on the image min/max values
| void ImageHandling::AttachDataStream | ( | std::string | data_stream_id | ) |
Attach to a data stream
| data_stream_id | The ID of the data stream (could be the URI) |
| void ImageHandling::ClearAllBiasImages | ( | ) |
Clear all BIAS images.
| void ImageHandling::ClearSelectedBiasImage | ( | const int | slot | ) |
Clear the selected BIAS image, identified by its slot number
| slot | the BIAS slot number (starting with 0) |
| void ImageHandling::ConvertCanvasToImage | ( | const double | x_canvas, |
| const double | y_canvas, | ||
| double * | x_image, | ||
| double * | y_image | ||
| ) |
Converts canvas coordinates to image coordinates
| x_canvas | the canvas x position |
| y_canvas | the canvas y position |
| x_image | the resulting image x position |
| y_image | the resulting image y position |
| void ImageHandling::ConvertImageToCanvas | ( | const double | x_image, |
| const double | y_image, | ||
| double * | x_canvas, | ||
| double * | y_canvas | ||
| ) |
Converts image coordinates to canvas coordinates
| x_image | the image x position |
| y_image | the image y position |
| x_canvas | the resulting canvas x position |
| y_canvas | the resulting canvas y position |
| signal_t * ImageHandling::CutLevelChangedSignal | ( | ) |
Provide the cut level changed signal
| void ImageHandling::DetachDataStream | ( | std::string | data_stream_id | ) |
Detach from a data stream
| data_stream_id | The ID of the stream to be disconnected |
| void ImageHandling::DisplaySelectedBiasImage | ( | const int | slot | ) |
Displax the selected BIAS image, identified by its slot number
| slot | the BIAS slot number (starting with 0) |
| void ImageHandling::EnableBias | ( | const bool | enable_bias | ) |
Enable BIAS processing. If enabled, the currently selected BIAS image will be subtracted from each new image.
| enable_bias | flag indicating if BIAS processing shall be enabled |
| ddt::colorMap_t * ImageHandling::get_ActualColorMap | ( | ) |
Get the actual color map
| ddt::colorMapARGB_t * ImageHandling::get_ActualColorMapARGB | ( | ) |
Get the actual color map as ARGB value array
| std::string ImageHandling::get_ActualColorMapName | ( | ) |
Get the name of the current colourmap
| bool ImageHandling::get_AttachedToStream | ( | ) |
Get the attached to stream flag from the data acquisition
| cpl_table * ImageHandling::get_BinaryTable | ( | ) |
Get the binary table data
| std::list< std::string > ImageHandling::get_ColorMaps | ( | ) |
Get the list of loaded color maps;
| ImageHandling::ColorScalingType ImageHandling::get_ColorScalingType | ( | ) |
Get the color scalingtype.
| std::string ImageHandling::get_ColorScalingTypeStr | ( | ) |
Get a string representaiton of the color scaling type.
| double ImageHandling::get_CutLevelMax | ( | ) |
Get the cut level maximum
| double ImageHandling::get_CutLevelMin | ( | ) |
Get the cut level minimum
| ImageHandling::CutLevelType ImageHandling::get_CutLevelType | ( | ) |
Get the cut level type.
| std::string ImageHandling::get_CutLevelTypeStr | ( | ) |
Get a string representation of the cut level type.
| FitsExtension * ImageHandling::get_FitsExtensionInfo | ( | const int | extension_number | ) |
Get the information about one file extension
| the | extension number |
| bool ImageHandling::get_FlipXFlag | ( | ) |
Get the flip X flag.
| bool ImageHandling::get_FlipYFlag | ( | ) |
Get the flip Y flag.
| cpl_image * ImageHandling::get_Image | ( | ) |
Get the image data
| void * ImageHandling::get_ImageData | ( | ) |
Get the image data
| int ImageHandling::get_ImageHeight | ( | ) |
Get the image height
| double ImageHandling::get_ImagePixelMax | ( | ) |
Get the image pixel maximum
| double ImageHandling::get_ImagePixelMin | ( | ) |
Get the image pixel minimum
| int ImageHandling::get_ImageWidth | ( | ) |
Get the image width
| bool ImageHandling::get_LastSegment | ( | ) | const |
Get the last segment flag
| ddt::scalingLut_t * ImageHandling::get_LinearScalingLut | ( | ) |
Get the LUT for linear color scaling
| ddt::scalingLut_t * ImageHandling::get_LogarithmicScalingLut | ( | ) |
Get the LUT for logarithmic color scaling
| int ImageHandling::get_NumberAxis | ( | ) | const |
Get the number of axis
| int ImageHandling::get_NumberExtensions | ( | ) |
Get the number of extensions
| FitsExtension ImageHandling::get_PrimaryHDUInfo | ( | ) | const |
Get the information about the primary HDU
| bool ImageHandling::get_RotateFlag | ( | ) |
Get the rotate flag.
| ddt::scalingLut_t * ImageHandling::get_ScalingLut | ( | ) |
Get the scaling LUT, depending on the current scaling type
| ddt::scalingLut_t * ImageHandling::get_SqrtScalingLut | ( | ) |
Get the LUT for square root color scaling
| bool ImageHandling::GetBiasEnabled | ( | ) | const |
Get the flag indicating whether bias processing is enabled
| std::string ImageHandling::GetBiasSlotName | ( | const int | slot | ) |
Get the slot name associated to a certain slot number
| slot | the slot number (starting with 0) |
| cpl_apertures * ImageHandling::GetCircularObjects | ( | double | sigma | ) |
Get a list of objects from a CPL image
| sigma | the detection level |
| int ImageHandling::GetCurrentSelectedBiasSlot | ( | ) | const |
Get the currently selected BIAS slot
| void ImageHandling::GetCutValuesPercentageFromImage | ( | const double | percentage, |
| double * | min_value, | ||
| double * | max_value | ||
| ) |
| std::string ImageHandling::GetEquinox | ( | ) |
Return the current equinox information related to the image, if available
| std::vector< std::string > ImageHandling::GetFITSHeader | ( | ) |
Get the FITS header items as a vector of strings
| bool ImageHandling::GetGaussianParameters | ( | double | x_image, |
| double | y_image, | ||
| int | size, | ||
| double * | background, | ||
| double * | gaussian_volume, | ||
| double * | correlation, | ||
| double * | gaussian_coord_x, | ||
| double * | gaussian_coord_y, | ||
| double * | sigma_x, | ||
| double * | sigma_y | ||
| ) |
Get parameters from 2D gaussian fit
| x_image | the image x position |
| y_image | the image y position |
| size | the size of the rectangle around the image position to consider |
| background | the background level, or 0.0 on error |
| gaussian_volume | the gaussian volumne, or 0.0 on error |
| correlation | the correlation, or 0.0 on error |
| gaussian_coord_x | the x coordinate of the mid of the gaussian fit |
| gaussian_coord_y | the y coordinate of the mid of the gaussian fit |
| sigma_x | the variance of gaussian fit in x direction |
| sigma_y | the variance of gaussian fit in y direction |
| void ImageHandling::GetHistogramBinsFromImage | ( | int | min_value, |
| int | max_value, | ||
| std::vector< int > & | distribution | ||
| ) |
| void ImageHandling::GetHistogramFromImage | ( | int | min_value, |
| int | max_value, | ||
| std::vector< int > & | distribution | ||
| ) |
| bool ImageHandling::GetObjectCentroidPos | ( | cpl_apertures * | apertures, |
| double | x_image, | ||
| double | y_image, | ||
| double * | x_centroid, | ||
| double * | y_centroid | ||
| ) |
Find an aperture object that matches certain image coordinates and return the centroid position
| apertures | list of cpl_apertures objects |
| x_image | the image x position |
| y_image | the image y position |
| x_centroid | the centroid x coordinate, or -1.0 on error |
| y_centroid | the centroid y coordinate, or -1.0 on error |
| bool ImageHandling::GetObjectInformation | ( | double | x_image, |
| double | y_image, | ||
| int | size, | ||
| double * | x_axis_angle, | ||
| double * | background, | ||
| double * | peak_above_background, | ||
| double * | fwhm_x, | ||
| double * | fwhm_y | ||
| ) |
Get information about an aperture object
| x_image | the image x position |
| y_image | the image y position |
| size | the size of the rectangle around the image position to consider |
| x_axis_angle | the angle of the x_axis (degrees), or 0.0 on error |
| background | the background level, or 0.0 on error |
| peak_above_background | the peak above background value, or 0.0 on error |
| fwhm_x | the FWHM along the x axis, or -1.0 on error |
| fwhm_y | the FWHM along the y axis, or -1.0 on error |
| double ImageHandling::GetPixelToDegreesScalingFactor | ( | ) |
Calculate and return the factor needed to convert pixel distances to degrees The needed information is taken from the FITS header items, if available
| CplStatistics * ImageHandling::GetStatisticsCplImageWindow | ( | int | llx, |
| int | lly, | ||
| int | urx, | ||
| int | ury | ||
| ) |
Get statistics from CPL internal image sub-window
| llx | lower left x position (1: leftmost) |
| lly | lower left y position (1: lowest) |
| urx | upper right x position |
| ury | upper right y position |
| signal_t * ImageHandling::ImageAvailableInBufferSignal | ( | ) |
Provide the image available in buffer signal
| double ImageHandling::ImagePixelFromCanvas | ( | const double | x_canvas, |
| const double | y_canvas, | ||
| double * | x_image, | ||
| double * | y_image | ||
| ) |
Get the image pixel value from the position expressed as canvas coordinates
| x | the canvas x position |
| y | the canvas y position |
| x_image | the resulting image x position |
| y_image | the resulting image y position |
| double ImageHandling::ImagePixelFromImage | ( | const double | x_image, |
| double | y_image | ||
| ) |
Get the image pixel value from the position expressed as image coordinates
| x_image | the image x position |
| y_image | the image y position |
| bool ImageHandling::LoadActualColorMap | ( | std::string | color_map_name | ) |
Load the supplied color map as actual color map.
| color_map_name | the name of the color map to be loaded. The color map names are derived from the color map file names. |
| bool ImageHandling::LoadActualConfigurationMap | ( | std::string | configuration_map_name | ) |
Load the supplied configuration map as the actual configuration map.
| configuration_map_name | the name of the configuration map to be loaded. |
| bool ImageHandling::LoadColorMaps | ( | std::string | color_map_folder, |
| std::string | color_map_name = "standard" |
||
| ) |
Load the color maps from the specified folder into the color_maps member. If possible, the supplied color map is then loaded as the actual color map.
| color_map_folder | the folder containing color map files. These files (with extension .lut or .lasc) should contain 256 RGB triples (in the form: r.rrrr g.gggg b.bbbb, where each value is in the range 0.0 and 1.0). |
| color_map_name | the name of the color map to be loaded. The color map names are derived from the color map file names. |
| bool ImageHandling::LoadConfigurationMaps | ( | std::string | configuration_map_source | ) |
Load the configuration maps from the specified configuration map source.
| config_map_source | the source of the configuration maps |
| bool ImageHandling::LoadFile | ( | const std::string & | file_name, |
| int | position = 0 |
||
| ) |
Load file. This function takes a CPL file (FITS) name and a position. The position indicates the HDU to use. The default HDU is the first (position 0).
| file_name | the FITS file name to load |
| position | the position indicating the HDU to use. This defaults to 0 (the first HDU). |
| int ImageHandling::LoadFileAsBias | ( | const std::string | file_name | ) |
Load a file from disc as BIAS image
| file_name | the name of the file to load as BIAS image |
| bool ImageHandling::LoadFileAsBiasInSlot | ( | const std::string | file_name, |
| const int | slot | ||
| ) |
Load a file from disc as BIAS image in certain slot
| file_name | the name of the file to load as BIAS image |
| slot | the slot number (starting with 0) |
| bool ImageHandling::LoadImageExtensionsAsOne | ( | const std::string & | file_name | ) |
| bool ImageHandling::ReprossImage | ( | ) |
Apply all processing flags and cut levels on the image
| bool ImageHandling::ResetCutLevels | ( | ) |
Reset cut levels
| void ImageHandling::set_ColorScalingType | ( | ColorScalingType | scaling_type | ) |
Set the actual color scaling type
| scaling_type | the scaling type to be set |
| void ImageHandling::set_ColorScalingTypeLinear | ( | ) |
Set the scaling type to LINEAR_SCALE.
| void ImageHandling::set_ColorScalingTypeLogarithmic | ( | ) |
Set the scaling type to LOG_SCALE.
| void ImageHandling::set_ColorScalingTypeSquareRoot | ( | ) |
Set the scaling type to SQRT_SCALE.
| void ImageHandling::set_CutLevelMax | ( | const double | max_value | ) |
Set the cut level maximum
| void ImageHandling::set_CutLevelMin | ( | const double | min_value | ) |
Set the cut level minimum
| void ImageHandling::set_CutLevelType | ( | const CutLevelType | cut_level_type | ) |
Set the cut level type.
| void ImageHandling::set_FlipXFlag | ( | const bool | flip_flag | ) |
Set the flip X flag.
| void ImageHandling::set_FlipYFlag | ( | const bool | flip_flag | ) |
Set the flip Y flag.
| void ImageHandling::set_logger | ( | ddt::DdtLogger * | logger | ) |
Set logger
| logger | The logger object |
| void ImageHandling::set_RotateFlag | ( | const bool | rot_flag | ) |
Set the rotate flag.
| int ImageHandling::StoreActualImageAsBias | ( | const std::string | slot_name = "" | ) |
Stores the actually displayed image as BIAS image
| slot_name | name to assign to the slot Should be the filename in case of storing a selected file Defaults to empty string, in which case a slot name will be automatically set |
| bool ImageHandling::WorldCoordinatesDegreesFromCanvas | ( | const double | x_canvas, |
| const double | y_canvas, | ||
| double * | alpha, | ||
| double * | delta | ||
| ) |
Get the world coordinates in degrees from canvas coordinates
| x_canvas | the canvas x position |
| y_canvas | the canvas y position |
| alpha | the resulting world coordinates alpha value |
| delta | the resulting world coordinates delta value |
| bool ImageHandling::WorldCoordinatesDegreesFromImage | ( | const double | x_image, |
| const double | y_image, | ||
| double * | alpha, | ||
| double * | delta | ||
| ) |
Get the world coordinates in degrees from image coordinates
| x_image | the image x position |
| y_image | the image y position |
| alpha | the resulting world coordinates alpha value |
| delta | the resulting world coordinates delta value |
|
protected |
The logger object