Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoImageFormulaProcessing Class Reference

ImageViz SoImageFormulaProcessing engine computes a new image combining one, two or three images using a given arithmetic formula. More...

#include <ImageViz/Engines/ArithmeticAndLogic/ArithmeticOperations/SoImageFormulaProcessing.h>

+ Inheritance diagram for SoImageFormulaProcessing:

Public Types

enum  DataType {
  UNSIGNED_CHAR = 0 ,
  SIGNED_CHAR = 1 ,
  SHORT_INTEGER = 2 ,
  UNSIGNED_SHORT = 3 ,
  LABEL = 4 ,
  BINARY = 5 ,
  LONG_INTEGER = 6 ,
  FLOATING_POINT = 7
}
 
- Public Types inherited from SoImageVizEngine
enum  ComputeMode {
  MODE_2D = 0 ,
  MODE_3D = 1 ,
  MODE_AUTO = 2
}
 Compute Mode This enum specifies whether the main input will be interpreted as a 3D volume or a stack of 2D images for processing. More...
 
enum  Neighborhood3d {
  CONNECTIVITY_6 = 0 ,
  CONNECTIVITY_18 = 1 ,
  CONNECTIVITY_26 = 2
}
 Neighborhood Connectivity 3D. More...
 

Public Member Functions

 SoImageFormulaProcessing ()
 Constructor.
 
- Public Member Functions inherited from SoImageVizEngine
virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
virtual void startEvaluate ()
 Evaluate engine and dependencies in another thread without blocking the current one.
 
virtual void waitEvaluate ()
 Wait for the end of engine evaluation.
 
virtual void abortEvaluate ()
 Abort current processing as soon as possible.
 
virtual bool isEvaluating ()
 Returns true if the engine evaluation is in progress.
 
- Public Member Functions inherited from SoEngine
virtual int getOutputs (SoEngineOutputList &list) const
 Returns a list of outputs in this engine.
 
SoEngineOutputgetOutput (const SbName &outputName) const
 Returns a reference to the engine output with the given name.
 
SbBool getOutputName (const SoEngineOutput *output, SbName &outputName) const
 Returns (in outputName) the name of the engine output (output).
 
SoEnginecopy () const
 Creates and returns an exact copy of the engine.
 
- Public Member Functions inherited from SoFieldContainer
void setToDefaults ()
 Sets all fields in this object to their default values.
 
SbBool hasDefaultValues () const
 Returns TRUE if all of the object's fields have their default values.
 
SbBool fieldsAreEqual (const SoFieldContainer *fc) const
 Returns TRUE if this object's fields are exactly equal to fc's fields.
 
void copyFieldValues (const SoFieldContainer *fc, SbBool copyConnections=FALSE)
 Copies the contents of fc's fields into this object's fields.
 
