MeVisLab Resolution Independence API
Loading...
Searching...
No Matches
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
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{
33public:
35 MLint x, y, z, c, t, u;
36
38 inline XVImageSize()
39 {
40 x = y = z = c = t = u = 0;
41 };
42
43 inline XVImageSize(MLint n)
44 {
45 x = y = z = c = t = u = n;
46 };
47
48 inline XVImageSize(MLint xp, MLint yp, MLint zp, MLint cp, MLint tp, MLint up)
49 {
50 x = xp;
51 y = yp;
52 z = zp;
53 c = cp;
54 t = tp;
55 u = up;
56 };
57
60};
61
62class SoSFMLImagePrivate;
63
64ML_START_NAMESPACE
65class ImagePropertyExtension;
66class PagedImage;
67ML_END_NAMESPACE
68
69//=============================================================
72
82//=============================================================
83class INVENTORWRAPPER_API SoSFMLImage : public SoSField
84{
85
86 // Use standard field stuff
87 SO_SFIELD_CONSTRUCTOR_HEADER(SoSFMLImage);
88 SO_SFIELD_REQUIRED_HEADER(SoSFMLImage);
89
90public:
92 static void initClass();
93
95 virtual void setValue();
97 SbBool readValue(SoInput* in) override;
99 void writeValue(SoOutput* out) const override;
100
102 bool isValid();
103
105 void getSize(XVImageSize& size);
107 void getSize(int& x, int& y, int& z, int& c, int& t, int& u);
109 void getSize(int& x, int& y, int& z, int& c, int& t);
111 void getSize(int& x, int& y, int& z, int& c);
113 void getSize(int& x, int& y, int& z);
115 void getSize(int& x, int& y);
117 void getSize(MLint& x, MLint& y, MLint& z, MLint& c, MLint& t, MLint& u);
119 void getSize(MLint& x, MLint& y, MLint& z, MLint& c, MLint& t);
121 void getSize(MLint& x, MLint& y, MLint& z, MLint& c);
123 void getSize(MLint& x, MLint& y, MLint& z);
125 void getSize(MLint& x, MLint& y);
126
129
131 MLint getChannels();
132
134 bool isChannelName(MLint n, const char* name);
135
138
141 void getType(MLDataType& dtype, size_t& dsize);
143 void getType(MLDataType& dtype);
144
146 void getVoxelSize(float& x, float& y, float& z);
148 void getVoxelSize(double& x, double& y, double& z);
150 void getVoxelSize(float& x, float& y);
152 void getVoxelSize(double& x, double& y);
153
157
161
164 void touch() override;
165
167
173 unsigned int getSerialNumber();
174
176 double getMinValue();
178 double getMaxValue();
179
183 const ml::ImagePropertyExtension* getImagePropertyExtensionByType(const char* imagePropertyTypeClassName);
184
186 void connectFromML(void* connector);
191
195 ML_NAMESPACE::PagedImage* getPagedImage();
196
198 bool getTile3D(void* usrMem, MLDataType type, MLint x, MLint y, MLint z, MLint nx, MLint ny, MLint nz);
199
202 bool getScaledTile3D(void* usrMem, MLDataType type, MLint x, MLint y, MLint z, MLint nx, MLint ny, MLint nz,
203 double srcMin, double srcMax, double dstMin, double dstMax);
204
206 bool getTile6D(void* usrMem, MLDataType type, XVImageSize& pos, XVImageSize& size);
207
210 bool getScaledTile6D(void* usrMem, MLDataType type, XVImageSize& pos, XVImageSize& size, double srcMin, double srcMax,
211 double dstMin, double dstMax);
212
214 void getVoxelToWorldMatrix(float mat[16]);
216 void getVoxelToWorldMatrix(double mat[16]);
218 void getVoxelToWorldMatrix(SbMatrix& matrix);
220 void getVoxelToWorldMatrix(SbMatrixd& matrix);
222 void getWorldToVoxelMatrix(float mat[16]);
224 void getWorldToVoxelMatrix(double mat[16]);
226 void getWorldToVoxelMatrix(SbMatrix& matrix);
228 void getWorldToVoxelMatrix(SbMatrixd& matrix);
229
231 void mapVoxelToWorld(const SbVec3f& src, SbVec3f& dst);
233 void mapVoxelToWorld(const SbVec3d& src, SbVec3d& dst);
235 void mapWorldToVoxel(const SbVec3f& src, SbVec3f& dst);
237 void mapWorldToVoxel(const SbVec3d& src, SbVec3d& dst);
238
240 void mapVoxelToWorld(float voxelX, float voxelY, float voxelZ, float& worldX, float& worldY, float& worldZ);
242 void mapVoxelToWorld(double voxelX, double voxelY, double voxelZ, double& worldX, double& worldY, double& worldZ);
243
244
246 void mapWorldToVoxel(float worldX, float worldY, float worldZ, float& voxelX, float& voxelY, float& voxelZ);
248 void mapWorldToVoxel(double worldX, double worldY, double worldZ, double& voxelX, double& voxelY, double& voxelZ);
249
251 bool isVoxelInsideImage(double voxelX, double voxelY, double voxelZ);
252
254 bool isVoxelInsideImage(const SbVec3f& voxelCoord);
256 bool isVoxelInsideImage(const SbVec3d& voxelCoord);
257
258protected:
260 SoSFMLImagePrivate* _p;
261
262 // WARNING: SoSFMLImage should stay binary compatible, so beware of adding
263 // new member variables here, add them to \c SoSFMLImagePrivate!
264};
265
266
267#endif
#define INVENTORWRAPPER_API
Library initialization and export macros for platform independecy of project.
double getMaxValue()
Returns the statistical maximum value of the image.
ml::PagedImage * getPagedImage()
void getSize(MLint &x, MLint &y, MLint &z)
Gets the size of the image.
void getVoxelSize(double &x, double &y, double &z)
Gets the voxel size in doubles.
bool getScaledTile6D(void *usrMem, MLDataType type, XVImageSize &pos, XVImageSize &size, double srcMin, double srcMax, double dstMin, double dstMax)
void getVoxelSize(double &x, double &y)
Gets 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 minimum value of the image.
void getVoxelSize(float &x, float &y, float &z)
Gets the voxel size in floats.
bool isVoxelInsideImage(double voxelX, double voxelY, double voxelZ)
Checks whether the voxel coordinate (in doubles) is inside of the image extend.
void mapVoxelToWorld(float voxelX, float voxelY, float voxelZ, float &worldX, float &worldY, float &worldZ)
Maps 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()
Returns serial number of current image.
void * getConnector()
Returns current ML connector or NULL if not connected.
void getVoxelToWorldMatrix(SbMatrixd &matrix)
Gets the VoxelToWorldMatrix as an Inventor double matrix (transposed w.r.t. ML).
void getVoxelToWorldMatrix(float mat[16])
Gets the VoxelToWorldMatrix as a float array (according to ML conventions).
void mapWorldToVoxel(double worldX, double worldY, double worldZ, double &voxelX, double &voxelY, double &voxelZ)
Maps from world to voxel coordinate in double values.
void connectFromML(void *connector)
Connects to an ML output connector field.
void touch() override
void getWorldToVoxelMatrix(float mat[16])
Gets the WorldToVoxelMatrix as a float array (according to ML conventions).
double getVoxelVolumeInCubicMillimeters()
void writeValue(SoOutput *out) const override
Required by Inventor but not used.
SoSFMLImagePrivate * _p
Private data of the SoSFMLImage.
void getWorldToVoxelMatrix(double mat[16])
Gets 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.
void mapWorldToVoxel(float worldX, float worldY, float worldZ, float &voxelX, float &voxelY, float &voxelZ)
Maps 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 whether 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 whether the voxel coordinate is inside of the image extend.
void getPageSize(XVImageSize &size)
Gets the ML page size of the image.
bool isValid()
Checks whether there is a valid image available.
void getWorldToVoxelMatrix(SbMatrixd &matrix)
Gets 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()
const ml::ImagePropertyExtension * getImagePropertyExtensionByType(const char *imagePropertyTypeClassName)
void getVoxelToWorldMatrix(SbMatrix &matrix)
Gets 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)
void getWorldToVoxelMatrix(SbMatrix &matrix)
Gets 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])
Gets the VoxelToWorldMatrix as a double array (according to ML conventions).
void mapVoxelToWorld(const SbVec3f &src, SbVec3f &dst)
Maps from voxel to world coordinate in float vectors.
SbBool readValue(SoInput *in) override
Required by Inventor but not used.
MLint getChannels()
Returns the number of color channels.
void getSize(MLint &x, MLint &y)
Gets the size of the image.
bool isVoxelInsideImage(const SbVec3f &voxelCoord)
Checks whether the 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)
Maps from voxel to world coordinate in double values.
void mapWorldToVoxel(const SbVec3d &src, SbVec3d &dst)
Maps from world to voxel coordinate in double vectors.
void getVoxelSize(float &x, float &y)
Gets the voxel size in floats.
void getSize(MLint &x, MLint &y, MLint &z, MLint &c, MLint &t)
Gets the size of the image.
void getType(MLDataType &dtype, size_t &dsize)
void mapWorldToVoxel(const SbVec3f &src, SbVec3f &dst)
Maps from world to voxel coordinate in float vectors.
MLint getTimePoints()
Returns the 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()
Disconnects from an ML output connector field.
void mapVoxelToWorld(const SbVec3d &src, SbVec3d &dst)
Maps 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()
Prints the size to stdout.
XVImageSize()
Creates size object with size 0.
Definition SoSFMLImage.h:38
MLint x
Public accessible integer sizes.
Definition SoSFMLImage.h:35
XVImageSize(MLint xp, MLint yp, MLint zp, MLint cp, MLint tp, MLint up)
Creates size object with given sizes.
Definition SoSFMLImage.h:48
XVImageSize(MLint n)
Creates size object with size n on all components.
Definition SoSFMLImage.h:43