ddt  0.1
Functions
imageStats.cpp File Reference
#include "ddt/imageStats.hpp"
#include <cmath>
#include <iostream>
#include "ddt/imageError.hpp"

Functions

double MaxPixelCplImage (const cpl_image *const image)
 
double MaxPixelCplImageWindow (const cpl_image *const image, const int llx, const int lly, const int urx, const int ury)
 
double MinPixelCplImage (const cpl_image *const image)
 
double MinPixelCplImageWindow (const cpl_image *const image, const int llx, const int lly, const int urx, const int ury)
 
double MeanPixelCplImage (const cpl_image *const image)
 
double MeanPixelCplImageWindow (const cpl_image *const image, const int llx, const int lly, const int urx, const int ury)
 
double RmsValueCplImage (const cpl_image *const image)
 
double RmsValueCplImageWindow (const cpl_image *const image, const int llx, const int lly, const int urx, const int ury)
 
cpl_stats * StatsCplImage (const cpl_image *const image)
 
cpl_stats * StatsCplImageWindow (const cpl_image *const image, const int llx, const int lly, const int urx, const int ury)
 
double RmsValueCplStats (const cpl_stats *const stats_cpl)
 
CplStatisticsStatisticsCplImage (const cpl_image *const image)
 
CplStatisticsStatisticsCplImageWindow (const cpl_image *const image, const int llx, const int lly, const int urx, const int ury)
 
CplStatisticsStatisticsCplStats (const cpl_stats *const stats_cpl)
 
bool FwhmValuesCplImage (const cpl_image *const image, const int x_pos, const int y_pos, double *const fwhm_x, double *const fwhm_y)
 
cpl_apertures * AperturesCplImage (const cpl_image *const image, const double sigma)
 
bool AperturesCplImageDump (const char *const file_name, const cpl_apertures *const apertures)
 
bool MinMaxPixelsCplImage (const cpl_image *const image, double *const min, double *const max)
 
bool MedianMinMaxPixelsCplImage (const cpl_image *const image, double *const min, double *const max, const double kernel_size)
 
void CheckForNanValues (cpl_image *const image)
 
double PixelValueCplImage (const cpl_image *const image, const int x_pos, const int y_pos, int *const is_rejected)
 
void GetHistogram (const cpl_image *const image, const int64_t min_value, const int64_t max_value, std::vector< int > &distribution)
 
void GetHistogramBins (const cpl_image *const image, const int64_t min_value, const int64_t max_value, std::vector< int > &distribution)
 
void GetCutValuesPercentage (const cpl_image *const image, const double percentage, double *const min_value, double *const max_value)
 
bool Get_IQE_Values (const cpl_image *const subImage, double *const x_axis_angle, double *const background, double *const peak_above_background, double *const fwhm_x, double *const fwhm_y, double *const object_coord_x, double *const object_coord_y)
 
bool MinMaxInvalidCheck (const cpl_image *const image, double *const min, double *const max)
 
double SigmaCplImage (const cpl_image *const image, double *const sigma)
 
double SigmaCplImageWindow (const cpl_image *const image, const int llx, const int lly, const int urx, const int ury, double *const sigma)
 

Function Documentation

◆ AperturesCplImage()

cpl_apertures* AperturesCplImage ( const cpl_image *const  image,
const double  sigma 
)

Detect apertures in a CPL image.

Parameters
imageCPL image object
sigmadetection level
Returns
cpl_apertures list of apertures detected in the CPL image

◆ AperturesCplImageDump()

bool AperturesCplImageDump ( const char *const  file_name,
const cpl_apertures *const  apertures 
)

Dump list of apertures from a CPL image into a file.

Parameters
file_nameFilename of the output file
apertureslist of apertures
Returns
bool indicating success of dumping

◆ CheckForNanValues()

void CheckForNanValues ( cpl_image *const  image)

Check the pixel values of a CPL image for NaN values. These are then rejected in the image.

Parameters
imageCPL image object

◆ FwhmValuesCplImage()

bool FwhmValuesCplImage ( const cpl_image *const  image,
const int  x_pos,
const int  y_pos,
double *const  fwhm_x,
double *const  fwhm_y 
)

Compute FWHM (full width half maximum) values in x and y direction.

Parameters
imageCPL image object
x_posthe x position
y_posthe y position
fwhm_xthe computed FWHM value in x (-1 on error)
fwhm_ythe computed FWHM value in y (-1 on error)
Returns
bool indicating success of computing

◆ Get_IQE_Values()

bool Get_IQE_Values ( const cpl_image *const  subImage,
double *const  x_axis_angle,
double *const  background,
double *const  peak_above_background,
double *const  fwhm_x,
double *const  fwhm_y,
double *const  object_coord_x,
double *const  object_coord_y 
)

Get the image quality estimation values from a CPL image. The CPL image is casted to a float values image internally before the values are calculated.

