Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoVolumeData.h
Go to the documentation of this file.
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-2023 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>
43
44#include <LDM/SoLDMDataAccess.h>
45#include <LDM/SoLDMMediator.h>
46#include <LDM/SoLDMTileID.h>
47#include <LDM/nodes/SoDataSet.h>
50
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
79
80
727{
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
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 virtual void updateColorTable(SoState *, SoTransferFunction *);
1118 void loadData(SoAction* action, SbBool& texLoadedOrReloaded);
1119
1120 SoTransferFunction::GLColorMapType getColorMapType(SoState*);
1121 SbVec3i32& getDimensionPowerOf2();
1122 SbVec3f& getTexRatio();
1123
1124 // CPU lighting
1125 void setLighting(SoState* state, SbBool);
1126 void setLightDirection(SoState* state,const SbVec3f&);
1127 void setLightIntensity(SoState* state,float);
1128
1129 virtual bool isPalettedTexture(SoState* state);
1130 int isSharedPalettedTexture();
1131
1133 void getVolumeTexGen(SbVec4d texGen[3]) const;
1134
1136 SbMatrix getVolumeTexGen() const;
1137
1139 SbVec3f getVolumeTextureRatio() const;
1140
1142 SbBox3f toTextureSpace(const SbBox3f& bbox) const;
1143
1144 void drawOctree(SoGLRenderAction* pGLRA);
1145
1146 //Return -1 when lighting is on, 0 in RGBA texture mode
1147 virtual int getTexPrec(SoState*state);
1148
1149 virtual void getDataOneObliqueSlice( const SbVec3i32& tileSize, SoBufferObject* tileData, int Zaxis, const SbPlane& plane, SoBufferObject* slicedata, int interp );
1150 virtual SoBufferObject* getDataOneSlice( const SbVec3i32& tileSize, SoBufferObject* tileData, int Zaxis, int slice);
1151
1152 SbBox3f getLDMOutliningBox();
1153
1158 virtual SoBufferObject *getTransformedTile(const SoLDMTileID& tile,
1159 const SoLDM::DataSetIdPair& p,
1160 SoState * state=NULL,
1161 const bool useExtendedData = false);
1162
1163
1166 SbBool saveEditing( SoVolumeWriter* writer, SaveEditingCB* callback = NULL );
1167
1171 const std::vector<float>& getInvertedRectilinearCoordinates(Axis axis) const;
1172
1176 virtual void drawXYZBox( SoGLRenderAction* action, BoxColor color, const SbBox3f& box );
1177
1181 virtual void drawIJKBox( SoGLRenderAction* action, BoxColor color, const SbBox3f& box, const SoLDMTileID& tile, bool subTile = false );
1182 virtual void drawIJKBox( SoGLRenderAction* action, BoxColor color, const SbBox3f& box, bool fullRes, bool subTile = false );
1183 virtual void drawIJKBox( SoGLRenderAction* action, BoxColor color, const SbBox3f& box, bool subTile = false );
1184
1185 void setupRectilinearCoordinates(const SbVec3i32&);
1186 bool isRectilinearCoordinatesUpdated(const SoVolumeShader* s);
1187 void resetRectilinearCoordinatesUpdated(const SoVolumeShader* s);
1188
1189 SbVec3f computeRectilinearCoordinate(const SbVec3f& vertex);
1190 SbBox3f computeRectilinearCoordinate(const SbBox3f& box);
1191
1192 SbVec3f computeInvertedRectilinearCoordinate(const SbVec3f& vertex) const;
1193 SbBox3f computeInvertedRectilinearCoordinate(const SbBox3f& box);
1194
1195 void setDefaultValue( const double defValue );
1196 double getDefaultValue() const;
1197
1201 SbBox3f getXYZCoordinates(const SbBox3i32& box, const SbBox3i32& cropped);
1202
1207 SbBox3f getSubtileXYZCoordinates(const SbBox3i32& fullTileBox,
1208 const SbBox3i32& subTileBox,
1209 const SbBox3i32& cropped);
1210
1211 virtual LDMSliceAccessor* getAppropriateSliceAccessor( const SoLDM::DataSetIdPair& p );
1212
1213 virtual SoLDMReader* getAppropriateLDMReader( const SbString& pathname);
1214
1215private:
1216
1221 virtual void readerChanged();
1222
1226 virtual void setElement(SoState* state);
1227
1228 virtual SoVolumeReader *getAppropriateReader();
1229
1230 // Destructor
1231 virtual ~SoVolumeData();
1232 void releaseMemory();
1233
1234 virtual bool enableMultidata(SoState* state);
1235
1239 virtual void unload();
1240
1244 virtual void updateFilename();
1245
1249 virtual SbBool isRGBAData();
1250
1252 virtual void buildTile(SoLDMTileID tileID, SoBufferObject* buffer);
1253
1255 virtual void computeLighting( const SbVec3i32 & tileSize, SoBufferObject* rgbaBuffer );
1256
1257SoINTERNAL private:
1258
1260 virtual SoLDMGeomElement* getAppropriateElement( SoLDMGeometry* v );
1261
1262private:
1263
1265 void commonConstructor();
1266
1267#if 1 SoDEPRECATED
1269 void updateColorTable( SoState *, SoVolumeData::StorageHint textype, SoTransferFunction * );
1270#endif SoDEPRECATED
1273 SoSFEnum storageHint;
1274
1275 // This field is deprecated but cannot be remove without creating a new iv file version formatSoDEPRECATED
1277 SoSFInt32 volumeDataId;
1278
1279 friend class ::SoVolumeState;
1280};
1281
1282#ifdef _MSC_VER
1283#pragma warning( pop )
1284#endif
1285
1286#endif // _SO_VOLUME_DATA_
1287
1288
#define SoINTERNAL
#define TRUE
Possible value of SbBool.
Definition SbBase.h:77
#define FALSE
Possible value of SbBool.
Definition SbBase.h:75
SO_PIMPL_PUBLIC_DECLARATION(SoFileDataAdapter)
valueRef getValue() const
Definition SoSubField.h:234
#define SO_NODE_HEADER(className)
Definition SoSubNode.h:151
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:1309
SbBool SaveEditingCB(SoDataSet *dataSet, SoVolumeWriter *writer, int tilesRemaining, int totalTiles)
This is the declaration to use for saveEditing callback functions.
Definition SoDataSet.h:511
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="extLDM.gif" alt="Large Data Management" border="0"></a> Describe...
<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
size_t size() const
void notify(SoNotList *list)
std::pair< SoDataSet *, int > DataSetIdPair
Pair containing an SoDataset and its dataSetId.
Definition SoLDM.h:71