golib  0.5
Data handling for up to 3D data

Classes

class  goDWT< T >
 
class  goDWT3D
 3D discrete wavelet transform. More...
 
class  goFilter1D
 Separable filter for 3D signals. More...
 
class  goFilter3D< T_IN, T_OUT >
 3D filter class. More...
 
class  goHistogram< level_type >
 
class  goCDF< level_type >
 
class  goQuantizer< _input_type, _output_type >
 Quantizer base class. More...
 
class  goSignal3D< T >
 Up to 3-dimensional (signal) data container. More...
 
class  goSignal3DBase< T >
 Base class for up to 3D signals. More...
 
class  goSignal3DGenericIterator
 Iterator for goSignal3DBase<void> class signals. More...
 
class  goSignal3DGenericIterator2< T >
 
class  goSignal3DGenericConstIterator
 
class  goSignal3DIterator< T >
 Iterator for goSignal3DBase<T> class signals. More...
 
class  goSignal3DRef
 Wrapper for any memory area suitable for representation through a goSignal3DBase type object (e.g. simply linearly stored data) More...
 
class  goSignalOperationGeneric
 Generic value-wise operations. More...
 
class  goSignalOperation3< T >
 Element-wise operation of two sources into one target. More...
 
class  goSignalOperation2< T >
 Element-wise operation of one source into one target. More...
 
class  goSignalOperation1< T >
 Element-wise in-place operation. More...
 
class  goSignalOperation1Const< T >
 Element-wise in-place operation on constant data. More...
 
class  goSubSignal3D< T >
 Access to sub-areas of goSignal3DBase objects. More...
 
class  goUniformQuantizer< _input_type, _output_type >
 Uniform quantizer. More...
 

Macros

#define SIGNAL3D_bilinear(__A, __B, __C, __D, __px, __py, __target)
 
#define GO_SIGNAL3D_EACHELEMENT(__dothis, __signal, __type)
 
#define GO_SIGNAL3D_EACHELEMENT_GENERIC(__dothis, __signal)
 For generic (void type) signals. More...
 
#define GO_SIGNAL3D_EACHELEMENT_GENERIC_CONST(__dothis, __signal)
 
#define GO_SIGNAL3D_EACHELEMENT_2(__dothis, __signal, __signal_target, __type, __type_target)
 
#define GO_SIGNAL3D_EACHELEMENT_2_GENERIC(__dothis, __signal, __signal_target)
 
#define GO_SIGNAL3D_EACHELEMENT_2_GENERIC_CONST(__dothis, __signal, __signal_target)
 

Typedefs

typedef goDouble godwt_t
 

Functions

static bool goFileIO::readImage (const char *filename, goSignal3D< void > *signal, bool linear=false) throw (goFileIOException, goTypeException)
 
static bool goFileIO::writeImage (const char *filename, const goSignal3DBase< void > *signal) throw (goFileIOException, goTypeException)
 Write an image file from a goSignal3DBase<void> object. More...
 
bool goNormalizeSignal (const goSignal3DBase< void > *sig, goSignal3D< void > *targetSig)
 Normalizes or translates a float or double type signal to the interval [0,1]. More...
 
bool goNormalizeSignal (goSignal3DBase< void > *sig)
 Normalizes or translates a float or double type signal to the interval [0,1]. More...
 
bool goFindZeroCrossings (const goSignal3DBase< void > *sig, goArray< goPointf > &pointsRet)
 Find zero crossings in sig and return an array of points. More...
 
bool goConvertSignal (const goSignal3DBase< void > *sig, goSignal3DBase< void > *targetSig)
 Convert a signal to another signal with a given data type. More...
 
bool goCopySignal (const goSignal3DBase< void > *sig, goSignal3DBase< void > *targetSig)
 Copies a signal to another signal. More...
 
bool goCopySignalChannel (const goSignal3DBase< void > *sig, goSignal3DBase< void > *targetSig)
 Copies a channel from a signal to another signal. More...
 
template<class T >
bool goCopySignalArray (const goSignal3DBase< void > *sig, T *targetArray, int *strides=0)
 Copies the signal values to the linear array targetArray. More...
 
