MeVisLab Toolbox Reference
SoView2DVoxelView.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 
15 
16 #pragma once
17 
18 #include "SoView2DSystem.h"
19 #include "SoView2DExtension.h"
20 #include "SoView2D.h"
21 
22 #include <Inventor/fields/SoFields.h>
23 #include "mlLUTData.h"
24 #include "SoSFMLBase.h"
25 #include "SoSFMLImage.h"
26 
27 // Forward declaration.
28 class View2DFont;
29 
30 //----------------------------------------------------------------------------------
32 //----------------------------------------------------------------------------------
34 {
38  SO_NODE_HEADER(SoView2DVoxelView);
39 
40 public:
41 
46  static void initClass(void);
47 
50 
55  void draw(View2DSliceList *dsl, View2DSlice *dslice, int slice) override;
56 
57 
61  SoSFBool drawVoxelValues;
62 
66  SoSFString defaultFitString;
67 
69  SoSFBool drawCenterDots;
70 
72  SoSFBool drawCornerDots;
73 
76  SoSFBool useCommas;
77 
79  SoSFBool outLineVoxels;
80 
84  SoSFBool useLut;
85 
87  SoSFFloat defaultAlpha;
88 
90  SoSFFloat fontSize;
91 
94 
97  SoSFInt32 numRowComponents;
98 
104 
109 
110 
111 protected:
112 
130  virtual void _drawCellInformation(View2DSliceList * /*dsl */,
131  View2DSlice * /*dslice */,
132  int /*slice */,
133  bool /*drawTexts */,
134  int /*numRowComps*/,
135  const MLTypeInfos & /*dtInfo */,
136  MLDataType /*dType */,
137  MLTypeData * /*vBuf1 */,
138  int /*numDTComps */,
139  GLfloat /*rgba */[4],
140  float /*xPos */,
141  float /*yPos */,
142  View2DFont & /*font */,
143  float /*fSize */) { }
144 
146  ML_NAMESPACE::LUTData<MLfloat> _lutData;
147 
150  void _getGLColor(double dblVoxVal, GLfloat rgba[4]);
151 
159  float _drawVoxelValue(bool drawTexts,
160  int numRowComps,
161  MLDataType dType,
162  MLTypeData *vBuf1,
163  int numDTComponents,
164  GLfloat rgba[4],
165  float xPos,
166  float yPos,
167  View2DFont &font,
168  float fSize);
169 
178  float _drawStringVoxelValue(bool drawTexts,
179  MLDataType dType,
180  MLTypeData *vBuf1,
181  int numDTComponents,
182  GLfloat rgba[4],
183  float xPos,
184  float yPos,
185  View2DFont &font,
186  float fSize);
187 
192  void _drawCoordinateComponents(bool drawTexts,
193  int numComps,
194  XVImageSize &pos,
195  GLfloat rgba[4],
196  float xPos,
197  float yPos,
198  View2DFont &font,
199  float fSize);
200 
206 
207 private:
209  bool _lutIsValid;
210 
212  double _lutShift;
213 
215  double _lutScale;
216 };
View2DLutPrecision
allows to set the precision of the LUT
#define SOVIEW2D_API
File to resolve system dependencies in View2D library.
The SoSFMLBase field is the interface used by Inventor Nodes to output ML Base objects to the outside...
Definition: SoSFMLBase.h:45
The SoSFMLImage field is the interface used by Inventor Nodes to access image data (in the current im...
Definition: SoSFMLImage.h:70
SoView2DExtension Base class for all View2DExtensions used for drawing and event handling on the View...
SoView2DExtension for detailed voxel viewing.
SoSFBool useLut
If enabled a connected look up table will be used to draw everything in the "looked up" values of the...
virtual void _drawCellInformation(View2DSliceList *, View2DSlice *, int, bool, int, const MLTypeInfos &, MLDataType, MLTypeData *, int, GLfloat[4], float, float, View2DFont &, float)
User defined function to draw additional stuff in derived classes.
SoSFInt32 numPrecisionDigits
The maximum number of digits after "." in floating point numbers; default is 1.
SoSFFloat defaultAlpha
Transparency from [0,1] used if no LUT is used; default is 0.5 (half transparent).
SoView2DVoxelView(void)
Creates a detail viewer for voxels.
void _getGLColor(double dblVoxVal, GLfloat rgba[4])
Set correct color value in rgba dependent on the current settings and the voxel value dblVoxVal.
SoSFBool useCommas
If enabled then all spaces in multicomponent voxel values are replaced by commas for better readabili...
SoSFFloat fontSize
Size of font for voxel value; default is 10, minimum is 6, maximum is 250.
void draw(View2DSliceList *dsl, View2DSlice *dslice, int slice) override
Virtual method called by the SoView2D node.
void _updateLutData(SoSFMLImage &inImg, View2DLutPrecision precision)
Update the look up table according to the image data.
SoSFString defaultFitString
String which should fit into a voxel to be shown, that means if it does not fit no voxel values are s...
float _drawStringVoxelValue(bool drawTexts, MLDataType dType, MLTypeData *vBuf1, int numDTComponents, GLfloat rgba[4], float xPos, float yPos, View2DFont &font, float fSize)
Still incomplete and unused.
static void initClass(void)
Initialization function of this class.
SoSFBool outLineVoxels
If enabled then on voxel the border pixels are drawn; default is FALSE.
SoSFBool drawCornerDots
If enabled dots are drawn in all corners of each voxel; default is false.
ml::LUTData< MLfloat > _lutData
Data table for voxel value look up.
SoSFInt32 numRowComponents
The number of coordinate components to be shown in one row; 0 means automatic row size,...
float _drawVoxelValue(bool drawTexts, int numRowComps, MLDataType dType, MLTypeData *vBuf1, int numDTComponents, GLfloat rgba[4], float xPos, float yPos, View2DFont &font, float fSize)
If drawTexts is true, the default string fits into a voxel then draw the voxel value from voxel data ...
SoSFMLBase inputLut
Optional node input for an optional lookup table node which controls color mapping of drawn stuff.
void _drawCoordinateComponents(bool drawTexts, int numComps, XVImageSize &pos, GLfloat rgba[4], float xPos, float yPos, View2DFont &font, float fSize)
If drawTexts is true then draw numComps coordinate components of position pos with the color rgba at ...
SoSFInt32 numCoordinateComponents
The number of coordinate components to be shown; default is 0.
SoSFBool drawCenterDots
If enabled a pixel is drawn in the center of each voxel; default is false.
Abstract GL font drawing using FTGL.
Definition: View2DFont.h:30
a list that holds all View2DSlice objects (lazily created) of a SoView2D
a single slice that is stored in a View2DSliceList, typically created by a View2DSliceList
Definition: View2DSlice.h:48
SoSFMLImage - field interface to ML images and related classes.
Definition: SoSFMLImage.h:32
MLint32 MLDataType
MLDataType.
Definition: mlTypeDefs.h:684
unsigned char MLTypeData
This is the pointer type used to point to the data of MLType data instances.
Definition: mlTypeDefs.h:1436
Structure containing all data type features and pointers to all functions needed to implement operati...
Definition: mlTypeDefs.h:1466