Parameters
subImageCPL image object
x_axis_anglethe resulting angle of the major axis with the horizontal in degrees
backgroundthe resulting background computed
peak_above_backgroundthe peak value of the
fwhm_xthe resulting FWHM along the major axis
fwhm_ythe resulting FWHM along the minor axis
object_coord_xx coordinate of the center of the detected object
object_coord_yy coordinate of the center of the detected object
Returns
true if computation was successful, false otherwise

◆ GetCutValuesPercentage()

void GetCutValuesPercentage ( const cpl_image *const  image,
const double  percentage,
double *const  min_value,
double *const  max_value 
)

Get the min/max values from a CPL image, given a percentage of pixel that fall inside this range

Parameters
imageCPL image object
percentagethe percentage of pixel values to fall inside the min/max range
min_valuethe resulting minimum pixel value
max_valuethe resulting maximum pixel value

◆ GetHistogram()

void GetHistogram ( const cpl_image *const  image,
const int64_t  min_value,
const int64_t  max_value,
std::vector< int > &  distribution 
)

Get the histogram (pixel value distribution) for a CPL image

Parameters
imageCPL image object
min_valuethe minimum pixel value to consider for the histogram
max_valuethe maximum pixel value to consider for the histogram
distributionvector containing the pixel value distribution

◆ GetHistogramBins()

void GetHistogramBins ( const cpl_image *const  image,
const int64_t  min_value,
const int64_t  max_value,
std::vector< int > &  distribution 
)

Get the histogram (pixel value distribution) for a CPL image. The distribution vector is reshaped into bins. The bin size and count are calculated automatically.

Parameters
imageCPL image object
min_valuethe minimum pixel value to consider for the histogram
max_valuethe maximum pixel value to consider for the histogram
distributionvector containing the pixel value distribution

◆ MaxPixelCplImage()

double MaxPixelCplImage ( const cpl_image *const  image)

This file is part of the DDT Image Handling Library and provides functions to analyse and calculate statistic values for CPL images. Calculate maximum pixel value of a CPL image.

Parameters
imageCPL image object
Returns
double the maximum pixel value in the CPL image

◆ MaxPixelCplImageWindow()

double MaxPixelCplImageWindow ( const cpl_image *const  image,
const int  llx,
const int  lly,
const int  urx,
const int  ury 
)

Calculate maximum pixel value of a CPL image sub-window.

Parameters
imageCPL image sub-window object
llxlower left x position (1: leftmost)
llylower left y position (1: lowest)
urxupper right x position
uryupper right y position
Returns
double the maximum pixel value in the CPL image sub-window

◆ MeanPixelCplImage()

double MeanPixelCplImage ( const cpl_image *const  image)

Calculate mean pixel value of a CPL image.

Parameters
imageCPL image object
Returns
double the mean pixel value in the CPL image

◆ MeanPixelCplImageWindow()

double MeanPixelCplImageWindow ( const cpl_image *const  image,
const int  llx,
const int  lly,
const int  urx,
const int  ury 
)

Calculate mean pixel value of a CPL image sub-window.

Parameters
imageCPL image sub-window object
llxlower left x position (1: leftmost)
llylower left y position (1: lowest)
urxupper right x position
uryupper right y position
Returns
double the mean pixel value in the CPL image sub-window

◆ MedianMinMaxPixelsCplImage()

bool MedianMinMaxPixelsCplImage ( const cpl_image *const  image,
double *const  min,
double *const  max,
const double  kernel_size 
)

Get min / max values from a median filtered CPL image.

Parameters
imageCPL image object
minthe minimum pixel value, or -1.0 on error
maxthe maximum pixel value, or -1.0 on error
kernel_sizesize of filtering kernel; e.g. a value of 5 results in a 5x5 kernel matrix; defaults to 5
Returns
bool indicating success of getting min / max values

◆ MinMaxInvalidCheck()

bool MinMaxInvalidCheck ( const cpl_image *const  image,
double *const  min,
double *const  max 
)

Get the min/max values from a CPL image. This function checks if the found values are invalid (NaN). In this case, the min/max computation is repeated, but with all NaN values in the image being rejected.

Parameters
imageCPL image object
min_valuethe resulting minimum pixel value, or -1.0 on error
max_valuethe resulting maximum pixel value, or -1.0 on error
Returns
true if computation was successful, false otherwise

◆ MinMaxPixelsCplImage()

bool MinMaxPixelsCplImage ( const cpl_image *const  image,
double *const  min,
double *const  max 
)

Get min / max values from a CPL image.

Parameters
imageCPL image object
minthe minimum pixel value, or -1.0 on error
maxthe maximum pixel value, or -1.0 on error
Returns
bool indicating success of getting min / max values

◆ MinPixelCplImage()

double MinPixelCplImage ( const cpl_image *const  image)

Calculate minimum pixel value of an CPL image.