template<class T >
bool goCopySignalArray (const T *array, goSignal3DBase< void > *targetSig, int *strides=0)
 Copies the values in a linear array to a signal. More...
 
bool goFillSignal (goSignal3DBase< void > *sig, goFloat value)
 Fills a signal with a float value (will be converted). More...
 
bool goRGBAtoScalar (const goSignal3DBase< void > *sig, goSignal3DBase< void > *targetSig)
 Converts an RGBA 3- or 4-channel signal to a scalar 1-channel signal. More...
 
void goSignalInfoText (const goSignal3DBase< void > &sig, goString &strRet, bool html=false)
 Get some description (as ASCII text) for a signal. More...
 
goDouble goSignalMean (const goSignal3DBase< void > &sig)
 Calculate the signal mean. More...
 
void goSignalMeanVariance (const goSignal3DBase< void > &sig, goDouble &mean, goDouble &variance)
 Calculate mean and variance of a signal. More...
 
void goSignalFlipY (const goSignal3DBase< void > &sig, goSignal3DBase< void > &target)
 Flip the signal data in Y direction. More...
 
bool goSignalCOM (const goSignal3DBase< void > &sig, goMath::Vectord &comRet)
 Calculate centre of mass of sig. More...
 
bool goSignalMinMaxCoord (const goSignal3DBase< void > &sig, goDouble thresh, goMath::Vector< goSize_t > &minRet, goMath::Vector< goSize_t > &maxRet)
 Find min and max coordinates in sig where the value is below thresh. More...
 
bool goSignalMinMaxCoord (const goSignal3DBase< void > &sig, goAutoPtr< goFunctorBase1< bool, goDouble > > f, goMath::Vector< goSize_t > &minRet, goMath::Vector< goSize_t > &maxRet)
 Generic ROI finding. Find min and max coordinates in sig where f(value) is true. More...
 
bool goSignalMinMaxCoordHigher (const goSignal3DBase< void > &sig, goDouble thresh, goMath::Vector< goSize_t > &minRet, goMath::Vector< goSize_t > &maxRet)
 Like goSignalMinMaxCoord(), but finds a light border. More...
 
bool goSignalCrop (goSignal3DBase< void > &sig, goSubSignal3D< void > &target, goDouble thresh)
 Crop dark or empty borders from sig. More...
 
bool goSignalCrop (goSignal3DBase< void > &sig, goSubSignal3D< void > &target, goAutoPtr< goFunctorBase1< bool, goDouble > > f)
 Generic image cropping. More...
 
bool goSignalCropHigher (goSignal3DBase< void > &sig, goSubSignal3D< void > &target, goDouble thresh)
 Like goSignalCrop(), but crops light border. More...
 
bool goSignalMax (const goSignal3DBase< void > &sig1, const goSignal3DBase< void > &sig2, goSignal3DBase< void > &target)
 
bool goSignalMin (const goSignal3DBase< void > &sig1, const goSignal3DBase< void > &sig2, goSignal3DBase< void > &target)
 
const goSize3DgoSignal::defaultBlockSize3D ()
 
const goSize3DgoSignal::defaultBlockSize2D ()
 
bool goSignal::canny (const goSignal3DBase< void > &image, goSignal3DBase< void > &ret, goDouble thresh1, goDouble thresh2)
 Canny edge detector for 2D images. More...
 
bool goSignal::smooth (goSignal3DBase< void > &sig, goSize_t width=3)
 
bool goSignal::convert (const goSignal3DBase< void > &source, goSignal3DBase< void > &target, const int *source_chan, const int *target_chan, int channelCount)
 
bool goSignal::RGB2BGRA (goSignal3DBase< void > &source, goSignal3DBase< void > &target)
 
bool goSignal::toBGRA (goSignal3DBase< void > &source, goSignal3DBase< void > &target, goFloat alpha=-1.0)
 
goAutoPtr< goSignal3D< void > > goSignal::toBGRA (goSignal3DBase< void > &source, goFloat alpha=-1.0)
 

Detailed Description

Introduction

