golib  0.5
goSignal3DBase< T > Class Template Reference

Base class for up to 3D signals. More...

#include <gosignal3dbase.h>

Public Types

typedef goSignal3DIterator< T > iterator
 

Public Member Functions

virtual void destroy ()
 
virtual goSize_t memoryUsage () const
 Returns the size of this object or some measure of its memory consumption. More...
 
void setChanged ()
 
goCaller0< void > & getChangedCaller ()
 
void setPtr (T *p)
 
const goTypegetDataType () const
 
void setChannel (goSize_t c)
 
goSize_t getChannel () const
 
goPtrdiff_t getChannelOffset (goSize_t channel) const
 Get the pointer offset from a channel 0 element to the corresponding channel channel element. More...
 
virtual void setBorderFlags (int axes=GO_X|GO_Y|GO_Z, int borderFlag=GO_PERIODIC_BORDER)
 Sets the border behaviour. More...
 
virtual void setBorderFlags (const goFixedArray< int > &flags)
 
const goFixedArray< int > & getBorderFlags () const
 
bool setDataType (goTypeEnum t)
 
goDouble getValue (goIndex_t x, goIndex_t y=0, goIndex_t z=0, goSize_t channel=0) const
 Convenience function to get a value. More...
 
void setValue (goDouble value, goIndex_t x, goIndex_t y=0, goIndex_t z=0, goSize_t channel=0)
 Convenience function to set a value. More...
 
T * getPtr ()
 
const T * getPtr () const
 
const T * getRealPtr () const
 
T * getRealPtr ()
 
T * getPtr (goIndex_t x, goIndex_t y, goIndex_t z)
 
const T * getPtr (goIndex_t x, goIndex_t y, goIndex_t z) const
 
const goPtrdiff_t * getXDiff () const
 
const goPtrdiff_t * getYDiff () const
 
const goPtrdiff_t * getZDiff () const
 
goPtrdiff_t * getXDiff ()
 
goPtrdiff_t * getYDiff ()
 
goPtrdiff_t * getZDiff ()
 
const goPtrdiff_t * getXJump () const
 
const goPtrdiff_t * getYJump () const
 
const goPtrdiff_t * getZJump () const
 
goPtrdiff_t * getXJump ()
 
goPtrdiff_t * getYJump ()
 
goPtrdiff_t * getZJump ()
 
void setSize (goSize_t x, goSize_t y, goSize_t z, goSize_t channelCount=1)
 INTERNAL – DO NOT USE. More...
 
void setSize (const goSize3D &sz)
 INTERNAL – DO NOT USE. More...
 
void setSizeX (goSize_t s)
 INTERNAL – DO NOT USE. More...
 
void setSizeY (goSize_t s)
 INTERNAL – DO NOT USE. More...
 
void setSizeZ (goSize_t s)
 INTERNAL – DO NOT USE. More...
 
const goSize3DgetSize () const
 
const goSize3DgetBlockSize () const
 
const goSize3DgetBorderSize () const
 
void resizeBorder (const goSize3D &size)
 Resize the border and re-initialise internal data structures accordingly. More...
 
goSize_t getSizeX () const
 
goSize_t getSizeY () const
 
goSize_t getSizeZ () const
 
goIndex_t getBorderX () const
 
goIndex_t getBorderY () const
 
goIndex_t getBorderZ () const
 
goSize_t getBlockSizeX () const
 
goSize_t getBlockSizeY () const
 
goSize_t getBlockSizeZ () const
 
goSize_t getChannelCount () const
 
const goSignal3DBase< T > & reference (goSignal3DBase< T > &other)
 
bool operator== (goSignal3DBase< T > &other)
 
goDouble getMaximum () const
 
goDouble getMinimum () const
 
void getMinMax (goDouble &minRet, goDouble &maxRet) const
 
virtual void fill (const T *value)
 Fills the current channel. More...
 
virtual void fill (goDouble value)
 
virtual void shiftLeftDiff (int n, int axes=GO_X|GO_Y|GO_Z)
 Copies the last valid values from the block data into the borders. More...
 
virtual void shiftRightDiff (int n, int axes=GO_X|GO_Y|GO_Z)
 
virtual void shiftLeftSize (int n, int axes=GO_X|GO_Y|GO_Z)
 
virtual void shiftRightSize (int n, int axes=GO_X|GO_Y|GO_Z)
 
void rotateAxes ()
 
void swapXY ()
 
