13#ifndef ML_RASTER_FUNCTION_H 
   14#define ML_RASTER_FUNCTION_H 
   57typedef bool (*WorldVoxelTestFunction)(
const Vector6 &p,  
void *userData);
 
  108    { _voxelTestFunction = f; _voxelTestFunctionData = data; };
 
 
  110    { f = _voxelTestFunction; data = _voxelTestFunctionData; };
 
 
  117    { _worldVoxelTestFunction = f; _worldVoxelTestFunctionData = data; };
 
 
  119    { f = _worldVoxelTestFunction; data = _worldVoxelTestFunctionData; };
 
 
  128    { _modifierFunction = f; _modifierFunctionData = data; };
 
 
  130    { f = _modifierFunction; data = _modifierFunctionData; };
 
 
  202    template <
typename DATATYPE>
 
  213        for (p.u=box.
v1.u;  p.u<=box.
v2.u;  p.u++){
 
  214            for (p.t=box.
v1.t;  p.t<=box.
v2.t;  p.t++){
 
  215                for (p.c=box.
v1.c;  p.c<=box.
v2.c;  p.c++){
 
  219                    for (p.z=box.
v1.z;  p.z<=box.
v2.z;  p.z++){
 
  227                        switch (_testFuncMode){
 
  233                            if (_voxelTestFunction){
 
  234                                for (p.y=box.
v1.y;  p.y<=box.
v2.y;  p.y++){
 
  236                                    if (_useModifierFunction && _modifierFunction){
 
  238                                        for (p.x=box.
v1.x;  p.x<=box.
v2.x;  p.x++){
 
  239                                            if (_voxelTestFunction(p, _voxelTestFunctionData)){
 
  240                                                _modifierFunction(
pSubImg, p, _modifierFunctionData);
 
  246                                        for (p.x=box.
v1.x;  p.x<=box.
v2.x;  p.x++){
 
  247                                            if (_voxelTestFunction(p, _voxelTestFunctionData)){
 
  260                            for (p.y=box.
v1.y;  p.y<=box.
v2.y;  p.y++){
 
  262                                if (_useModifierFunction && _modifierFunction){
 
  264                                    for (p.x=box.
v1.x;  p.x<=box.
v2.x;  p.x++){
 
  265                                        if (isVoxelInside(p)) _modifierFunction(
pSubImg, p, _modifierFunctionData);
 
  270                                    for (p.x=box.
v1.x;  p.x<=box.
v2.x;  p.x++){
 
  282                            if (_worldVoxelTestFunction){
 
  286                                for (p.y=box.
v1.y;  p.y<=box.
v2.y;  p.y++){
 
  292                                    if (_useModifierFunction && _modifierFunction){
 
  294                                        for (p.x=box.
v1.x;  p.x<=box.
v2.x;  p.x++){
 
  295                                            if (_worldVoxelTestFunction(moveX, _worldVoxelTestFunctionData)){
 
  296                                                _modifierFunction(
pSubImg, p, _modifierFunctionData);
 
  304                                        for (p.x=box.
v1.x;  p.x<=box.
v2.x;  p.x++){
 
  305                                            if (_worldVoxelTestFunction(moveX, _worldVoxelTestFunctionData)){
 
  325                            for (p.y=box.
v1.y;  p.y<=box.
v2.y;  p.y++){
 
  331                                if (_useModifierFunction && _modifierFunction){
 
  333                                    for (p.x=box.
v1.x;  p.x<=box.
v2.x;  p.x++){
 
  334                                        if (isWorldVoxelInside(moveX)){
 
  335                                            _modifierFunction(
pSubImg, p, _modifierFunctionData);
 
  343                                    for (p.x=box.
v1.x;  p.x<=box.
v2.x;  p.x++){
 
  344                                        if (isWorldVoxelInside(moveX)){
 
  357                            ML_PRINT_WARNING(
"void RasterFunction::_fillRaster(const SubImageBox &box, TSubImage<DATATYPE> *pSubImg, Vector3 tBase[4]) const", 
ML_BAD_PARAMETER, 
"Not rastering!");
 
 
  376    void              _composeMatrices();
 
  412    void *            _voxelTestFunctionData;
 
  418    void *            _worldVoxelTestFunctionData;
 
  423    bool              _useModifierFunction;
 
  425    void *            _modifierFunctionData;
 
 
Class representing general ML objects that support import/export via strings (setPersistentState() an...
 
Base object to handle implicit or explicit functions to draw into subimages.
 
virtual bool isWorldVoxelInside(const Vector6 &) const
The implicit function used to test whether a point p is inside (result == 1), onto (result == 0) or o...
 
const SubImageBox & getVoxBoundingBox() const
Set/Get bounding boxes of objects in implicit functions in voxel or in world coordinates.
 
const Matrix4 & getVoxToWorld() const
 
void enableBGFilling(bool val)
 
void _fillRaster(const SubImageBox &box, TSubImage< DATATYPE > *pSubImg, Vector3 tBase[4]) const
Test all voxels within pSubImg against the selected function if they are inside box.
 
void setPersistentState(const std::string &) override
Restores the object's internal state from a string that had been previously generated using persisten...
 
void setWorldBoundingBox(const SubImageBoxd &box)
 
void getModifierFunction(ModifierFunction &f, void *&data) const
 
const Matrix4 & getPretransform() const
 
~RasterFunction() override
Destructor.
 
void setWorldVoxelTestFunction(WorldVoxelTestFunction f, void *data)
 
void getWorldVoxelTestFunction(WorldVoxelTestFunction &f, void *&data) const
 
TestFuncMode getFunctionMode() const
 
void setVoxToWorld(const Matrix4 &v2w)
 
std::string persistentState() const override
Returns a string describing the object's internal state.
 
double getFillValue() const
 
void getVoxelTestFunction(VoxelTestFunction &f, void *&data) const
 
RasterFunction(const RasterFunction &f)
Copy constructor.
 
void setBGFillValue(double val)
 
virtual void _getTransformBase(const ImageVector &p, Vector3 tBase[4]) const
Get world coordinate of p, and world vectors from p to p+(1,0,0), to p+(0,1,0) and p+(0,...
 
bool isModifierFunctionOn() const
 
virtual SubImageBox _transformSubImgBox(const SubImageBoxd &box) const
Transforms a subImgBox from world coordinates to a subImgBox in voxel coordinates.
 
void setVoxelTestFunction(VoxelTestFunction f, void *data)
 
virtual SubImageBox _getClipBox(const SubImageBox &box) const
Returns the subImgBox whose voxels are going to be tested.
 
void setVoxBoundingBox(const SubImageBox &box)
 
virtual bool isVoxelInside(const ImageVector &) const
The implicit function used to test whether a point p is inside (result == 1), onto (result == 0) or o...
 
RasterFunction()
Constructor.
 
virtual RasterFunction * clone() const
Create a clone of the RasterFunction.
 
void setFillValue(double val)
 
virtual void draw(SubImage *sImg) const
Fill intersecting area of sImg with the currently selected function using the transformation matrices...
 
const SubImageBoxd & getWorldBoundingBox() const
 
void enableModifierFunction(bool flag)
 
void setPreTransform(const Matrix4 &pre)
 
void setFunctionMode(TestFuncMode mode)
 
double getBGFillValue() const
 
virtual const RasterFunction & operator=(const RasterFunction &f)
Copy operator.
 
void setModifierFunction(ModifierFunction f, void *data)
 
SubImageBoxd - SubImageBox with coordinates of float data type.
 
This class manages/represents a rectangular 6D image region that is organized linearly in memory.
 
VectorType v1
Corner v1 of the subimage region (included in region).
 
VectorType v2
Corner v2 of the subimage region (also included in region!).
 
This template class manages/represents a rectangular 6D image region in memory that is organized line...
 
#define ML_BAD_PARAMETER
A bad/invalid parameter (or even an inappropriate image) has been passed to a module or an algorithm,...
 
#define ML_PRINT_WARNING(FUNC_NAME, REASON, HANDLING)
Like ML_PRINT_WARNING_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ) without a runtime object to be dumped...
 
#define MLBASEEXPORT
defined Header file mlBaseInit.h
 
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
 
#define ML_CLASS_HEADER(className)
Same like ML_CLASS_HEADER_EXPORTED with a non-existing export symbol.
 
void(* ModifierFunction)(SubImage *tSubImg, const ImageVector &p, void *userData)
Function type which modifies a value in a typed subimage given by tSubImg.
 
bool(* WorldVoxelTestFunction)(const Vector6 &p, void *userData)
Function type used to decide whether a voxel is within an object or not.
 
bool(* VoxelTestFunction)(const ImageVector &p, void *userData)
Function type used to decide whether a voxel is within an object or not.
 
TestFuncMode
The modes how the voxel is tested.