Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoVolumeData.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2024 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : P. ESTRADE (Feb 2000)
22**=======================================================================*/
23#ifndef _SO_VOLUME_DATA_
24#define _SO_VOLUME_DATA_
25
26#ifdef _MSC_VER
27#pragma warning( push )
28#pragma warning(disable:4251)
29#endif
30
31#include <Inventor/STL/map>
32#include <Inventor/STL/vector>
33
34#include <Inventor/SbBox.h>
35#include <Inventor/SbPList.h>
36#include <Inventor/fields/SoSFBool.h>
37#include <Inventor/fields/SoSFEnum.h>
38#include <Inventor/fields/SoSFMemObj.h>
39#include <Inventor/fields/SoSFString.h>
40#include <Inventor/fields/SoSFUShort.h>
41#include <Inventor/fields/SoSFInt32.h>
42#include <Inventor/fields/SoSFArray3D.h>
43
44#include <LDM/SoLDMDataAccess.h>
45#include <LDM/SoLDMMediator.h>
46#include <LDM/SoLDMTileID.h>
47#include <LDM/nodes/SoDataSet.h>
48#include <LDM/nodes/SoTransferFunction.h>
49#include <LDM/readers/SoVolumeReader.h>
50
51#include <VolumeViz/nodes/SoVolumeRendering.h>
52
55class SoWriteAction;
56class SoVolumeReader;
57class SoCache;
58class SoState;
59class SoGLVolCacheList;
62class SoVolumeShader;
63class SoVolumeState;
64
65// LDM
66class SoLDMTileManager;
67class SoLDMTileVisitor;
68class SoLDMNodeFrontManager;
69class SoLDMTextureManager;
70class SoLDMGeometry;
72
73// Algorithms
74class SoDataExtract;
75class LDMDefaultSliceAccessor;
76class SoVolumeData;
77
78SO_PIMPL_PUBLIC_DECLARATION(SoVolumeData)
79
80
727{
728 SO_NODE_HEADER( SoVolumeData );
729
730 SO_PIMPL_PUBLIC_HEADER( SoVolumeData );
731
732public:
733 using SoDataSet::getTexData;
734
735 //compatibility issues:
738
743
770
771
782
792
817
835
837 virtual SbBool getMinMax( int64_t &min, int64_t &max);
838
840 virtual SbBool getMinMax( double &min, double &max);
841
883 SbBool getHistogram( int &length, int64_t* &histogram);
884
893 void updateRegions(const SbBox3i32 *region, int num_regions);
894
902 void updateTilesInTextureMemory(SoLDMTileID* tiles, int numTiles);
903
909 void setRGBAData(const bool flag);
910
924
926
932 enum Axis {
935 Z
936 };
937
943 const std::vector<float>& getRectilinearCoordinates(Axis axis) const;
944
946 virtual SbBool startEditing(int &transactionId );
947
949 virtual int editTile( const SoLDMTileID& tileId, SoBufferObject* userData );
950
952 virtual int editSubVolume( const SbBox3i32& subVolume, SoBufferObject* userData );
953
955 virtual int editTile( const SoLDMTileID& tileId, const double& value );
956
958 virtual int editSubVolume( const SbBox3i32& subVolume, const double& value );
959
961 virtual int editSurfaceShape( const SoNode* surfaceShape, const float& thickness, const double& newValue );
962
964 virtual int editSolidShape( const SoNode* solidShape, const double& value );
965
967 virtual int editBoxes(
968 const std::vector<SbVec3i32>& boxCenters,
969 const int& boxSize,
970 const double& newValue
971 );
972
974 virtual SbBool finishEditing(int transactionId);
975
977 virtual SbBool undoEditing( int transactionId );
978
980 virtual SbBool redoEditing( int transactionId );
981
983 virtual SbBool saveEditing(bool recomputeLowerResolution = TRUE, const std::vector<char*> convertionParameters = std::vector<char*>(), SaveEditingCB* callback = NULL );
984
985#if 1 SoDEPRECATED enum
1004#ifndef HIDDEN_FROM_DOC
1006 VOLUMEPRO,
1008 TEX2D_SINGLE
1009#endif // HIDDEN_FROM_DOC
1010 };
1011
1012#endif
1015#if 1 SoDEPRECATED enum
1021 SubMethod {
1027 AVERAGE
1029SoDEPRECATED enum
1034 OverMethod {
1042 CUBIC
1044SoDEPRECATED
1058SoDEPRECATED
1065SoDEPRECATED
1070 void setTexMemorySize(int size);
1071SoDEPRECATED
1077
1078#endif
1080private:
1081
1082 virtual void doAction( SoAction *action );
1083 virtual void GLRender( SoGLRenderAction *action );
1084 virtual void useFakeData(SoLDMTileID tileID, SoBufferObject* bufferObject);
1085
1086 // ScaleViz specific : force rendering on all oiru in depth compositing mode
1087 // As VolumeViz shape nodes are considered as transparent (alpha)
1088 virtual int32_t getRenderUnitID() const;
1089
1090private:
1091
1093 SbVec3d getVoxelSize() const;
1094
1095 virtual void updateTile( const SbBox3i32 &region, const SoLDMTileID& tileId );
1096 virtual void drawTilesInMainMemory(SoGLRenderAction* action, const SoLDM::DataSetIdPair& idPair);
1097
1098 enum Cmd{
1099 CREATE_NODE,
1100 UPDATE_REGIONS,
1101 SET_LDM,
1102 SET_PAGING
1103 };
1104
1108 virtual void notify(SoNotList *list);
1109
1110 int64_t getValue (SbVec3i32 &pos, SbBool real = FALSE);
1111 double getValueD(const SbVec3i32 &pos, SbBool real = FALSE);
1112 int64_t loadDataValue(void* value, const SbVec3i32 &pos, void*& data, SoBufferObject *dataBufferObject, SbBool real);
1113
1114 static void initClass();
1115 static void exitClass();
1116
1117 void loadData(SoAction* action, SbBool& texLoadedOrReloaded);
1118
1119 SoTransferFunction::GLColorMapType getColorMapType(SoState*);
1120 SbVec3i32& getDimensionPowerOf2();
1121 SbVec3f& getTexRatio();
1122
1123 // CPU lighting
1124 void setLighting(SoState* state, SbBool);
1125 void setLightDirection(SoState* state,const SbVec3f&);
1126 void setLightIntensity(SoState* state,float);
1127
1128 virtual bool isPalettedTexture(SoState* state);
1129
1131 void getVolumeTexGen(SbVec4d texGen[3]) const;
1132
1134 SbMatrix getVolumeTexGen() const;
1135
1137 SbVec3f getVolumeTextureRatio() const;
1138
1140 SbBox3f toTextureSpace(const SbBox3f& bbox) const;
1141
1142 void drawOctree(SoGLRenderAction* pGLRA);
1143
1144 //Return -1 when lighting is on, 0 in RGBA texture mode
1145 virtual int getTexPrec(SoState*state);
1146
1147 virtual void getDataOneObliqueSlice( const SbVec3i32& tileSize, SoBufferObject* tileData, int Zaxis, const SbPlane& plane, SoBufferObject* slicedata, int interp );
1148 virtual SoBufferObject* getDataOneSlice( const SbVec3i32& tileSize, SoBufferObject* tileData, int Zaxis, int slice);
1149
1150 SbBox3f getLDMOutliningBox();
1151
1156 virtual SoBufferObject *getTransformedTile(const SoLDMTileID& tile,
1157 const SoLDM::DataSetIdPair& p,
1158 SoState * state=NULL,
1159 const bool useExtendedData = false);
1160
1161
1164 SbBool saveEditing( SoVolumeWriter* writer, SaveEditingCB* callback = NULL );
1165
1169 const std::vector<float>& getInvertedRectilinearCoordinates(Axis axis) const;
1170
1174 virtual void drawXYZBox( SoGLRenderAction* action, BoxColor color, const SbBox3f& box );
1175
1179 virtual void drawIJKBox( SoGLRenderAction* action, BoxColor color, const SbBox3f& box, const SoLDMTileID& tile, bool subTile = false );
1180 virtual void drawIJKBox( SoGLRenderAction* action, BoxColor color, const SbBox3f& box, bool fullRes, bool subTile = false );
1181 virtual void drawIJKBox( SoGLRenderAction* action, BoxColor color, const SbBox3f& box, bool subTile = false );
1182
1183 void setupRectilinearCoordinates(const SbVec3i32&);
1184 bool isRectilinearCoordinatesUpdated(const SoVolumeShader* s);
1185 void resetRectilinearCoordinatesUpdated(const SoVolumeShader* s);
1186
1187 SbVec3f computeRectilinearCoordinate(const SbVec3f& vertex);
1188 SbBox3f computeRectilinearCoordinate(const SbBox3f& box);
1189
1190 SbVec3f computeInvertedRectilinearCoordinate(const SbVec3f& vertex) const;
1191 SbBox3f computeInvertedRectilinearCoordinate(const SbBox3f& box);
1192
1193 void setDefaultValue( const double defValue );
1194 double getDefaultValue() const;
1195
1199 SbBox3f getXYZCoordinates(const SbBox3i32& box, const SbBox3i32& cropped);
1200
1205 SbBox3f getSubtileXYZCoordinates(const SbBox3i32& fullTileBox,
1206 const SbBox3i32& subTileBox,
1207 const SbBox3i32& cropped);
1208
1209 virtual LDMSliceAccessor* getAppropriateSliceAccessor( const SoLDM::DataSetIdPair& p );
1210
1211 virtual SoLDMReader* getAppropriateLDMReader( const SbString& pathname);
1212
1213private:
1214
1219 virtual void readerChanged();
1220
1224 virtual void setElement(SoState* state);
1225
1226 virtual SoVolumeReader *getAppropriateReader();
1227
1228 // Destructor
1229 virtual ~SoVolumeData();
1230 void releaseMemory();
1231
1232 virtual bool enableMultidata(SoState* state);
1233
1237 virtual void unload();
1238
1242 virtual void updateFilename();
1243
1247 virtual SbBool isRGBAData();
1248
1250 virtual void buildTile(SoLDMTileID tileID, SoBufferObject* buffer);
1251
1253 virtual void computeLighting( const SbVec3i32 & tileSize, SoBufferObject* rgbaBuffer );
1254
1255SoINTERNAL private:
1256
1258 virtual SoLDMGeomElement* getAppropriateElement( SoLDMGeometry* v );
1259
1260private:
1261
1263 void commonConstructor();
1264SoDEPRECATED
1266 SoSFEnum storageHint;
1267
1268 // This field is deprecated but cannot be remove without creating a new iv file version formatSoDEPRECATED
1270 SoSFInt32 volumeDataId;
1271
1272 friend class ::SoVolumeState;
1273};
1274
1275#ifdef _MSC_VER
1276#pragma warning( pop )
1277#endif
1278
1279#endif // _SO_VOLUME_DATA_
1280
1281
3D box class.
Definition SbBox.h:649
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 3D box class.
Definition SbBox.h:96
4x4 matrix class.
Definition SbMatrix.h:309
Oriented plane in 3D.
Definition SbPlane.h:64
Class for smart character strings.
Definition SbString.h:202
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 3D vector class ...
Definition SbVec.h:1214
3D vector class.
Definition SbVec.h:932
3D vector class.
Definition SbVec.h:1517
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 4D vector class ...
Definition SbVec.h:2427
Abstract base class for all actions.
Definition SoAction.h:132
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
Performs a generic traversal of a scene graph or path.
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Data set...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Data extraction ...
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Data set...
Definition SoDataSet.h:139
friend class SoLDMGeometry
Definition SoDataSet.h:1355
SbBool saveEditing()
Commit all transactions.
SbBool SaveEditingCB(SoDataSet *dataSet, SoVolumeWriter *writer, int tilesRemaining, int totalTiles)
This is the declaration to use for saveEditing callback functions.
Definition SoDataSet.h:551
Renders a scene graph using Open Inventor's Render Engine.
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Volume d...
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Base cla...
Definition SoLDMReader.h:98
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Resource...
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Defines ...
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Tile ID
Definition SoLDMTileID.h:63
Abstract base class for all database nodes.
Definition SoNode.h:145
Field containing a 3D array value.
Definition SoSFArray3D.h:90
Field containing a single Boolean value.
Definition SoSFBool.h:79
Field containing an enumerated value.
Definition SoSFEnum.h:89
Field containing a int32_t integer.
Definition SoSFInt32.h:80
Traversal state.
Definition SoState.h:74
<a href="IconLegend.html"><img src="extVR.gif" alt="VolumeViz" border="0"></a> Volume data property ...
SoSFBool useExtendedData
If TRUE, VolumeViz stores an additional copy of each loaded tile.
SoSFArray3D data
Specifies the volume data, including dimensions, data type and number of significant bits.
SoDEPRECATED int getTexMemorySize()
Returns the maximum texture memory size to use in mega texels.
virtual SbBool saveEditing(bool recomputeLowerResolution=TRUE, const std::vector< char * > convertionParameters=std::vector< char * >(), SaveEditingCB *callback=NULL)
Commit all transactions.
void updateTilesInTextureMemory(SoLDMTileID *tiles, int numTiles)
Reloads textures corresponding to the given tile IDs.
void setRGBAData(const bool flag)
Force data to be considered as RGBA values.
CoordinateType
Coordinate type used by this data set.
@ COORDINATES_RECTILINEAR
Grid spacing defined by x, y, z values.
@ COORDINATES_UNIFORM
Uniform grid spacing along each axis.
CoordinateType getCoordinateType() const
virtual int editTile(const SoLDMTileID &tileId, SoBufferObject *userData)
Replaces the contents of a tile with the given data.
SoSFBool useSharedPalettedTexture
Note: On graphics boards that support programmable shaders, this field is ignored (virtually all grap...
virtual int editSubVolume(const SbBox3i32 &subVolume, SoBufferObject *userData)
Replaces the contents of a subvolume with the given data.
virtual SbBool undoEditing(int transactionId)
Undo all modifications associated with the specified transaction id.
virtual int editSolidShape(const SoNode *solidShape, const double &value)
Replaces all voxels intersecting the given shape with the specified value.
OverMethod
Over sampling method mode.
@ LINEAR
Linear.
@ CONSTANT
Constant.
void updateRegions(const SbBox3i32 *region, int num_regions)
Updates regions of the volume that have been modified.
virtual SbBool redoEditing(int transactionId)
Redo all modifications associated with the specified transaction id.
virtual SbBool getMinMax(double &min, double &max)
Returns min and max values of the data set.
SoSFBool dataRGBA
Contains TRUE if the volume contains RGBA values rather than scalar values.
SbBool getHistogram(int &length, int64_t *&histogram)
Returns the histogram of the volume data.
virtual SbBool finishEditing(int transactionId)
Terminates an editing transaction.
StorageHint
Storage Hints mode TODO: this enum should be in the private section as its storageHints deprecated fi...
@ MEMORY
In memory.
@ AUTO
Auto (Default)
@ TEX2D_MULTI
Multi-texture 2D.
@ TEX3D
Texture 3D.
@ TEX2D
(synonym for TEXT2D_MULTI)
::SoLDMResourceParameters SoLDMResourceParameters
SoDEPRECATED SoVolumeData * reSampling(const SbVec3i32 &dimension, SoVolumeData::SubMethod subMethod, SoVolumeData::OverMethod=NONE)
Re-samples the volume down to or up to the given dimension using the sub-sampling method SubMethod(...
virtual int editSurfaceShape(const SoNode *surfaceShape, const float &thickness, const double &newValue)
Replaces all voxels intersecting the polygons or lines defined by the surfaceShape and given thicknes...
virtual int editBoxes(const std::vector< SbVec3i32 > &boxCenters, const int &boxSize, const double &newValue)
Replace all voxels in the region defined by a list of boxes with the specified value.
Axis
Which axis to handle.
SoLDMDataAccess LDMDataAccess
SoSFBool usePalettedTexture
For a volume containing scalar data values, controls whether scalar values (true) or RGBA values (fal...
virtual int editSubVolume(const SbBox3i32 &subVolume, const double &value)
Replaces the contents of a subvolume with the specified value.
SubMethod
Sub sampling method mode.
@ AVERAGE
Average.
@ NEAREST
Nearest.
virtual int editTile(const SoLDMTileID &tileId, const double &value)
Replaces the contents of a tile with the specified value.
SoDEPRECATED void setTexMemorySize(int size)
Specifies the maximum texture memory size to use in mega texels.
const std::vector< float > & getRectilinearCoordinates(Axis axis) const
Returns a vector describing mapping from uniform space to rectilinear space.
SoDEPRECATED SoVolumeData * subSetting(const SbBox3i32 &region)
Extracts the data volume defined by region.
SoVolumeData()
Constructor.
virtual SbBool getMinMax(int64_t &min, int64_t &max)
Returns min and max values of the data set data.
virtual SbBool startEditing(int &transactionId)
Initiate an editing transaction.
Volume Data Histogram.
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Abstract...
@ COORDINATES_UNIFORM
Uniform grid spacing along each axis.
@ COORDINATES_RECTILINEAR
Grid spacing defined by x, y, z values.
<a href="IconLegend.html"><img src="extVR.gif" alt="VolumeViz" border="0"></a> Initializes the Volum...
<a href="IconLegend.html"><img src="extVR.gif" alt="VolumeViz" border="0"></a> Shader node for volum...
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Abstract...
Writes a scene graph to a file.
int SbBool
Boolean type.
Definition SbBase.h:87
std::pair< SoDataSet *, int > DataSetIdPair
Pair containing an SoDataset and its dataSetId.
Definition SoLDM.h:71