void flip (int axis)
 BROKEN. Fix when there's time. More...
 
const T * getClosest (go3Vector< goFloat > &point) const
 
goFloat sample (go3Vector< goFloat > &point)
 
goDouble sum () const
 
goSignal3DBase< T > & operator+= (const goSignal3DBase< T > &other)
 Element-wise operator. More...
 
goSignal3DBase< T > & operator-= (const goSignal3DBase< T > &other)
 Element-wise operator. More...
 
goSignal3DBase< T > & operator*= (const goSignal3DBase< T > &other)
 Element-wise operator. More...
 
goSignal3DBase< T > & operator/= (const goSignal3DBase< T > &other)
 Element-wise operator. More...
 
goSignal3DBase< T > & operator+= (goFloat scalar)
 Element-wise operator. More...
 
goSignal3DBase< T > & operator-= (goFloat scalar)
 Element-wise operator. More...
 
goSignal3DBase< T > & operator*= (goFloat scalar)
 Element-wise operator. More...
 
goSignal3DBase< T > & operator/= (goFloat scalar)
 Element-wise operator. More...
 
void applyBorderFlags (int axis)
 
void applyBorderFlags ()
 
template<>
goDouble getValue (goIndex_t x, goIndex_t y, goIndex_t z, goSize_t channel) const
 
template<>
void setValue (goDouble value, goIndex_t x, goIndex_t y, goIndex_t z, goSize_t channel)
 
template<>
goFloat sample (go3Vector< goFloat > &point)
 
template<>
goDouble getMaximum () const
 
template<>
goDouble getMaximum () const
 
template<>
goDouble getMinimum () const
 
template<>
goDouble getMinimum () const
 
template<>
void fill (goDouble v)
 
template<>
goFloat sample (go3Vector< goFloat > &point)
 
template<>
goSignal3DBase< void * > & operator+= (goFloat scalar)
 
template<>
goSignal3DBase< void * > & operator-= (goFloat scalar)
 
template<>
goSignal3DBase< void * > & operator*= (goFloat scalar)
 
template<>
goSignal3DBase< void * > & operator/= (goFloat scalar)
 
- Public Member Functions inherited from goObjectBase
 goObjectBase ()
 Constructor.
 
virtual ~goObjectBase ()
 Destructor. More...
 
const char * getClassName () const
 Returns the class name. More...
 
int getClassID () const
 
void setObjectName (const char *name)
 Set name string for an object. More...
 
void setObjectName (const goString &name)
 Set name string for an object. More...
 
const goStringgetObjectName () const
 Get the object name. More...
 
virtual bool writeObjectFile (FILE *) const
 Write object to a file. More...
 
virtual bool readObjectFile (FILE *)
 Read object from a file. More...
 
void connectObject (goObjectBase *object)
 Connects an object to this object. More...
 
void disconnectObject (const goObjectBase *object)
 Disconnects an object from this object.
 
virtual bool callObjectMethod (int methodID, goObjectMethodParameters *param=NULL)
 Call an object method by identifier. More...
 
virtual bool queueObjectMethod (int methodID, goObjectMethodParameters *param=NULL, bool blocking=false)
 Enqueue a method call to an internal list of methods. More...
 
bool callQueuedMethods ()
 Call all queued methods. More...
 

Public Attributes

const typedef goSignal3DIterator< T > const_iterator
 

Protected Member Functions

 goSignal3DBase (goSize_t x, goSize_t y, goSize_t z, goSize_t blocksize_x=32, goSize_t blocksize_y=32, goSize_t blocksize_z=32, goSize_t border_x=16, goSize_t border_y=16, goSize_t border_z=16, goSize_t channelCount=1)
 
 goSignal3DBase (goSignal3DBase< T > &other)
 
bool initializeDataType ()
 
bool initialize (T *dataptr, goSize_t x, goSize_t y, goSize_t z, goSize_t blocksize_x=32, goSize_t blocksize_y=32, goSize_t blocksize_z=32, goSize_t border_x=16, goSize_t border_y=16, goSize_t border_z=16, goSize_t channelCount=1)
 
void cleanup ()
 
void setBorder (goSize_t x, goSize_t y, goSize_t z)
 INTERNAL – DO NOT USE. More...
 
void constantBorders (int axes=GO_X|GO_Y|GO_Z)
 
void periodicBorders (int axes=GO_X|GO_Y|GO_Z)
 