SoNONUNICODE SbBool set (const char *fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
SbBool set (const SbString &fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
void get (SbString &fieldDataString)
 Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string.
 
virtual int getFields (SoFieldList &list) const
 Appends references to all of this object's fields to resultList, and returns the number of fields appended.
 
virtual int getAllFields (SoFieldList &list) const
 Returns a list of fields, including the eventIn's and eventOut's.
 
virtual SoFieldgetField (const SbName &fieldName) const
 Returns a the field of this object whose name is fieldName.
 
virtual SoFieldgetEventIn (const SbName &fieldName) const
 Returns a the eventIn with the given name.
 
virtual SoFieldgetEventOut (const SbName &fieldName) const
 Returns the eventOut with the given name.
 
SbBool getFieldName (const SoField *field, SbName &fieldName) const
 Returns the name of the given field in the fieldName argument.
 
SbBool enableNotify (SbBool flag)
 Notification at this Field Container is enabled (if flag == TRUE) or disabled (if flag == FALSE).
 
SbBool isNotifyEnabled () const
 Notification is the process of telling interested objects that this object has changed.
 
virtual void setUserData (void *data)
 Sets application data.
 
void * getUserData (void) const
 Gets user application data.
 
- Public Member Functions inherited from SoBase
virtual void touch ()
 Marks an instance as modified, simulating a change to it.
 
virtual SbName getName () const
 Returns the name of an instance.
 
virtual void setName (const SbName &name)
 Sets the name of an instance.
 
void setSynchronizable (const bool b)
 Sets this to be a ScaleViz synchronizable object.
 
bool isSynchronizable () const
 Gets the ScaleViz synchronizable state of this object.
 
- Public Member Functions inherited from SoRefCounter
void ref () const
 Adds a reference to an instance.
 
void unref () const
 Removes a reference from an instance.
 
void unrefNoDelete () const
 unrefNoDelete() should be called when it is desired to decrement the reference count, but not delete the instance if this brings the reference count to zero.
 
int getRefCount () const
 Returns current reference count.
 
void lock () const
 lock this instance.
 
void unlock () const
 unlock this instance.
 
- Public Member Functions inherited from SoTypedObject
SbBool isOfType (const SoType &type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
 
template<typename TypedObjectClass >
SbBool isOfType () const
 Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
 

Public Attributes

SoSFEnum computeMode
 Select the compute Mode (2D or 3D or AUTO) Use enum ComputeMode.
 
SoSFImageDataAdapter inImage
 The input image.
 
SoSFImageDataAdapter inImage2
 Optional image : enter image or let field empty.
 
SoSFImageDataAdapter inImage3
 Optional image : enter image or let field empty.
 
SoSFString inFormula
 Formula to apply on image(s).
 
SoSFEnum dataType
 Arithmetic format.
 
SoImageVizEngineOutput< SoSFImageDataAdapter, SoImageDataAdapter * > outImage
 The output image.
 
- Public Attributes inherited from SoImageVizEngine
SbEventHandler< EventArg & > onBegin
 Event raised when the processing begins.
 
SbEventHandler< EventArg & > onEnd
 Event raised when processing ends and the result is available.
 
SbEventHandler< EventArg & > onProgress
 Event raised while processing is running.
 

Additional Inherited Members

- Static Public Member Functions inherited from SoImageVizEngine
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- Static Public Member Functions inherited from SoEngine
static SoType getClassTypeId ()
 Returns the type identifier for the SoEngine class.
 
static SoEnginegetByName (const SbName &name)
 Looks up engine(s) by name.
 
static int getByName (const SbName &name, SoEngineList &list)
 Looks up engine(s) by name.
 
- Static Public Member Functions inherited from SoFieldContainer
static SoType getClassTypeId ()
 Returns the type of this class.
 
- Static Public Member Functions inherited from SoBase
static SoType getClassTypeId ()
 Returns type identifier for this class.
 
- Static Public Member Functions inherited from SoTypedObject
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Detailed Description

ImageViz SoImageFormulaProcessing engine computes a new image combining one, two or three images using a given arithmetic formula.

The formula used by this engine must be written according to the custom formula syntax.

Some of the examples below can be implemented with an existing engine. In these cases using the appropriate native engine will be more efficient in term of performance.

Basic usage

    This engine accepts three input images which will be referenced as I1, I2 and I3 in the formula. Images two and three are optional and have to be provided if referenced in the formula.

    For instance, the formula "if(I2==25, I1, 0)" allows to mask an input grey level image I1 with the blob of intensity 25 in a label image I2.

    Figure 1: Extraction of a labeled blob in a greylevel image.

Usage with kernels

    Functions with a variable number of arguments such as min, max, avg, median, sum and product can be used in two ways :

    • to combine images, for instance "min(I1, I2)"
    • to compute kernel operations : "min(I1[7, 7])"

    Kernels can be defined for these function with the following syntax: IN[x,y] in 2d case and IN[x,y,z] in 3d case. Where N references the used image (in [1,3]), and x,y and z corresponds to the expected kernel size.

    For instance, the formula "mean(I1[7, 7])" allows to filter an image I1 by a box filter of size 7x7.

    Figure 2: Box filter processing.

Usage with offsets

    Image offset can be defined in formula respecting following syntax : IN(x,y) in 2d case and IN(x,y,z) in 3d case. Where N references the used image (in [1,3]), and x,y and z corresponds to the offsets from the central current pixel. Symbols IN and IN(0,0) are strictly equivalent.

    These offsets can be used to compute operations depending on pixels surrounding the current pixel to process.

    For instance, a basic horizontal gradient operation can be written "I1(1, 0) - I1(-1, 0)"

    Figure 3: Basic horizontal gradient operation.

Usage of image coordinates

    Image coordinates can be used in a formula: x, y and z represent the current pixel coordinates, ox, oy and oz the image origin and gx, gy and gz the image size.

    For instance, these coordinates can be used to generate synthetic images. A basic line separation can be written as "if (3*x-100<y, 100, 0)":

    Figure 4: Generation of a synthetic image.

    Coordinates can also be used to handle more complex case such as "if ((x- (ox+gx)/2)*(x-(ox+gx)/2)+(y-(oy+gy)/2)*(y-(oy+gy)/2)<=50*50, I1, I2)"

    Figure 5: Custom combination of 2 images.

FILE FORMAT/DEFAULT

    ImageFormulaProcessing {
    computeMode MODE_AUTO
    inImage NULL
    inImage2 NULL
    inImage3 NULL
    inFormula ""
    dataType UNSIGNED_CHAR
    }


Library references: imageformula

Definition at line 117 of file SoImageFormulaProcessing.h.

Member Enumeration Documentation

◆ DataType

Enumerator
UNSIGNED_CHAR 
SIGNED_CHAR 
SHORT_INTEGER 
UNSIGNED_SHORT 
LABEL 
BINARY 
LONG_INTEGER 
FLOATING_POINT 

Definition at line 148 of file SoImageFormulaProcessing.h.

Constructor & Destructor Documentation

◆ SoImageFormulaProcessing()

SoImageFormulaProcessing::SoImageFormulaProcessing ( )

Constructor.

Member Data Documentation

◆ computeMode

SoSFEnum SoImageFormulaProcessing::computeMode

Select the compute Mode (2D or 3D or AUTO) Use enum ComputeMode.

Default is MODE_AUTO

Definition at line 129 of file SoImageFormulaProcessing.h.

◆ dataType

SoSFEnum SoImageFormulaProcessing::dataType

Arithmetic format.

Use enum DataType. Default is UNSIGNED_CHAR

Definition at line 186 of file SoImageFormulaProcessing.h.

◆ inFormula

SoSFString SoImageFormulaProcessing::inFormula

Formula to apply on image(s).

See Custom formula syntax for how to use a formula. Default value is "".

Definition at line 143 of file SoImageFormulaProcessing.h.

◆ inImage

SoSFImageDataAdapter SoImageFormulaProcessing::inImage

The input image.

Default value is NULL. Supported types include: grayscale binary label color image.

Definition at line 132 of file SoImageFormulaProcessing.h.

◆ inImage2

SoSFImageDataAdapter SoImageFormulaProcessing::inImage2

Optional image : enter image or let field empty.

This parameter is optional. Default value is NULL. Supported types include: grayscale binary label color image.

Definition at line 135 of file SoImageFormulaProcessing.h.

◆ inImage3

SoSFImageDataAdapter SoImageFormulaProcessing::inImage3

Optional image : enter image or let field empty.

This parameter is optional. Default value is NULL. Supported types include: grayscale binary label color image.

Definition at line 138 of file SoImageFormulaProcessing.h.

◆ outImage

SoImageVizEngineOutput<SoSFImageDataAdapter,SoImageDataAdapter*> SoImageFormulaProcessing::outImage

The output image.

Default value is NULL. Supported types include: grayscale binary label color image.

Definition at line 189 of file SoImageFormulaProcessing.h.


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