MeVisLab Toolbox Reference
SoSFMLImage.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #ifndef SO_SFMLIMAGE_H
14 #define SO_SFMLIMAGE_H
15 
17 
18 #include "InventorWrapperDllInit.h"
19 
20 #include <ThirdPartyWarningsDisable.h>
21 #include <Inventor/fields/SoSubField.h>
22 #include <Inventor/SbLinear.h>
23 #include <Inventor/SbLineard.h>
24 #include <ThirdPartyWarningsRestore.h>
25 
26 #include <mlDataTypes.h>
27 
32 {
33 public:
34 
36  MLint x,y,z,c,t,u;
37 
39  inline XVImageSize() { x=y=z=c=t=u=0; };
41  inline XVImageSize(MLint n) { x=y=z=c=t=u=n; };
43  inline XVImageSize(MLint xp, MLint yp, MLint zp, MLint cp, MLint tp, MLint up) { x=xp; y=yp; z=zp; c=cp; t=tp; u=up; };
44 
47 };
48 
49 class SoSFMLImagePrivate;
50 
51 ML_START_NAMESPACE
53  class PagedImage;
54 ML_END_NAMESPACE
55 
56 //=============================================================
59 
69 //=============================================================
70 class INVENTORWRAPPER_API SoSFMLImage : public SoSField {
71 
72  // Use standard field stuff
73  SO_SFIELD_CONSTRUCTOR_HEADER(SoSFMLImage);
74  SO_SFIELD_REQUIRED_HEADER(SoSFMLImage);
75 
76 public:
78  static void initClass();
79 
81  virtual void setValue();
83  SbBool readValue(SoInput* in) override;
85  void writeValue(SoOutput* out) const override;
86 
88  bool isValid();
89 
91  void getSize(XVImageSize &size);
93  void getSize(int &x, int &y, int &z, int &c, int &t, int &u);
95  void getSize(int &x, int &y, int &z, int &c, int &t);
97  void getSize(int &x, int &y, int &z, int &c);
99  void getSize(int &x, int &y, int &z);
101  void getSize(int &x, int &y);
103  void getSize(MLint &x, MLint &y, MLint &z, MLint &c, MLint &t, MLint &u);
105  void getSize(MLint &x, MLint &y, MLint &z, MLint &c, MLint &t);
107  void getSize(MLint &x, MLint &y, MLint &z, MLint &c);
109  void getSize(MLint &x, MLint &y, MLint &z);
111  void getSize(MLint &x, MLint &y);
112 
115 
118 
120  bool isChannelName(MLint n, const char* name);
121 
124 
127  void getType(MLDataType &dtype, size_t &dsize);
129  void getType(MLDataType &dtype);
130 
132  void getVoxelSize(float &x, float &y, float &z);
134  void getVoxelSize(double &x, double &y, double &z);
136  void getVoxelSize(float &x, float &y);
138  void getVoxelSize(double &x, double &y);
139 
143 
147 
150  void touch() override;
151 
153 
159  unsigned int getSerialNumber();
160 
162  double getMinValue();
164  double getMaxValue();
165 
169  const ml::ImagePropertyExtension* getImagePropertyExtensionByType(const char* imagePropertyTypeClassName);
170 
172  void connectFromML(void* connector);
176  void *getConnector();
177 
181  ML_NAMESPACE::PagedImage* getPagedImage();
182 
184  bool getTile3D(void* usrMem, MLDataType type, MLint x, MLint y, MLint z,
185  MLint nx, MLint ny, MLint nz);
186 
189  bool getScaledTile3D(void* usrMem, MLDataType type, MLint x, MLint y, MLint z,
190  MLint nx, MLint ny, MLint nz,
191  double srcMin, double srcMax, double dstMin, double dstMax);
192 
194  bool getTile6D(void* usrMem, MLDataType type, XVImageSize &pos,
195  XVImageSize &size);
196 
199  bool getScaledTile6D(void* usrMem, MLDataType type, XVImageSize &pos,
200  XVImageSize &size,
201  double srcMin, double srcMax, double dstMin, double dstMax);
202 
204  void getVoxelToWorldMatrix(float mat[16]);
206  void getVoxelToWorldMatrix(double mat[16]);
208  void getVoxelToWorldMatrix(SbMatrix &matrix);
210  void getVoxelToWorldMatrix(SbMatrixd &matrix);
212  void getWorldToVoxelMatrix(float mat[16]);
214  void getWorldToVoxelMatrix(double mat[16]);
216  void getWorldToVoxelMatrix(SbMatrix &matrix);
218  void getWorldToVoxelMatrix(SbMatrixd &matrix);
219 
221  void mapVoxelToWorld(const SbVec3f &src, SbVec3f &dst);
223  void mapVoxelToWorld(const SbVec3d &src, SbVec3d &dst);
225  void mapWorldToVoxel(const SbVec3f &src, SbVec3f &dst);
227  void mapWorldToVoxel(const SbVec3d &src, SbVec3d &dst);
228 
230  void mapVoxelToWorld(float voxelX, float voxelY, float voxelZ,
231  float &worldX, float &worldY, float &worldZ);
233  void mapVoxelToWorld(double voxelX, double voxelY, double voxelZ,
234  double &worldX, double &worldY, double &worldZ);
235 
236 
238  void mapWorldToVoxel(float worldX, float worldY, float worldZ,
239  float &voxelX, float &voxelY, float &voxelZ);
241  void mapWorldToVoxel(double worldX, double worldY, double worldZ,
242  double &voxelX, double &voxelY, double &voxelZ);
243 
245  bool isVoxelInsideImage(double voxelX, double voxelY, double voxelZ);
246 
248  bool isVoxelInsideImage(const SbVec3f &voxelCoord);
250  bool isVoxelInsideImage(const SbVec3d &voxelCoord);
251 
252  protected:
254  SoSFMLImagePrivate* _p;
255 
256  // WARNING: SoSFMLImage should stay binary compatible, so beware of adding
257  // new member variables here, add them to \c SoSFMLImagePrivate!!!
258 };
259 
260 
261 #endif
#define INVENTORWRAPPER_API
Library initialization and export macros for platform independecy of project.
The SoSFMLImage field is the interface used by Inventor Nodes to access image data (in the current im...
Definition: SoSFMLImage.h:70
double getMaxValue()
returns the statistical max value of the image
void getSize(MLint &x, MLint &y, MLint &z)
gets the size of the image
void getVoxelSize(double &x, double &y, double &z)
returns the voxel size in doubles
bool getScaledTile6D(void *usrMem, MLDataType type, XVImageSize &pos, XVImageSize &size, double srcMin, double srcMax, double dstMin, double dstMax)
returns the 6D Tile in the specified user memory with format type (and scales the data from srcMin/sr...
void getVoxelSize(double &x, double &y)
returns the voxel size in doubles
bool getTile3D(void *usrMem, MLDataType type, MLint x, MLint y, MLint z, MLint nx, MLint ny, MLint nz)
returns the 3D Tile in the specified user memory with format type
double getMinValue()
returns the statistical min value of the image
void getVoxelSize(float &x, float &y, float &z)
returns the voxel size in floats
bool isVoxelInsideImage(double voxelX, double voxelY, double voxelZ)
checks if voxel coordinate (in doubles) is inside of the image extend
void mapVoxelToWorld(float voxelX, float voxelY, float voxelZ, float &worldX, float &worldY, float &worldZ)
map from Voxel to World coordinate in float values
void getSize(int &x, int &y)
gets the size of the image
virtual void setValue()
required by Inventor but not used:
void getSize(int &x, int &y, int &z)
gets the size of the image
unsigned int getSerialNumber()
get serial number of current image
void getVoxelToWorldMatrix(SbMatrixd &matrix)
get the VoxelToWorldMatrix as an Inventor double matrix (transposed w.r.t. ML)
void getVoxelToWorldMatrix(float mat[16])
get the VoxelToWorldMatrix as a float array (according to ML conventions)
void mapWorldToVoxel(double worldX, double worldY, double worldZ, double &voxelX, double &voxelY, double &voxelZ)
map from World to Voxel coordinate in double values
void connectFromML(void *connector)
connect to an ML output connector field
void touch() override
touch forces a notification of a changed image, this can be received by a field sensor (Typically thi...
void getWorldToVoxelMatrix(float mat[16])
get the WorldToVoxelMatrix as a float array (according to ML conventions)
double getVoxelVolumeInCubicMillimeters()
Returns the volume of a single voxel in cubic millimeters (mm3).
void writeValue(SoOutput *out) const override
required by Inventor but not used:
SoSFMLImagePrivate * _p
private data of the SoSFMLImage
Definition: SoSFMLImage.h:254
void getWorldToVoxelMatrix(double mat[16])
get the WorldToVoxelMatrix as a double array (according to ML conventions)
void getSize(int &x, int &y, int &z, int &c)
gets the size of the image
void getSize(XVImageSize &size)
gets the size of the image
ml::PagedImage * getPagedImage()
Get access to the underlying ml::PagedImage.
void mapWorldToVoxel(float worldX, float worldY, float worldZ, float &voxelX, float &voxelY, float &voxelZ)
map from World to Voxel coordinate in float values
static void initClass()
Initializes field class, setting up runtime type info.
bool isChannelName(MLint n, const char *name)
check if the name of the n-th channel is the given name
bool getTile6D(void *usrMem, MLDataType type, XVImageSize &pos, XVImageSize &size)
returns the 6D Tile in the specified user memory with format type
bool isVoxelInsideImage(const SbVec3d &voxelCoord)
checks if voxel coordinate is inside of the image extend
void getPageSize(XVImageSize &size)
gets the ML page size of the image
bool isValid()
checks if there is a valid image available
void getWorldToVoxelMatrix(SbMatrixd &matrix)
get the WorldToVoxelMatrix as an Inventor double matrix (transposed w.r.t. ML)
void getType(MLDataType &dtype)
gets the type of the Image: Number of channels, data type as defined in mlDataTypes....
double getVoxelVolumeInMilliliters()
Returns the volume of a single voxel in milliliters (ml).
void getVoxelToWorldMatrix(SbMatrix &matrix)
get the VoxelToWorldMatrix as an Inventor float matrix (transposed w.r.t. ML)
bool getScaledTile3D(void *usrMem, MLDataType type, MLint x, MLint y, MLint z, MLint nx, MLint ny, MLint nz, double srcMin, double srcMax, double dstMin, double dstMax)
returns the 3D Tile in the specified user memory with format type (and scales the data from srcMin/sr...
void getWorldToVoxelMatrix(SbMatrix &matrix)
get the WorldToVoxelMatrix as an Inventor float matrix (transposed w.r.t. ML)
void getSize(MLint &x, MLint &y, MLint &z, MLint &c, MLint &t, MLint &u)
gets the size of the image
void getVoxelToWorldMatrix(double mat[16])
get the VoxelToWorldMatrix as a double array (according to ML conventions)
void mapVoxelToWorld(const SbVec3f &src, SbVec3f &dst)
map from Voxel to World coordinate in float vectors
SbBool readValue(SoInput *in) override
required by Inventor but not used:
MLint getChannels()
returns number of color channels
void getSize(MLint &x, MLint &y)
gets the size of the image
bool isVoxelInsideImage(const SbVec3f &voxelCoord)
checks if voxel coordinate is inside of the image extend
void getSize(int &x, int &y, int &z, int &c, int &t, int &u)
gets the size of the image
void mapVoxelToWorld(double voxelX, double voxelY, double voxelZ, double &worldX, double &worldY, double &worldZ)
map from Voxel to World coordinate in double values
void mapWorldToVoxel(const SbVec3d &src, SbVec3d &dst)
map from World to Voxel coordinate in double vectors
void getVoxelSize(float &x, float &y)
returns the voxel size in floats
void getSize(MLint &x, MLint &y, MLint &z, MLint &c, MLint &t)
gets the size of the image
const ml::ImagePropertyExtension * getImagePropertyExtensionByType(const char *imagePropertyTypeClassName)
Returns a pointer to a constant image property extension, or NULL if not available.
void getType(MLDataType &dtype, size_t &dsize)
gets the type of the Image: Number of channels, data type as defined in mlDataTypes....
void mapWorldToVoxel(const SbVec3f &src, SbVec3f &dst)
map from World to Voxel coordinate in float vectors
void * getConnector()
Return current ML connector or NULL if not connected.
MLint getTimePoints()
returns number of time points
void getSize(MLint &x, MLint &y, MLint &z, MLint &c)
gets the size of the image
void getSize(int &x, int &y, int &z, int &c, int &t)
gets the size of the image
void disconnectFromML()
disconnect from an ML output connector field
void mapVoxelToWorld(const SbVec3d &src, SbVec3d &dst)
map from Voxel to World coordinate in double vectors
SoSFMLImage - field interface to ML images and related classes.
Definition: SoSFMLImage.h:32
INVENTORWRAPPER_API void print()
print the size to stdout
XVImageSize()
create size object with size 0
Definition: SoSFMLImage.h:39
MLint x
public accessible integer sizes
Definition: SoSFMLImage.h:36
XVImageSize(MLint xp, MLint yp, MLint zp, MLint cp, MLint tp, MLint up)
create size object with given sizes
Definition: SoSFMLImage.h:43
XVImageSize(MLint n)
create size object with size n on all components
Definition: SoSFMLImage.h:41
Base class from which one can derive own image properties.
Class which represents an image, which manages properties of an image and image data which is located...
Definition: mlPagedImage.h:70
MLint32 MLDataType
MLDataType.
Definition: mlTypeDefs.h:684
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Definition: mlTypeDefs.h:578