template<>
bool initializeDataType () INITIALIZE_DATATYPE_METHOD(GO_INT8)
 
template<>
bool initializeDataType () INITIALIZE_DATATYPE_METHOD(GO_INT16)
 
template<>
bool initializeDataType () INITIALIZE_DATATYPE_METHOD(GO_INT32)
 
template<>
bool initializeDataType () INITIALIZE_DATATYPE_METHOD(GO_UINT8)
 
template<>
bool initializeDataType () INITIALIZE_DATATYPE_METHOD(GO_UINT16)
 
template<>
bool initializeDataType () INITIALIZE_DATATYPE_METHOD(GO_UINT32)
 
template<>
bool initializeDataType () INITIALIZE_DATATYPE_METHOD(GO_FLOAT)
 
template<>
bool initializeDataType () INITIALIZE_DATATYPE_METHOD(GO_DOUBLE)
 
template<>
bool initializeDataType () INITIALIZE_DATATYPE_METHOD(GO_VOID_POINTER)
 
template<>
bool initializeDataType () INITIALIZE_DATATYPE_METHOD(GO_COMPLEX_SINGLE)
 
- Protected Member Functions inherited from goObjectBase
void setClassID (int id)
 Sets the class name.
 
void printClassMessage (const char *msg)
 Sets the class name. More...
 
void printClassMessage (goString &msg)
 Prints an informational message to the calling console. More...
 
void sendObjectMessage (int messageID, void *data=NULL)
 Sends a message to all connected objects.
 
void sendObjectMessage (goObjectBase *object, int messageID, void *data=NULL)
 Sends a message to a specific object.
 
virtual void receiveObjectMessage (const goObjectMessage &message)
 Receive a message. More...
 

Protected Attributes

T * ptr
 
T * real_ptr
 
goPtrdiff_t * xDiff
 
goPtrdiff_t * yDiff
 
goPtrdiff_t * zDiff
 
goPtrdiff_t * real_xDiff
 
goPtrdiff_t * real_yDiff
 
goPtrdiff_t * real_zDiff
 
goPtrdiff_t * myXJump
 
goPtrdiff_t * myYJump
 
goPtrdiff_t * myZJump
 
goPtrdiff_t * real_myXJump
 
goPtrdiff_t * real_myYJump
 
goPtrdiff_t * real_myZJump
 
goPtrdiff_t * myChannelOffset
 
goSize3D mySize
 
goSize3D myBorderSize
 
goSize3D myBlockSize
 
goSize3D myBlocks
 
goType myDataType
 
goSize_t myChannelCount
 
goSize_t myChannel
 
goFixedArray< int > myBorderFlags
 

Detailed Description

template<class T>
class goSignal3DBase< T >

Base class for up to 3D signals.

This can be used as a template class as you would expect, giving the data type as template parameter. Alternatively, giving void as template parameter, goSignal3DBase and its derivatives can be used as a generic signal container with variable data type. This behaviour is preferable in many situations.

This class can handle multichannel data (such as RGBA). To select a channel, use setChannel(). All data access functions will then work so that any accessed data value is from the selected channel. For details on how to create a multichannel see goSignal3D

Note
Although instances for many explicit data types are provided, it is recommended to use the special void type instantiation.
Todo:

The void implementation may not completely be done. Check if some of the routines in gosignal3d and base are still marked as "not yet implemented".

typedef the void instantiation to something else and use that.

Author
Christian Gosch

Member Function Documentation

◆ fill()

template<class T>
void goSignal3DBase< T >::fill ( const T *  value)
virtual

Fills the current channel.

Parameters
valuepointer to a value.

Reimplemented in goSignal3D< void >, and goSignal3D< T >.

◆ flip()

template<class T >
void goSignal3DBase< T >::flip ( int  axis)

BROKEN. Fix when there's time.

Todo:
BROKEN. Fix when there's time.
Bug:
BROKEN. Fix when there's time.
Parameters
axisAxis to flip.

◆ getChannelOffset()

template<class T>
goPtrdiff_t goSignal3DBase< T >::getChannelOffset ( goSize_t  channel) const
inline

Get the pointer offset from a channel 0 element to the corresponding channel channel element.

Parameters
channelChannel to which the pointer offset is wanted.
Returns
Pointer offset to channel element.

◆ getSizeX()

template<class T >
goSize_t goSignal3DBase< T >::getSizeX ( ) const
Returns
Size in samples in x direction.

◆ getSizeY()

