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

Functions

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

Function Documentation

◆ AperturesCplImage()

cpl_apertures* AperturesCplImage ( const cpl_image *  image,
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 *  file_name,
cpl_apertures *  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

◆ FwhmValuesCplImage()

bool FwhmValuesCplImage ( cpl_image *  image,
int  x_pos,
int  y_pos,
double *  fwhm_x,
double *  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

◆ GetCutValuesPercentage()

void GetCutValuesPercentage ( const cpl_image *  image,
const double  percentage,
double *  min_value,
double *  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 *  image,
const int  min_value,
const int  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 *  image,
const int  min_value,
const int  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 *  image)

This file is part of the DDT Image Handling Library and provides functions to analyse and calculate statistic values for CPL images.

The usage is as follows:

#include "ddt/imageStats.hpp" ... using namespace ddt; 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 *  image,
int  llx,
int  lly,
int  urx,
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 *  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 *  image,
int  llx,
int  lly,
int  urx,
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 *  image,
double *  min,
double *  max,
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

◆ MinMaxPixelsCplImage()

bool MinMaxPixelsCplImage ( const cpl_image *  image,
double *  min,
double *  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 *  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 *  image,
int  llx,
int  lly,
int  urx,
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 ( cpl_image *  image,
int  x_pos,
int  y_pos,
int *  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 *  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 *  image,
int  llx,
int  lly,
int  urx,
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 *  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

◆ StatisticsCplImage()

CplStatistics* StatisticsCplImage ( const cpl_image *  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 *  image,
int  llx,
int  lly,
int  urx,
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 *  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 *  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 *  image,
int  llx,
int  lly,
int  urx,
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