 |
VTK
9.0.1
|
Go to the documentation of this file.
16 #ifndef vtkVolumeMask_h
17 #define vtkVolumeMask_h
66 int scalarMode,
int arrayAccessMode,
int arrayId,
const char* arrayName,
69 bool needUpdate =
false;
70 bool modified =
false;
90 while (!obsolete && i < 6)
92 obsolete = obsolete || this->
LoadedExtent[i] > textureExtent[i];
94 obsolete = obsolete || this->
LoadedExtent[i] < textureExtent[i];
106 input, scalarMode, arrayAccessMode, arrayId, arrayName, this->
LoadedCellFlag);
113 cout <<
"Mask should be VTK_UNSIGNED_CHAR." << endl;
117 cout <<
"Mask should be a one-component scalar field." << endl;
120 GLint internalFormat = GL_R8;
121 GLenum format = GL_RED;
122 GLenum
type = GL_UNSIGNED_BYTE;
129 textureSize[i] = textureExtent[2 * i + 1] - textureExtent[2 * i] + 1;
134 glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &width);
135 this->
Loaded = textureSize[0] <= width && textureSize[1] <= width && textureSize[2] <= width;
139 this->
Loaded = textureSize[0] * textureSize[1] * textureSize[2] *
144 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
146 if (!(textureExtent[1] - textureExtent[0] + cellFlag == dim[0]))
148 glPixelStorei(GL_UNPACK_ROW_LENGTH, dim[0] - cellFlag);
150 if (!(textureExtent[3] - textureExtent[2] + cellFlag == dim[1]))
152 glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, dim[1] - cellFlag);
155 ((textureExtent[4] * (dim[1] - cellFlag) + textureExtent[2]) * (dim[0] - cellFlag) +
163 textureSize[0], textureSize[1], textureSize[2], 1, scalarType, dataPtr);
172 glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
173 glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0);
188 swapBounds[0] = (
spacing[0] < 0);
189 swapBounds[1] = (
spacing[1] < 0);
190 swapBounds[2] = (
spacing[2] < 0);
209 this->LoadedBounds[4] =
211 this->LoadedBounds[1] =
213 this->LoadedBounds[3] =
215 this->LoadedBounds[5] =
220 int wholeTextureExtent[6];
225 wholeTextureExtent[i]--;
232 if (this->
LoadedExtent[2 * i] == wholeTextureExtent[2 * i])
242 if (this->
LoadedExtent[2 * i + 1] == wholeTextureExtent[2 * i + 1])
244 this->
LoadedBounds[2 * i + 1 - swapBounds[i]] = origin[i] +
249 this->
LoadedBounds[2 * i + 1 - swapBounds[i]] = origin[i] +
315 std::map<vtkImageData*, vtkVolumeMask*>
Map;
323 #endif // vtkVolumeMask_h
virtual void SetBorderColor(float, float, float, float)
Border Color (RGBA).
vtkTextureObject * Texture
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)
virtual int GetDataType() const =0
Return the underlying data type.
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.
virtual void Activate()
Activate and Bind the 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.
int GetNumberOfComponents() const
vtkIdType * GetLoadedExtent()
void Deactivate()
Deactivate and UnBind the texture.
topologically and geometrically regular array of data
abstracts an OpenGL texture object.
static vtkTextureObject * New()
#define VTK_UNSIGNED_CHAR
virtual void ReleaseGraphicsResources(vtkWindow *win)
Deactivate and UnBind the texture.
double * GetLoadedBounds()
virtual void SetMagnificationFilter(int)
void SetDataType(unsigned int glType)
virtual double * GetOrigin()
Set/Get the origin of the dataset.
virtual void SetWrapR(int)
virtual unsigned int GetHandle()
Returns the OpenGL handle.
virtual double * GetSpacing()
Set the spacing (width,height,length) of the cubical cells that compose the data set.
abstract specification for renderers
virtual int GetDataTypeSize() const =0
Return the size of the underlying data type.
vtkTimeStamp GetBuildTime()
void ReleaseGraphicsResources(vtkWindow *window)
vtkRenderWindow * GetRenderWindow()
std::map< vtkImageData *, vtkVolumeMask * > Map
void Update(vtkRenderer *ren, vtkImageData *input, int cellFlag, int textureExtent[6], int scalarMode, int arrayAccessMode, int arrayId, const char *arrayName, vtkIdType maxMemoryInBytes)