Parameters
imageCPL image object
Returns
double the minimum pixel value in the CPL image

◆ MinPixelCplImageWindow()

double MinPixelCplImageWindow ( const cpl_image *const  image,
const int  llx,
const int  lly,
const int  urx,
const int  ury 
)

Calculate minimum pixel value of a CPL image sub-window.

Parameters
imageCPL image sub-window object
llxlower left x position (1: leftmost)
llylower left y position (1: lowest)
urxupper right x position
uryupper right y position
Returns
double the minimum pixel value in the CPL image sub-window

◆ PixelValueCplImage()

double PixelValueCplImage ( const cpl_image *const  image,
const int  x_pos,
const int  y_pos,
int *const  is_rejected 
)

Get the pixel value at a certain image position

Parameters
imageCPL image object
x_posthe pixel x position
y_posthe pixel y position
is_rejectedset to 1 if the pixel is bad, 0 if good, or -1 on error
Returns
double pixel value (cast to double) or undefined

◆ RmsValueCplImage()

double RmsValueCplImage ( const cpl_image *const  image)

Calculate RMS (root mean square) value of a CPL image.

Parameters
imageCPL image object
Returns
double the RMS value of the CPL image, or 0.0 in case of errors

◆ RmsValueCplImageWindow()

double RmsValueCplImageWindow ( const cpl_image *const  image,
const int  llx,
const int  lly,
const int  urx,
const int  ury 
)

Calculate RMS (root mean square) value of a CPL image sub-window.

Parameters
imageCPL image sub-window object
llxlower left x position (1: leftmost)
llylower left y position (1: lowest)
urxupper right x position
uryupper right y position
Returns
double the RMS value of the CPL image sub-window, or 0.0 in case of errors

◆ RmsValueCplStats()

double RmsValueCplStats ( const cpl_stats *const  stats_cpl)

Calculate RMS (root mean square) value from statistic values contained in a cpl_stats object.

Parameters
stats_cplcpl_stats object
Returns
double the RMS value, or 0.0 in case of errors

◆ SigmaCplImage()

double SigmaCplImage ( const cpl_image *const  image,
double *const  sigma 
)

Calculate the median and the median absolute deviation (sigma) of a CPL image.

Parameters
imageCPL image object
sigmathe resulting median absolute deviation of the CPL image
Returns
double the median of the CPL image

◆ SigmaCplImageWindow()

double SigmaCplImageWindow ( const cpl_image *const  image,
const int  llx,
const int  lly,
const int  urx,
const int  ury,
double *const  sigma 
)

Calculate the median and the median absolute deviation (sigma) of a CPL image sub-window.

Parameters
imageCPL image sub-window object
llxlower left x position (1: leftmost)
llylower left y position (1: lowest)
urxupper right x position
uryupper right y position
sigmathe resulting median absolute deviation of the CPL image
Returns
double the median of the CPL image

◆ StatisticsCplImage()

CplStatistics* StatisticsCplImage ( const cpl_image *const  image)

Get statistics from CPL image

Parameters
imageCPL image object
Returns
CplStatistics structure containing statistic values or NULL in case of errors Following values are contained: number of pixels, min pixel value, max pixel value, mean pixel value, rms value

◆ StatisticsCplImageWindow()

CplStatistics* StatisticsCplImageWindow ( const cpl_image *const  image,
const int  llx,
const int  lly,
const int  urx,
const int  ury 
)

Get statistics from CPL image sub-window

Parameters
imageCPL image object
llxlower left x position (1: leftmost)
llylower left y position (1: lowest)
urxupper right x position
uryupper right y position
Returns
CplStatistics structure containing statistic values or NULL in case of errors Following values are contained: number of pixels, min pixel value, max pixel value, mean pixel value, rms value

◆ StatisticsCplStats()

CplStatistics* StatisticsCplStats ( const cpl_stats *const  stats_cpl)

Get statistics from statistic values contained in a cpl_stats object.

Parameters
stats_cplcpl_stats object
Returns
CplStatistics structure containing statistic values or NULL in case of errors Following values are contained: number of pixels, min pixel value, max pixel value, mean pixel value, rms value

◆ StatsCplImage()

cpl_stats* StatsCplImage ( const cpl_image *const  image)

Get statistics from CPL image

Parameters
imageCPL image object
Returns
cpl_stats structure containing CPL statistic values or NULL in case of errors

◆ StatsCplImageWindow()

cpl_stats* StatsCplImageWindow ( const cpl_image *const  image,
const int  llx,
const int  lly,
const int  urx,
const int  ury 
)

Get statistics from CPL image sub-window

Parameters
imageCPL image sub-window object
llxlower left x position (1: leftmost)
llylower left y position (1: lowest)
urxupper right x position
uryupper right y position
Returns
cpl_stats structure containing CPL statistic values or NULL in case of errors