-
-
Notifications
You must be signed in to change notification settings - Fork 401
Open
Description
Hi! ๐
Firstly, thanks for your work on this project! ๐
Today I used patch-package to patch @kitware/[email protected] for the project I'm working on.
Currently, the color width is set using model.renderable.getColorTextureWidth(), but if the imageโs scalar range exceeds that value, I want the color width to automatically expand to the maximum size.
Here is the diff that solved my problem:
diff --git a/node_modules/@kitware/vtk.js/Rendering/OpenGL/ImageMapper.js b/node_modules/@kitware/vtk.js/Rendering/OpenGL/ImageMapper.js
index bb676c7..cee022a 100644
--- a/node_modules/@kitware/vtk.js/Rendering/OpenGL/ImageMapper.js
+++ b/node_modules/@kitware/vtk.js/Rendering/OpenGL/ImageMapper.js
@@ -581,6 +581,7 @@ function vtkOpenGLImageMapper(publicAPI, model) {
if (!imgScalars) {
return;
}
+ const maxScalarRange = image.getPointData().getScalars().getRange()[1];
const dataType = imgScalars.getDataType();
const numComp = imgScalars.getNumberOfComponents();
const actorProperty = actor.getProperty();
@@ -602,7 +603,7 @@ function vtkOpenGLImageMapper(publicAPI, model) {
});
model.colorTexture.setOpenGLRenderWindow(model._openGLRenderWindow);
let cWidth = model.renderable.getColorTextureWidth();
- if (cWidth <= 0) {
+ if (cWidth <= 0 || maxScalarRange > cWidth) {
cWidth = model.context.getParameter(model.context.MAX_TEXTURE_SIZE);
}
const cSize = cWidth * textureHeight * 3;
@@ -680,7 +681,7 @@ function vtkOpenGLImageMapper(publicAPI, model) {
const reBuildPwf = !pwfTex?.oglObject?.getHandle() || pwfTex?.hash !== pwfunToString;
if (reBuildPwf) {
let pwfWidth = model.renderable.getOpacityTextureWidth();
- if (pwfWidth <= 0) {
+ if (pwfWidth <= 0 || maxScalarRange > pwfWidth) {
pwfWidth = model.context.getParameter(model.context.MAX_TEXTURE_SIZE);
}
const pwfSize = pwfWidth * textureHeight;This issue body was partially generated by patch-package.
ondaa
Metadata
Metadata
Assignees
Labels
No labels