Skip to content

Commit 1dde465

Browse files
committed
fix(ImageResliceMapper): worldToTextureCoordinates transform
1 parent 67c8815 commit 1dde465

File tree

1 file changed

+3
-10
lines changed
  • Sources/Rendering/OpenGL/ImageResliceMapper

1 file changed

+3
-10
lines changed

Sources/Rendering/OpenGL/ImageResliceMapper/index.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -514,16 +514,9 @@ function vtkOpenGLImageResliceMapper(publicAPI, model) {
514514
// Set the world->texture matrix
515515
if (program.isUniformUsed('WCTCMatrix')) {
516516
const image = model.currentInput;
517-
mat4.identity(model.tmpMat4);
518-
const bounds = image.getBounds();
519-
const sc = [
520-
bounds[1] - bounds[0],
521-
bounds[3] - bounds[2],
522-
bounds[5] - bounds[4],
523-
];
524-
const o = [bounds[0], bounds[2], bounds[4]];
525-
const q = [0, 0, 0, 1];
526-
mat4.fromRotationTranslationScale(model.tmpMat4, q, o, sc);
517+
const dim = image.getDimensions();
518+
mat4.copy(model.tmpMat4, image.getIndexToWorld());
519+
mat4.scale(model.tmpMat4, model.tmpMat4, dim);
527520
mat4.invert(model.tmpMat4, model.tmpMat4);
528521
if (inverseShiftScaleMatrix) {
529522
mat4.multiply(model.tmpMat4, model.tmpMat4, inverseShiftScaleMatrix);

0 commit comments

Comments
 (0)