Coin Logo http://www.sim.no
http://www.coin3d.org

SoVolumeData.h
1 #ifndef SIMVOLEON_SOVOLUMEDATA_H
2 #define SIMVOLEON_SOVOLUMEDATA_H
3 
4 /**************************************************************************\
5  *
6  * This file is part of the SIM Voleon visualization library.
7  * Copyright (C) 2003-2004 by Systems in Motion. All rights reserved.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * ("GPL") version 2 as published by the Free Software Foundation.
12  * See the file LICENSE.GPL at the root directory of this source
13  * distribution for additional information about the GNU GPL.
14  *
15  * For using SIM Voleon with software that can not be combined with
16  * the GNU GPL, and for taking advantage of the additional benefits
17  * of our support services, please contact Systems in Motion about
18  * acquiring a SIM Voleon Professional Edition License.
19  *
20  * See <URL:http://www.coin3d.org/> for more information.
21  *
22  * Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
23  * <URL:http://www.sim.no/>.
24  *
25 \**************************************************************************/
26 
27 #include <Inventor/fields/SoSFString.h>
28 #include <Inventor/fields/SoSFEnum.h>
29 #include <Inventor/fields/SoSFBool.h>
30 #include <Inventor/fields/SoSFVec3f.h>
31 #include <Inventor/SbVec3f.h>
32 #include <Inventor/SbVec3s.h>
33 #include <Inventor/SbBox3f.h>
34 #include <Inventor/SbBox3s.h>
35 #include <Inventor/SbBox2s.h>
36 #include <Inventor/SbBox2f.h>
37 #include <VolumeViz/nodes/SoVolumeRendering.h>
38 #include <Inventor/nodes/SoSubNode.h>
39 
40 class SoVolumeReader;
41 class SoState;
42 class SoTransferFunction;
43 
44 
45 class SIMVOLEON_DLL_API SoVolumeData : public SoVolumeRendering {
47 
48  SO_NODE_HEADER(SoVolumeData);
49 
50 public:
51  static void initClass(void);
52  SoVolumeData(void);
53 
54  enum StorageHint {
55  AUTO,
56  TEX2D_MULTI,
57  TEX2D = TEX2D_MULTI,
58  TEX3D,
59  MEMORY,
60  VOLUMEPRO,
61  TEX2D_SINGLE
62  };
63 
64  enum SubMethod { NEAREST, MAX, AVERAGE };
65  enum OverMethod { NONE, CONSTANT, LINEAR, CUBIC };
66 
67  enum DataType { UNSIGNED_BYTE, UNSIGNED_SHORT };
68 
69  SoSFString fileName;
70  SoSFEnum storageHint;
74 
75  void setVolumeData(const SbVec3s & dimension, void * data,
76  SoVolumeData::DataType type = SoVolumeData::UNSIGNED_BYTE,
77  int significantbits = 0);
78  SbBool getVolumeData(SbVec3s & dimension, void *& data,
79  SoVolumeData::DataType & type,
80  int * significantbits = NULL) const;
81 
82  uint32_t getVoxelValue(const SbVec3s & voxelpos) const;
83 
84  void setVolumeSize(const SbBox3f & size);
85  SbBox3f getVolumeSize(void) const;
86 
87  void setPageSize(int size);
88  void setPageSize(const SbVec3s & size);
89  const SbVec3s & getPageSize(void) const;
90 
91  void setReader(SoVolumeReader & reader);
92  SoVolumeReader * getReader(void) const;
93 
94  void setTexMemorySize(int megatexels);
95  int getTexMemorySize(void) const;
96 
97  SbBool getMinMax(int & minval, int & maxval);
98  SbBool getHistogram(int & length, int *& histogram);
99 
100  SoVolumeData * subSetting(const SbBox3s & region);
101  void updateRegions(const SbBox3s * region, int num);
102  void loadRegions(const SbBox3s * region, int num, SoState * state, SoTransferFunction * node);
103 
104  SoVolumeData * reSampling(const SbVec3s & dimension,
105  SoVolumeData::SubMethod subMethod,
106  SoVolumeData::OverMethod = NONE);
107 
108  void enableSubSampling(SbBool enable);
109  SbBool isSubSamplingEnabled(void) const;
110 
111  void enableAutoSubSampling(SbBool enable);
112  SbBool isAutoSubSamplingEnabled(void) const;
113 
114  void enableAutoUnSampling(SbBool enable);
115  SbBool isAutoUnSamplingEnabled(void) const;
116 
117  void unSample(void);
118 
119  void setSubSamplingMethod(SubMethod method);
120  SubMethod getSubSamplingMethod(void) const;
121 
122  void setSubSamplingLevel(const SbVec3s & roi, const SbVec3s & secondary);
123  void getSubSamplingLevel(SbVec3s & roi, SbVec3s & secondary) const;
124 
125 
126 protected:
127  ~SoVolumeData();
128 
129  virtual void doAction(SoAction * action);
130  virtual void GLRender(SoGLRenderAction * action);
131  virtual void callback(SoCallbackAction * action);
132  virtual void getBoundingBox(SoGetBoundingBoxAction * action);
133  virtual void pick(SoPickAction * action);
134 
135 private:
136  friend class SoVolumeDataP;
137  class SoVolumeDataP * pimpl;
138 
139  // These were added to make it possible to control the world-space
140  // volume size from an iv-file. They basically provide the same
141  // functionality as the setVolumeSize()/getVolumeSize() functions.
142  SoSFVec3f volumeboxmin;
143  SoSFVec3f volumeboxmax;
144 };
145 
146 #endif // !SIMVOLEON_SOVOLUMEDATA_H

Copyright © 1998-2004 by Systems in Motion AS. All rights reserved.

Generated on Wed Jul 18 2012 20:32:32 for SIMVoleon by Doxygen. 1.8.1.1