Go to the documentation of this file.
16 #ifndef vtkVolumeMask_h
17 #define vtkVolumeMask_h
81 const char* arrayName,
84 bool needUpdate =
false;
85 bool modified =
false;
101 int obsolete = needUpdate || !this->
Loaded ||
107 while(!obsolete && i<6)
109 obsolete = obsolete || this->
LoadedExtent[i]>textureExtent[i];
111 obsolete = obsolete || this->
LoadedExtent[i]<textureExtent[i];
132 cout <<
"Mask should be VTK_UNSIGNED_CHAR." << endl;
136 cout <<
"Mask should be a one-component scalar field." << endl;
139 GLint internalFormat = GL_R8;
140 GLenum format = GL_RED;
141 GLenum
type = GL_UNSIGNED_BYTE;
148 textureSize[i] = textureExtent[2*i+1] - textureExtent[2*i] + 1;
153 glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &width);
154 this->
Loaded = textureSize[0] <= width && textureSize[1] <= width &&
155 textureSize[2] <= width;
159 this->
Loaded = textureSize[0] * textureSize[1]*
166 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
168 if(!(textureExtent[1]-textureExtent[0]+cellFlag==dim[0]))
170 glPixelStorei(GL_UNPACK_ROW_LENGTH,dim[0]-cellFlag);
172 if(!(textureExtent[3]-textureExtent[2]+cellFlag==dim[1]))
174 glPixelStorei(GL_UNPACK_IMAGE_HEIGHT,
178 ((textureExtent[4]*(dim[1]-cellFlag)+textureExtent[2]) *
179 (dim[0]-cellFlag)+textureExtent[0]) *
186 textureSize[0], textureSize[1], textureSize[2],
187 1, scalarType, dataPtr);
196 glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
197 glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0);
212 swapBounds[0] = (
spacing[0] < 0);
213 swapBounds[1] = (
spacing[1] < 0);
214 swapBounds[2] = (
spacing[2] < 0);
245 int wholeTextureExtent[6];
250 wholeTextureExtent[i]--;
267 if(this->
LoadedExtent[2*i+1]==wholeTextureExtent[2*i+1])
353 std::map<vtkImageData *,vtkVolumeMask*>
Map;
362 #endif // vtkVolumeMask_h
void ReleaseGraphicsResources(vtkWindow *win)
Deactivate and UnBind the texture.
virtual void SetBorderColor(float, float, float, float)
Border Color (RGBA).
vtkTextureObject * Texture
int GetNumberOfComponents()
static vtkDataArray * GetScalars(vtkDataSet *input, int scalarMode, int arrayAccessMode, int arrayId, const char *arrayName, int &cellFlag)
Internal helper function for getting the active scalars.
bool Create3DFromRaw(unsigned int width, unsigned int height, unsigned int depth, int numComps, int dataType, void *data)
Create a 3D texture from client memory numComps must be in [1-4].
virtual void SetMinificationFilter(int)
virtual void SetWrapS(int)
record modification and/or execution time
void SetFormat(unsigned int glFormat)
void SetContext(vtkOpenGLRenderWindow *)
Get/Set the context.
void SetInternalFormat(unsigned int glInternalFormat)
virtual void Delete()
Delete a VTK object.
abstract superclass for arrays of numeric data
virtual int * GetDimensions()
Get dimensions of this structured points dataset.
int GetTextureUnit()
Return the texture unit used for this texture.
window superclass for vtkRenderWindow
virtual void * GetVoidPointer(vtkIdType valueIdx)=0
Return a void pointer.
virtual int * GetExtent()
virtual void SetWrapT(int)
void Modified()
Set this objects time to the current time.
static vtkOpenGLRenderWindow * SafeDownCast(vtkObjectBase *o)
vtkIdType LoadedExtent[6]
vtkMTimeType GetMTime() override
Datasets are composite objects and need to check each part for MTime THIS METHOD IS THREAD SAFE.
vtkIdType * GetLoadedExtent()
void Deactivate()
Deactivate and UnBind the texture.
virtual int GetDataTypeSize()=0
Return the size of the underlying data type.
topologically and geometrically regular array of data
abstracts an OpenGL texture object.
virtual int GetDataType()=0
Return the underlying data type.
static vtkTextureObject * New()
#define VTK_UNSIGNED_CHAR
double * GetLoadedBounds()
virtual void SetMagnificationFilter(int)
void SetDataType(unsigned int glType)
virtual double * GetOrigin()
virtual void SetWrapR(int)
virtual unsigned int GetHandle()
Returns the OpenGL handle.
virtual double * GetSpacing()
abstract specification for renderers
std::map< vtkImageData *, vtkVolumeMask * > Map
vtkTimeStamp GetBuildTime()
void ReleaseGraphicsResources(vtkWindow *window)
vtkRenderWindow * GetRenderWindow()
void Update(vtkRenderer *ren, vtkImageData *input, int cellFlag, int textureExtent[6], int scalarMode, int arrayAccessMode, int arrayId, const char *arrayName, vtkIdType maxMemoryInBytes)
void Activate()
Activate and Bind the texture.