Golib provides a few classes for handling data storage and access of data arranged in an up to 3-dimensional regular grid. Data can be stored in goSignal3D objects and be accessed through the base class goSignal3DBase or through goSubSignal3D, which provides access to rectilinear sub-regions of a goSignal3DBase. All classes are provided as templates and there are instantiations for the most important simple scalar data types, but it is recommended to use the <void> template parameter and use the (newer) generic interface to the data. The special instantiations do work, but will be deprecated some time in the future and new features will be provided for the <void> instantiations. For those, the data type of the stored data is managed by the class itself. This makes the signal classes more flexible to use and takes away the necessity for functions and classes that use the signal classes also to be templates (which can be a pain).

Organisation

goSignal3DBase is the base class for all signal classes. All data is organised as a rectilinear grid of up to 3 dimensions. The memory is allocated following the concept of data locality by allocating the data in blocks the size of which can be adjusted by the user. This allows for speed-up of code which accesses local neighbourhoods of data points by providing block sizes which enable efficient use of cache structures of the used processor architecture (which naturally is machine dependent). Of cource, by choosing the block size accordingly, data can also be organised linearly. A mechanism allowing to provide borders for a signal is also provided, making it easier to use algorithms which rely on certain assumptions on the border, e.g. that a signal is periodic or that the border is constant.
goSignal3D is the class that actually allocates memory and stores data.
goSubSignal3D can be used to get a window or region of interest from another goSignal3DBase.

Usage

General Usage And Iterators

Using the signal classes is quite simple once you get used to the fact the data is not linear in memory in general. In the simplest case, data can be accessed by the goSignal3DBase::getPtr() methods. However, this is quite slow if you want to go through a lot of points and not just, say, 10 out of a 1024^3 cube. If you want to iterate over all data points, you can make use of goSignal3DGenericIterator and goSignal3DGenericConstIterator:

  
     goSignal3D<void> mySignal;
     ... // fill the signal, load data, whatever.
     goSignal3DGenericIterator it(&mySignal);
     while(!it.endZ())
     {
         it.resetY();
         while (!it.endY())
         {
             it.resetX();
             while (!it.endX())
             {
                 *(goFloat*)*it = calculate_something();
                 it.incrementX();
             }
             it.incrementY();
         } 
         it.incrementZ();
     }
   
 

The end[X|Y|Z]() methods indicate the end of one of the three dimensions. You can think of the resetX(), resetY(), resetZ() methods as carriage returns for each dimension. The increment methods of course increment the iterator in one dimension. Note that after this loop, you have to resetZ() the iterator in order to be able to use it again in the same manner, since it reached the end of the Z dimension. Also note that if you have multi-channel signals, you must choose the active channel using setChannel() BEFORE initialising (i.e. creating) the iterator.

Multiple Channels

Signals can hold multi-channel data which can be accessed by selecting an active channel with setChannel(). The number of channels can be retrieved with getChannelCount(). Note that the channel data is stored linearly at a point, so by getting the pointer to the 0th channel with the dereference operator of an iterator, you can access the other channels simply by adding the respective value to the pointer. I expect that I will keep this data organisation in the future, so go ahead and use it. But keep in mind that this means using some sort of internal knowledge about the signal storage, which should be avoided in general because of course it is not completely impossible that something is changed about this in the future (however unlikely). However, I think in this case it can mean significant speed-ups.

Reads a PGM (8 bit raw) file into the signal. Signal is newly created.

Todo:
Fix readPGM etc. for signal3d

Writes the signal as 8 bit raw PGM file. The signal should contain only values up to 255, since the values are simply casted to goInt8.

Macro Definition Documentation

◆ GO_SIGNAL3D_EACHELEMENT

