libtpcimgp
 All Data Structures Files Functions Variables Typedefs Defines
Functions
imgthrs.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include "img.h"
#include "imgmax.h"
#include "include/imgproc.h"
#include "include/imgthrs.h"
Include dependency graph for imgthrs.c:

Go to the source code of this file.

Functions

int imgThresholding (IMG *img, float threshold_level, int *thr_nr)
int imgThresholdingLowHigh (IMG *img, float lower_threshold_level, float upper_threshold_level, IMG *timg, int *lower_thr_nr, int *upper_thr_nr)
int imgThresholdTemplateCount (IMG *img, float minValue, float maxValue, IMG *timg, int *count)
int imgThresholdTemplate (IMG *img, float minValue, float maxValue, IMG *timg)
int imgThresholdByTemplate (IMG *img, IMG *templt, float thrValue)
void imgCutoff (IMG *image, float cutoff, int mode)
int imgOutlierFilter (IMG *img, float limit)

Function Documentation

void imgCutoff ( IMG *  image,
float  cutoff,
int  mode 
)

Pixel values that exceed or go under a user-defined limit are set to that limit value.

Parameters:
imagePointer to IMG struct which will be filtered here
cutoffCutoff value
modeMode of operation: 0=pixels exceeding the limit are cut off, 1=pixels which go under the limit are cut off

Definition at line 349 of file imgthrs.c.

int imgOutlierFilter ( IMG *  img,
float  limit 
)

Filter out pixels that are over limit x higher than their closest 8 neighbour pixels.

Returns:
Returns the nr of filtered pixels, and negative value in case of an error.

Definition at line 383 of file imgthrs.c.

int imgThresholdByTemplate ( IMG *  img,
IMG *  templt,
float  thrValue 
)

Threshold IMG by a template. Sets pixel values in img to thrValue, if corresponding pixel value in template is == 0. Only first plane of template is used.

Returns:
Returns 0, if ok.
Parameters:
imgImage to threshold
templtThreshold template (1 frame) where 0=cut off
thrValueValue which is written in cut off pixels

Definition at line 324 of file imgthrs.c.

int imgThresholding ( IMG *  img,
float  threshold_level,
int *  thr_nr 
)

Threshold dynamic or static IMG data: pixel time-activity curves (TACs) which have AUC less than Threshold*Max_AUC will be set to zero.

Returns:
Returns 0, if ok.
Parameters:
imgIMG data
threshold_levelThreshold level, e.g. 0.50 will set to zero all pixels that are less than 50% of maximum pixel
thr_nrNumber of pixels that will fall below the threshold level; give NULL pointer, if not needed.

Definition at line 63 of file imgthrs.c.

References imgFrameIntegral().

Here is the call graph for this function:

int imgThresholdingLowHigh ( IMG *  img,
float  lower_threshold_level,
float  upper_threshold_level,
IMG *  timg,
int *  lower_thr_nr,
int *  upper_thr_nr 
)

Threshold dynamic or static IMG data: Checks whether pixel AUCs are lower or higher than the specified threshold levels * Max_AUC. Those pixel TACs are set to zero, or alternatively, if template IMG is given, corresponding template pixel is set to 0.

Returns:
Returns 0, if ok.
Parameters:
img(Dynamic) IMG data
lower_threshold_levelLower threshold level, e.g. 0.10 will set to zero all pixels that are less than 10% of maximum pixel
upper_threshold_levelUpper threshold level, e.g. 0.90 will set to zero all pixels that are over 90% of maximum pixel
timgTemplate image; if empty, then it will be allocated here; if pre-allocated, then template value changed to 0 when necessary, but 0 is never changed to 1; enter NULL, if original TACs are to be thresholded to zeroes
lower_thr_nrNumber of pixels that will fall below the lower threshold level; give NULL pointer, if not needed.
upper_thr_nrNumber of pixels that will fall below the lower threshold level; give NULL pointer, if not needed.

Definition at line 124 of file imgthrs.c.

References imgFrameIntegral().

Here is the call graph for this function:

int imgThresholdTemplate ( IMG *  img,
float  minValue,
float  maxValue,
IMG *  timg 
)

Creates a template image based on lower and upper threshold values. This function allocates memory for the template. If pixel value in original image is >=minValue and <=maxValue, the corresponding template pixel is set to 1, otherwise to 0. Only the first frame of images are used.

Returns:
Returns 0 if ok.
Parameters:
imgOriginal image; only first frame is used here
minValueLower threshold
maxValueUpper threshold
timgTemplate image; if empty, then it will be allocated here; if pre-allocated, then template value changed to 0 when necessary, but 0 is never changed to 1

Definition at line 302 of file imgthrs.c.

References imgThresholdTemplateCount().

Here is the call graph for this function:

int imgThresholdTemplateCount ( IMG *  img,
float  minValue,
float  maxValue,
IMG *  timg,
int *  count 
)

Creates a template image based on lower and upper threshold values. This function allocates memory for the template. If pixel value in original image is >=minValue and <=maxValue, the corresponding template pixel is set to 1, otherwise to 0. Only the first frame of images are used.

Returns:
Returns 0 if ok.
Parameters:
imgOriginal image; only first frame is used here
minValueLower threshold
maxValueUpper threshold
timgTemplate image; if empty, then it will be allocated here; if pre-allocated, then template value changed to 0 when necessary, but 0 is never changed to 1
countThe number of pixels that pass the threshold limits is written here; set to NULL if not needed

Definition at line 241 of file imgthrs.c.

Referenced by imgThresholdTemplate().