FNNDSC / FNNDSC/ami

Translate slice in viewers_compare example

Open
#256 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
745
Forks
212
PR merge metrics
No merged PRs in 30d

Description

Hi,
Based on the example of **viewers-compare** (https://github.com/FNNDSC/ami/tree/dev/examples/viewers_compare) I try to perform a translation 2d on one of two slice in the scene.

According to this issue https://github.com/FNNDSC/ami/issues/125 , I try to transpose the transalation for my case like :

`

let shiftFolder = gui.addFolder('Shift');
let modeMix = shiftFolder.add(uniformsLayerMix.uMixMode, 'value', 0, 2).step(1).listen();

let shiftxMix = shiftFolder.add(appParams, 'dx', -stack2.dimensionsIJK.x, stack2.dimensionsIJK.x).step(1).listen();
shiftxMix.onChange(function(value) {

let pos = parseInt((stack2.dimensionsIJK.x / 2)) + value;
let mat = new THREE.Matrix4().makeTranslation(value, 0, 0);

stackHelper2.stack.regMatrix = mat;
stackHelper2.stack.computeIJK2LPS();

stackHelper2.slice._uniforms.uWorldToData.value = stackHelper2.stack.lps2IJK;
stackHelper2.slice.planePosition.x = pos;
stackHelper2.slice._update();

updateLayer1();
updateLayerMix();
});

`
I use a stackHelper2 initialized like default stackHelper in code, and passed to **buildGUI** function to add a dx slider change the translation x value.

With this code, I have the following result when I changed the dx slider value :

![capture du 2018-03-07 18 27 58](https://user-images.githubusercontent.com/36926926/37107860-b7044522-2235-11e8-8ecf-17803b3769b4.png)

The geometry of slice seems to be translate but not the inner texture, do you have any idea ?

_I can share more code if necessary_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.