#define GO_SIGNAL3D_EACHELEMENT (   __dothis,
  __signal,
  __type 
)
Value:
{ \
__type *__ptr_z = __signal.getPtr(0, 0, 0); \
__type *__ptr; \
__type *__ptr_y; \
const goPtrdiff_t* __dx = __signal.getXDiff(); \
const goPtrdiff_t* __dy = __signal.getYDiff(); \
const goPtrdiff_t* __dz = __signal.getZDiff(); \
goSize_t __i,__j,__k; \
\
for (__i = 0; __i < __signal.getSizeZ(); __i++) \
{ \
__ptr_y = __ptr_z; \
for (__j = 0; __j < __signal.getSizeY(); __j++) \
{ \
__ptr = __ptr_y; \
for (__k = 0; __k < __signal.getSizeX(); __k++) \
{ \
{ \
__dothis; \
__ptr += __dx[__k]; \
} \
} \
__ptr_y += __dy[__j]; \
} \
__ptr_z += __dz[__i]; \
} \
\
}

Executes __dothis for each element in the goSignal3D __signal of type __type.
The signal is went through using the pointer differences provided by goSignal3D.

Author
Christian Gosch

◆ GO_SIGNAL3D_EACHELEMENT_2

#define GO_SIGNAL3D_EACHELEMENT_2 (   __dothis,
  __signal,
  __signal_target,
  __type,
  __type_target 
)

Does the same as GO_SIGNAL3D_EACHELEMENT but provides walking through 2 signals of the same size. That can be used to store the results in a second signal.

Examples
dwt.cc, and filter3d.cc.

◆ GO_SIGNAL3D_EACHELEMENT_GENERIC

#define GO_SIGNAL3D_EACHELEMENT_GENERIC (   __dothis,
  __signal 
)

For generic (void type) signals.

__dothis will be executed for each signal sample. The pointer __ptr is a pointer to the first byte of the current sample. Cast to an appropriate pointer.

Parameters
__dothisCode to be executed in the inner loop.
__signalSignal.

◆ GO_SIGNAL3D_EACHELEMENT_GENERIC_CONST

#define GO_SIGNAL3D_EACHELEMENT_GENERIC_CONST (   __dothis,
  __signal 
)
Value:
{ \
const goUInt8 *__ptr_z = (const goUInt8*)__signal.getPtr(0, 0, 0); \
const goUInt8 *__ptr; \
const goUInt8 *__ptr_y; \
const goPtrdiff_t* __dx = __signal.getXDiff(); \
const goPtrdiff_t* __dy = __signal.getYDiff(); \
const goPtrdiff_t* __dz = __signal.getZDiff(); \
goSize_t __i,__j,__k; \
\
for (__i = 0; __i < __signal.getSizeZ(); __i++) \
{ \
__ptr_y = __ptr_z; \
for (__j = 0; __j < __signal.getSizeY(); __j++) \
{ \
__ptr = __ptr_y; \
for (__k = 0; __k < __signal.getSizeX(); __k++) \
{ \
{ \
__dothis; \
__ptr += __dx[__k]; \
} \
} \
__ptr_y += __dy[__j]; \
} \
__ptr_z += __dz[__i]; \
} \
\
}

◆ SIGNAL3D_bilinear

#define SIGNAL3D_bilinear (   __A,
  __B,
  __C,
  __D,
  __px,
  __py,
  __target 
)
Value:
{ \
goFloat __p1 = __A + ((__B - __A)*__px); \
goFloat __p2 = __C + ((__D - __C)*__px); \
__target = (__p1 + ((__p2 - __p1)*__py)); \
}

Typedef Documentation

◆ godwt_t

typedef goDouble godwt_t

Type for transformed data. Using goDouble for this takes double the amount of memory than goFloat. The goDouble Haar transforms are about 18 percent slower than the goFloat operations. There is, however, a loss in precision when using goFloat.

Function Documentation

◆ canny()

bool goSignal::canny ( const goSignal3DBase< void > &  image,
goSignal3DBase< void > &  ret,
goDouble  thresh1,
goDouble  thresh2 
)

Canny edge detector for 2D images.

Compute the edge map after Canny. The detector consists of 3 steps: First, a Sobel operator is run on the image to find gradient directions and magnitudes. If the image is a colour image (in RGB(A)), it will be converted to a scalar gray value image first. Second, non-maximum suppression is used to thin out the result of the Sobel operator. Third, a hysteresis thresholding is used to reduce the edge map to prominent edgels. Here, thresh1 is the high threshold, and thresh2 is the low threshold. That means that first, only the responses higher than thresh1 are marked as edgels, and then neighbouring responses higher than thresh2 are added successively.

