MeVisLabToolboxReference
MeVis/Foundation/Sources/MLInventorBinding/SoSFMLImage.h
Go to the documentation of this file.
00001 #ifndef __SoSFMLImage_H
00002 #define __SoSFMLImage_H
00003 //----------------------------------------------------------------------------------
00004 // **InsertLicense** code
00005 //----------------------------------------------------------------------------------
00007 
00012 //----------------------------------------------------------------------------------
00013 
00014 #ifndef __InventorWrapperDllInit_H
00015 #include "InventorWrapperDllInit.h"
00016 #endif
00017 
00018 #include "XVEnterScope.h"
00019 
00020 #include <Inventor/fields/SoSubField.h>
00021 #include <Inventor/SbLinear.h>
00022 
00023 #include "XVLeaveScope.h"
00024 
00025 #ifndef __mlDataTypes_H
00026 #include <mlDataTypes.h>
00027 #endif
00028 
00032 class XVImageSize
00033 {
00034 public:
00035 
00037   MLint x,y,z,c,t,u;
00038 
00040   inline XVImageSize()                                               { x=y=z=c=t=u=0; };
00042   inline XVImageSize(int n)                                          { x=y=z=c=t=u=n; };
00044   inline XVImageSize(int xp, int yp, int zp, int cp, int tp, int up) { x=xp; y=yp; z=zp; c=cp; t=tp; u=up; };
00045 
00047   INVENTORWRAPPER_API void print();
00048 };
00049 
00050 class SoSFMLImagePrivate;
00051 
00052 ML_START_NAMESPACE
00053   class ImagePropertyExtension;
00054   class PagedImage;
00055 ML_END_NAMESPACE
00056 
00057 //=============================================================
00061 
00070 //=============================================================
00071 class INVENTORWRAPPER_API SoSFMLImage : public SoSField {
00072 
00073   // Use standard field stuff
00074   SO_SFIELD_CONSTRUCTOR_HEADER(SoSFMLImage);
00075   SO_SFIELD_REQUIRED_HEADER(SoSFMLImage);
00076 
00077 public:
00079   static void initClass();
00080   
00082   virtual void setValue();
00084   virtual int  readValue(SoInput* in);
00086   virtual void writeValue(SoOutput* out) const;
00087   
00089   bool  isValid();
00090   
00092   void  getSize(XVImageSize &size);
00094   void  getSize(int &x, int &y, int &z, int &c, int &t, int &u);
00096   void  getSize(int &x, int &y, int &z, int &c, int &t);
00098   void  getSize(int &x, int &y, int &z, int &c);
00100   void  getSize(int &x, int &y, int &z);
00102   void  getSize(int &x, int &y); 
00103   
00105   void  getPageSize(XVImageSize &size);
00106   
00108   int   getChannels(); 
00109   
00111   int   getTimePoints(); 
00112   
00115   void  getType(MLDataType &dtype, size_t &dsize);
00117   void  getType(MLDataType &dtype);
00118   
00120   void  getVoxelSize(float &x, float &y, float &z);
00122   void  getVoxelSize(float &x, float &y);
00123   
00126   void  touch();
00127 
00129 
00135   unsigned int   getSerialNumber();
00136 
00138   double getMinValue();
00140   double getMaxValue();
00141   
00145   const ml::ImagePropertyExtension* getImagePropertyExtensionByType(const char* imagePropertyTypeClassName);
00146   
00148   void connectFromML(void* connector);
00150   void disconnectFromML();
00152   void *getConnector();
00153 
00157   ML_NAMESPACE::PagedImage* getPagedImage();
00158   
00160   bool  getTile3D(void* usrMem, MLDataType type, int x, int y, int z, 
00161     int nx, int ny, int nz);
00162   
00165   bool  getScaledTile3D(void* usrMem, MLDataType type, int x, int y, int z,
00166     int nx, int ny, int nz,
00167     double srcMin, double srcMax, double dstMin, double dstMax);
00168   
00170   bool  getTile6D(void* usrMem, MLDataType type, XVImageSize &pos,
00171     XVImageSize &size);
00172   
00175   bool  getScaledTile6D(void* usrMem, MLDataType type,  XVImageSize &pos,
00176     XVImageSize &size,
00177     double srcMin, double srcMax, double dstMin, double dstMax);
00178   
00180   void  getVoxelToWorldMatrix(float mat[16]);
00182   void  getVoxelToWorldMatrix(SbMatrix &matrix);
00184   void  getWorldToVoxelMatrix(float mat[16]);
00186   void  getWorldToVoxelMatrix(SbMatrix &matrix);
00187   
00189   void  mapVoxelToWorld(const SbVec3f &src, SbVec3f &dst);
00191   void  mapWorldToVoxel(const SbVec3f &src, SbVec3f &dst);
00192   
00194   void  mapVoxelToWorld(float voxelX, float voxelY, float voxelZ,
00195     float &worldX, float &worldY, float &worldZ);
00196   
00198   void  mapWorldToVoxel(float worldX, float worldY, float worldZ,
00199     float &voxelX, float &voxelY, float &voxelZ);
00200   
00202   bool  isVoxelInsideImage(float voxelX,float voxelY,float voxelZ);
00203   
00205   bool  isVoxelInsideImage(const SbVec3f &voxelCoord);
00206   
00207  protected:
00209    SoSFMLImagePrivate* _p;
00210 
00211    // WARNING: SoSFMLImage should stay binary compatible, so beware of adding
00212    // new member variables here, add them to \c SoSFMLImagePrivate!!!
00213 };
00214 
00215 
00216 #endif