16 #ifndef vtkVolumeMask_h_ 17 #define vtkVolumeMask_h_ 21 #include <vtkOpenGLRenderWindow.h> 24 #include <vtkTextureObject.h> 75 const char* arrayName,
78 bool needUpdate =
false;
79 bool modified =
false;
95 int obsolete = needUpdate || !this->
Loaded ||
101 while(!obsolete && i<6)
103 obsolete = obsolete || this->
LoadedExtent[i]>textureExtent[i];
105 obsolete = obsolete || this->
LoadedExtent[i]<textureExtent[i];
126 cout <<
"Mask should be VTK_UNSIGNED_CHAR." << endl;
130 cout <<
"Mask should be a one-component scalar field." << endl;
142 textureSize[i] = textureExtent[2*i+1] - textureExtent[2*i] + 1;
147 glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &width);
148 this->
Loaded = textureSize[0] <= width && textureSize[1] <= width &&
149 textureSize[2] <=
width;
153 this->
Loaded = textureSize[0] * textureSize[1]*
160 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
162 if(!(textureExtent[1]-textureExtent[0]+cellFlag==dim[0]))
164 glPixelStorei(GL_UNPACK_ROW_LENGTH,dim[0]-cellFlag);
166 if(!(textureExtent[3]-textureExtent[2]+cellFlag==dim[1]))
168 glPixelStorei(GL_UNPACK_IMAGE_HEIGHT_EXT,
172 ((textureExtent[4]*(dim[1]-cellFlag)+textureExtent[2]) *
173 (dim[0]-cellFlag)+textureExtent[0]) *
180 textureSize[0], textureSize[1], textureSize[2],
181 1, scalarType, dataPtr);
191 glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
192 glPixelStorei(GL_UNPACK_IMAGE_HEIGHT_EXT, 0);
207 swapBounds[0] = (spacing[0] < 0);
208 swapBounds[1] = (spacing[1] < 0);
209 swapBounds[2] = (spacing[2] < 0);
225 static_cast<double>(this->
LoadedExtent[0+swapBounds[0]])*spacing[0];
227 static_cast<double>(this->
LoadedExtent[2+swapBounds[1]])*spacing[1];
228 this->LoadedBounds[4]=origin[2]+
229 static_cast<double>(this->
LoadedExtent[4+swapBounds[2]])*spacing[2];
230 this->LoadedBounds[1]=origin[0]+
231 static_cast<double>(this->
LoadedExtent[1-swapBounds[0]])*spacing[0];
232 this->LoadedBounds[3]=origin[1]+
233 static_cast<double>(this->
LoadedExtent[3-swapBounds[1]])*spacing[1];
234 this->LoadedBounds[5]=origin[2]+
235 static_cast<double>(this->
LoadedExtent[5-swapBounds[2]])*spacing[2];
240 int wholeTextureExtent[6];
245 wholeTextureExtent[i]--;
259 (
static_cast<double>(this->
LoadedExtent[2*i])+0.5)*spacing[i];
262 if(this->
LoadedExtent[2*i+1]==wholeTextureExtent[2*i+1])
265 (
static_cast<double>(this->
LoadedExtent[2*i+1])+1.0)*spacing[i];
270 (
static_cast<double>(this->
LoadedExtent[2*i+1])+0.5)*spacing[i];
348 std::map<vtkImageData *,vtkVolumeMask*>
Map;
357 #endif // vtkVolumeMask_h_ vtkIdType * GetLoadedExtent()
GLuint GLuint GLsizei GLenum type
void SetContext(vtkRenderWindow *)
vtkTimeStamp GetBuildTime()
GLenum GLenum GLenum input
virtual int GetDataTypeSize()=0
static vtkOpenGLRenderWindow * SafeDownCast(vtkObjectBase *o)
record modification and/or execution time
static vtkDataArray * GetScalars(vtkDataSet *input, int scalarMode, int arrayAccessMode, int arrayId, const char *arrayName, int &cellFlag)
abstract specification for renderers
virtual int GetDataType()=0
virtual void SetWrapR(int)
void SetDataType(unsigned int glType)
virtual void SetBorderColor(float, float, float, float)
double * GetLoadedBounds()
int GetNumberOfComponents()
vtkTextureObject * Texture
void ReleaseGraphicsResources(vtkWindow *window)
window superclass for vtkRenderWindow
unsigned long int GetMTime()
virtual int * GetDimensions()
virtual double * GetOrigin()
bool Create3DFromRaw(unsigned int width, unsigned int height, unsigned int depth, int numComps, int dataType, void *data)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
topologically and geometrically regular array of data
virtual void SetMinificationFilter(int)
GLint GLint GLsizei width
abstract superclass for arrays of numeric data
virtual double * GetSpacing()
virtual unsigned int GetHandle()
void Activate(unsigned int texUnit)
void SetInternalFormat(unsigned int glInternalFormat)
virtual int * GetExtent()
void Update(vtkRenderer *ren, vtkImageData *input, int cellFlag, int textureExtent[6], int scalarMode, int arrayAccessMode, int arrayId, const char *arrayName, vtkIdType maxMemoryInBytes)
virtual void * GetVoidPointer(vtkIdType id)=0
abstracts an OpenGL texture object.
typedef GLint(APIENTRYP PFNGLGETATTRIBLOCATIONPROC)(GLuint program
#define VTK_UNSIGNED_CHAR
typedef GLenum(APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum target)
void ReleaseGraphicsResources(vtkWindow *win)
static vtkTextureObject * New()
virtual void SetWrapS(int)
vtkRenderWindow * GetRenderWindow()
std::map< vtkImageData *, vtkVolumeMask * > Map
vtkIdType LoadedExtent[6]
virtual void SetWrapT(int)
void SetFormat(unsigned int glFormat)
virtual void SetMagnificationFilter(int)