Parameters
imageImage
retReturn value, contains the edge map on successful return. Must be properly sized or must be a goSignal3D<void>. If in the latter case it is not of matching size, it will be resized and the type will be set to GO_UINT8.
thresh1High threshold for hysteresis (default 80.0)
thresh2Low threshold for hysteresis (default 40.0)
Returns
True is successful, false otherwise.

◆ goConvertSignal()

bool goConvertSignal ( const goSignal3DBase< void > *  sig,
goSignal3DBase< void > *  targetSig 
)

Convert a signal to another signal with a given data type.

The signal sig will be converted if possible to targetSig. The target data type is determined by the data type of targetSig. (set with targetSig->setDataType()). The size of the target signal must be the same as the source signal. The signals should only differ in their data types.

Parameters
sigPointer to the signal to convert.
targetSigPointer to the target signal. The size must be the same as sig.
Returns
True if successful, false otherwise.

◆ goCopySignal()

bool goCopySignal ( const goSignal3DBase< void > *  sig,
goSignal3DBase< void > *  targetSig 
)

Copies a signal to another signal.

The signals do not have to have the same data type. The size is not checked, but each dimension is only copied until the smallest size is reached. Same holds for channels. All channels are copied until one of the signals runs out of channels.

Parameters
sigSignal to copy.
targetSigSignal to hold the target.
Returns
True if successful, false otherwise.

◆ goCopySignalArray() [1/2]

template<class T >
bool goCopySignalArray ( const goSignal3DBase< void > *  sig,
T *  targetArray,
int *  strides 
)

Copies the signal values to the linear array targetArray.

The values will be copied in the order X, then Y, then Z.

Parameters
sigSignal to copy.
targetArrayLinear target array.
stridesFor each dimension, the stride to take in array, in number of elements. May be null, in that case array is assumed to simply linear.
Returns
True if successful, false otherwise.

◆ goCopySignalArray() [2/2]

template<class T >
bool goCopySignalArray ( const T *  array,
goSignal3DBase< void > *  targetSig,
int *  strides 
)

Copies the values in a linear array to a signal.

The size of targetSig must be pre-set and it must be allocated ( e.g. with make() ).

Parameters
arrayArray containing values.
targetSigTarget signal.
stridesFor each dimension, the stride to take in array, in number of elements. May be null, in that case array is assumed to simply linear.
Returns
True if successful, false otherwise.

◆ goCopySignalChannel()

bool goCopySignalChannel ( const goSignal3DBase< void > *  sig,
goSignal3DBase< void > *  targetSig 
)

Copies a channel from a signal to another signal.

The signals do not have to have the same data type. The size is not checked, but each dimension is only copied until the smallest size is reached. The currently active channel from sig is copied to the currently active channel of targetSig.

Parameters
sigSignal to copy.
targetSigSignal to hold the target.
Returns
True if successful, false otherwise.
Examples
videocapture/videocapture.cpp.

◆ goFillSignal()

bool goFillSignal ( goSignal3DBase< void > *  sig,
goFloat  value 
)

Fills a signal with a float value (will be converted).

Parameters
sigSignal to fill.
valueFloat value. This value will be converted to an appropriate data type for the signal.
Returns
True if successful, false otherwise.

◆ goFindZeroCrossings()

bool goFindZeroCrossings ( const goSignal3DBase< void > *  sig,
goArray< goPointf > &  pointsRet 
)

Find zero crossings in sig and return an array of points.

On returning true, pointsRet will contain the point coordinates of zero crossings on the grid lines of sig.

Parameters
sigSignal to search in.
pointsRetPoints array (return value).
Returns
True if successful, false otherwise.

◆ goNormalizeSignal() [1/2]

bool goNormalizeSignal ( const goSignal3DBase< void > *  sig,
goSignal3D< void > *  targetSig 
)

Normalizes or translates a float or double type signal to the interval [0,1].