template<class T >
goSize_t goSignal3DBase< T >::getSizeY ( ) const
Returns
Size in samples in y direction.

◆ getSizeZ()

template<class T >
goSize_t goSignal3DBase< T >::getSizeZ ( ) const
Returns
Size in samples in z direction.

◆ getValue()

template<class T >
goDouble goSignal3DBase< T >::getValue ( goIndex_t  x,
goIndex_t  y = 0,
goIndex_t  z = 0,
goSize_t  channel = 0 
) const

Convenience function to get a value.

Note
This is slow.

Get a value at a specific position conveniently and type independent. While this is ok for a single value, it is slow for use in a loop. Use the goSignal3DGenericIterator family of classes for fast iteration over signals.

Parameters
xX coordinate
yY coordinate
zZ coordinate
channelChannel number
Returns
The value at the given position.

◆ memoryUsage()

template<class T >
goSize_t goSignal3DBase< T >::memoryUsage ( ) const
virtual

Returns the size of this object or some measure of its memory consumption.

Overload this function as you please and as it makes sense.

Returns
Size in bytes of this object.

Reimplemented from goObjectBase.

Reimplemented in goSignal3D< T >, and goSignal3D< void >.

◆ operator*=() [1/2]

template<class T>
goSignal3DBase< T > & goSignal3DBase< T >::operator*= ( const goSignal3DBase< T > &  other)

Element-wise operator.

All operator [/+-*]= work on all channels, up to the minimum number of channels of this object and the other object

Parameters
otherSignal to combine with.
Returns
Reference to *this.

◆ operator*=() [2/2]

template<class T>
goSignal3DBase< T > & goSignal3DBase< T >::operator*= ( goFloat  scalar)

Element-wise operator.

*= Operator.

All operator [/+-*]= work on all channels.

Parameters
scalarScalar to multiply each value in this signal with.
Returns
Reference to *this.
See also
operator+=
Parameters
scalar
Returns
*this

◆ operator+=() [1/2]

template<class T>
goSignal3DBase< T > & goSignal3DBase< T >::operator+= ( const goSignal3DBase< T > &  other)

Element-wise operator.

All operator [/+-*]= work on all channels, up to the minimum number of channels of this object and the other object

Parameters
otherSignal to combine with.
Returns
Reference to *this.

◆ operator+=() [2/2]

template<class T>
goSignal3DBase< T > & goSignal3DBase< T >::operator+= ( goFloat  scalar)

Element-wise operator.

Add a scalar to each element in the signal.

All operator [/+-*]= work on all channels.

Parameters
otherSignal to combine with.
Returns
Reference to *this.

Adds a scalar to each element in the signal. Implemented for all types, but please use void. The others may be discontinued in the future.

Note
For void type signals (use them!), the operation is carried out for all channels, since this seemed more natural to me, especially for *= operations. All ?= operators behave the same in this respect. Operators which accept another goSignal3D[Base] do NOT behave like this. That may change in the future. Also see the helper functions (namely, goMath::vectorMult()) in gomath.h.
Parameters
scalarScalar.
Returns
*this

◆ operator-=() [1/2]

template<class T>
goSignal3DBase< T > & goSignal3DBase< T >::operator-= ( const goSignal3DBase< T > &  other)

Element-wise operator.

All operator [/+-*]= work on all channels, up to the minimum number of channels of this object and the other object

Parameters
otherSignal to combine with.
Returns
Reference to *this.

◆ operator-=() [2/2]

template<class T>
goSignal3DBase< T > & goSignal3DBase< T >::operator-= ( goFloat  scalar)

Element-wise operator.

-= Operator.

All operator [/+-*]= work on all channels.

Parameters
otherSignal to combine with.
Returns
Reference to *this.
See also
operator+=
Parameters
scalar
Returns
*this

◆ operator/=() [1/2]

template<class T>
goSignal3DBase< T > & goSignal3DBase< T >::operator/= ( const goSignal3DBase< T > &  other)

Element-wise operator.

All operator [/+-*]= work on all channels, up to the minimum number of channels of this object and the other object

Parameters
otherSignal to combine with.
Returns
Reference to *this.

◆ operator/=() [2/2]

template<class T>
goSignal3DBase< T > & goSignal3DBase< T >::operator/= ( goFloat  scalar)

Element-wise operator.

/= Operator.

All operator [/+-*]= work on all channels.

Parameters
otherSignal to combine with.
Returns
Reference to *this.
See also
operator+=
Parameters
scalar
Returns
*this