If the signal values are out of the interval [0,1], the signal is normalized to it. If (maxValue - minValue) <= 1.0, the signal values are just translated into [0,1]. This function works only on the currently selected channel.

Parameters
sigSignal to be normalized.
targetSigTarget containing the normalized signal after the call. Note that targetSig is reallocated during the call.
Returns
True if successful, false otherwise (e.g. if the signal is not float or double).

◆ goNormalizeSignal() [2/2]

bool goNormalizeSignal ( goSignal3DBase< void > *  sig)

Normalizes or translates a float or double type signal to the interval [0,1].

Note
This does only work on the currently active channel.

If the signal values are out of the interval [0,1], the signal is normalized to it. If (maxValue - minValue) <= 1.0, the signal values are just translated into [0,1].

Parameters
sigSignal to be normalized.
Returns
True if successful, false otherwise (e.g. if the signal is not float or double).

◆ goRGBAtoScalar()

bool goRGBAtoScalar ( const goSignal3DBase< void > *  sig,
goSignal3DBase< void > *  targetSig 
)

Converts an RGBA 3- or 4-channel signal to a scalar 1-channel signal.

The source signal must have 3 or 4 channels that are interpreted as RGB(A). The alpha channel is currently not taken into account. The conversion is to luminance after ITU CCR 601:
Y = 0.299 * R + 0.587 * G + 0.114 * B

Note
The target signal used to be normalised for GO_FLOAT and GO_DOUBLE types. This is no longer the case.
Parameters
sigSource signal, must be of type GO_UINT8 and have >= 3 channels.
targetSigTarget signal. Data type must be set and the size must be the same as that of the source signal.
Returns
True if successful, false otherwise.

◆ goSignalCOM()

bool goSignalCOM ( const goSignal3DBase< void > &  sig,
goMath::Vectord comRet 
)

Calculate centre of mass of sig.

Parameters
sigData.
comRetOn returning true, contains the centre of mass.
Returns
True if successful, false otherwise.

◆ goSignalCrop() [1/2]

bool goSignalCrop ( goSignal3DBase< void > &  sig,
goSubSignal3D< void > &  target,
goAutoPtr< goFunctorBase1< bool, goDouble > >  f 
)

Generic image cropping.

Given a function f, works like the other goSignalCrop() function but the border is sought using f. Instead of testing for value >= thresh, f(value) == true is tested.

Parameters
sigSignal to crop.
targetOn success, is a sub signal of sig.
fFunctor taking a goDouble and returning a bool.
Returns
True if success, false otherwise.

◆ goSignalCrop() [2/2]

bool goSignalCrop ( goSignal3DBase< void > &  sig,
goSubSignal3D< void > &  target,
goDouble  thresh 
)

Crop dark or empty borders from sig.

Uses goSignalMinMaxCoord() to find a region which contains all values >= thresh.

Parameters
sigSignal to crop.
targetOn success, is a subsignal of sig representing the region of interest.
threshThreshold.
Returns
True if successful, false otherwise.

◆ goSignalCropHigher()

bool goSignalCropHigher ( goSignal3DBase< void > &  sig,
goSubSignal3D< void > &  target,
goDouble  thresh 
)

Like goSignalCrop(), but crops light border.

Crops the borders where value >= thresh.

Parameters
sigSignal to crop.
targetOn success, is a sub signal to sig (the cropped region).
threshThreshold.
Returns
True if successful, false otherwise.

◆ goSignalFlipY()

void goSignalFlipY ( const goSignal3DBase< void > &  sig,
goSignal3DBase< void > &  target 
)

Flip the signal data in Y direction.

This does a deep copy. The actual flip() method for goSignal3DBase is defunct, so this was written as a hack to be able to flip images conveniently. It is, however, slow due to the copy procedure.

Parameters
sigOriginal signal.
targetTarget, contains the flipped sig after return. target must be the same size as sig, or nothing will be copied (check log file).

◆ goSignalInfoText()

void goSignalInfoText ( const goSignal3DBase< void > &  sig,
goString strRet,
bool  html 
)

Get some description (as ASCII text) for a signal.

Parameters
sigSignal to get the description for.
strRetString to hold the description.
htmlIf true, the text will be HTML formatted, if false, the text will be plain ASCII.

◆ goSignalMean()

goDouble goSignalMean ( const goSignal3DBase< void > &  sig)

Calculate the signal mean.

Parameters
sigSignal to calculate the mean of.
Returns
Mean value as goDouble. For multichannel signals, just do setChannel() and then goSignalMean() for each channel.

◆ goSignalMeanVariance()

void goSignalMeanVariance ( const goSignal3DBase< void > &  sig,
goDouble &  mean,
goDouble &  variance 
)

Calculate mean and variance of a signal.

Parameters
sigSignal.
meanAfter returning, holds the mean value as double.
varianceAfter returning, holds the variance as double.

◆ goSignalMinMaxCoord() [1/2]

bool goSignalMinMaxCoord ( const goSignal3DBase< void > &  sig,
goAutoPtr< goFunctorBase1< bool, goDouble > >  f,
goMath::Vector< goSize_t > &  minRet,
goMath::Vector< goSize_t > &  maxRet 
)

Generic ROI finding. Find min and max coordinates in sig where f(value) is true.

Given a function f, works like the other goSignalCrop() function but the border is sought using f. Instead of testing for value >= thresh, f(value) == true is tested.

See also
goSignalMinMaxCoord()
Parameters
sigSignal.
fPointer to a functor returning bool, taking one goDouble as argument.
minRetOn success, contains the minimum coordinates of the rectangular region of interest with values for which f() is true.
maxRetOn success, contains the maximum coordinates of the rectangular region of interest with values for which f() is true.
Returns
True if success, false otherwise.

◆ goSignalMinMaxCoord() [2/2]

bool goSignalMinMaxCoord ( const goSignal3DBase< void > &  sig,
goDouble  thresh,
goMath::Vector< goSize_t > &  minRet,
goMath::Vector< goSize_t > &  maxRet 
)

Find min and max coordinates in sig where the value is below thresh.

This gets e.g. used in goSignalCrop(). It finds the rectangular region of interest which contains all values larger than thresh. Good for example to crop dark borders from images or simply "empty space".

Parameters
sigSignal.
threshThreshold.
minRetOn success, contains the minimum coordinates of the rectangular region of interest with values larger than thresh.
maxRetOn success, contains the maximum coordinates of the rectangular region of interest with values larger than thresh.
Returns
True if successful, false otherwise.

◆ goSignalMinMaxCoordHigher()

bool goSignalMinMaxCoordHigher ( const goSignal3DBase< void > &  sig,
goDouble  thresh,
goMath::Vector< goSize_t > &  minRet,
goMath::Vector< goSize_t > &  maxRet 
)

Like goSignalMinMaxCoord(), but finds a light border.

Finds the borders when they have values higher than thresh.

See also
goSignalMinMaxCoord()
Parameters
sigSignal.
threshThreshold.
minRetOn success, contains the min. coordinates of the region of interest without the light border.
maxRetOn success, contains the max. coordinates of the region of interest without the light border.
Returns
True if successful, false otherwise.

◆ writeImage()

bool goFileIO::writeImage ( const char *  filename,
const goSignal3DBase< void > *  signal 
)
throw (goFileIOException,
goTypeException
)
static

Write an image file from a goSignal3DBase<void> object.

This function needs goLib to be compiled with support for the libIL image library. The supported image types depend on the types supported by libIL. At the time of this being written, those were

  • .bmp
  • .dds
  • .jpg
  • .pcx
  • .png
  • .pnm
  • .raw
  • .sgi
  • .tga
  • .tif
  • .pal

Note that these differ from the types supported for reading. The image type is selected by the filename's suffix.

Parameters
filenameName for the image file.
signalgoSignal3DBase<void> to be saved (currently only GO_FLOAT).
Note
This method only works when libGo was compiled with libIL support (http://openil.sourceforge.net). If not, it always returns false.
This does not yet work for multichannel data.
Todo:
This works only for float signals. Add other types. Add multichannel.
Returns
True if successful, false otherwise.
Examples
videocapture/videocapture.cpp.