◆ operator==()

template<class T>
bool goSignal3DBase< T >::operator== ( goSignal3DBase< T > &  other)

"Deep" comparison of the actual data.

◆ reference()

template<class T>
const goSignal3DBase< T > & goSignal3DBase< T >::reference ( goSignal3DBase< T > &  other)

Does not perform a deep copy, instead copies size and pointer difference values and the pointer to the signal data.

◆ resizeBorder()

template<class T >
void goSignal3DBase< T >::resizeBorder ( const goSize3D size)

Resize the border and re-initialise internal data structures accordingly.

Newly set border flags (setBorderFlags()) will be taken into account automatically.

Parameters
sizeNew border size.

◆ rotateAxes()

template<class T >
void goSignal3DBase< T >::rotateAxes ( )
inline

Not threadsafe

◆ setBorder()

template<class T >
void goSignal3DBase< T >::setBorder ( goSize_t  x,
goSize_t  y,
goSize_t  z 
)
protected

INTERNAL – DO NOT USE.

Returns

◆ setBorderFlags()

template<class T >
void goSignal3DBase< T >::setBorderFlags ( int  axes = GO_X|GO_Y|GO_Z,
int  borderFlag = GO_PERIODIC_BORDER 
)
virtual

Sets the border behaviour.

Note
Changes only become valid when the data is newly allocated using make() after a call to setBorderFlags(), or when applyBorderFlags() is called after setBorderFlags().

Not all axes need to have the same behaviour. If you mix behaviours, be aware that the values in the "corners" of the data set may not be what you expect. Currently they are just the values imposed by the last application of internal periodisation/constantisation functions. I.e. the last behaviour, probably of the z-axis, is mimicked.

Todo:
If border strategies are mixed, make the corners do something defined.
Parameters
axesAxes to apply borderFlag to. One or more of {GO_X,GO_Y,GO_Z} or'ed together. Default is all axes.
borderFlagFlag to apply to the borders. One of {GO_PERIODIC_BORDER,GO_CONSTANT_BORDER}. Default is periodic for all axes.

Reimplemented in goSubSignal3D< T >, and goSubSignal3D< void >.

◆ setChannel()

template<class T >
void goSignal3DBase< T >::setChannel ( goSize_t  c)
Todo:
This will be a problem with const objects. Find out how that can be solved without const_cast<>

◆ setSize() [1/2]

template<class T >
void goSignal3DBase< T >::setSize ( const goSize3D sz)

INTERNAL – DO NOT USE.

Returns

◆ setSize() [2/2]

template<class T >
void goSignal3DBase< T >::setSize ( goSize_t  x,
goSize_t  y,
goSize_t  z,
goSize_t  channelCount = 1 
)

INTERNAL – DO NOT USE.

Returns

◆ setSizeX()

template<class T >
void goSignal3DBase< T >::setSizeX ( goSize_t  s)

INTERNAL – DO NOT USE.

Returns

◆ setSizeY()

template<class T >
void goSignal3DBase< T >::setSizeY ( goSize_t  s)

INTERNAL – DO NOT USE.

Returns

◆ setSizeZ()

template<class T >
void goSignal3DBase< T >::setSizeZ ( goSize_t  s)

INTERNAL – DO NOT USE.

Returns

◆ setValue()

template<class T >
void goSignal3DBase< T >::setValue ( goDouble  value,
goIndex_t  x,
goIndex_t  y = 0,
goIndex_t  z = 0,
goSize_t  channel = 0 
)

Convenience function to set a value.

Note
This is slow.

Set a value at a specific position conveniently and type independent. While this is ok for a single value, it is slow for use in a loop. Use the goSignal3DGenericIterator family of classes for fast iteration over signals.

Parameters
valueValue. Will be cast to the appropriate data type.
xX coordinate
yY coordinate
zZ coordinate
channelChannel number

◆ shiftLeftDiff()

template<class T >
void goSignal3DBase< T >::shiftLeftDiff ( int  n,
int  axes = GO_X | GO_Y | GO_Z 
)
virtual

Copies the last valid values from the block data into the borders.

copies a side from the other signal in the border of this signal (border = 1) If you want to copy all sides and take the edges into account, take the order LEFT RIGHT TOP BOTTOM FRONT BACK to copy. See source code for details.

Reimplemented in goSubSignal3D< T >, and goSubSignal3D< void >.


The documentation for this class was generated from the following files: