How to merge two resliceActors one on top of other?

Hey, in a ResliceCursorWidget, I’m trying to display the brain volume, in addition to a fMRI mask on the top of it, so on each widget interaction we could see the changes in the brain slices and in fMRI slices,

I used almost the same code as the official example, and I added another instance of ImageSlice/ ResliceActor/ ResliceMapper and I made the fMRI actor transparent so we can see behind it, and I changed the color of the mask, as @finetjul told me (many thanks).

and I added the actors to the scene (the fMRI mask in last so we could see it on the top of the brain), and I added in each widget interaction updateSlices for the two actors (fmri mask and the brain).

But the fMRI mask is not displayed, only the brain in the scene, I know the fMRI mask actor is in the wrong position somewhere in the scene, because when I I do widget.setImage() on the image of the fMRI mask instead of the brain, I see the fMRI mask but the brain just below/above them like you see here:

ezgif-2-39f3d262b8

Here is a sandbox of my code, it is working, to see the difference you can do widget.setImage(image); // the volume of the brain or you can do widget.setImage(image1); // the volume of the fMRI mask

https://codesandbox.io/

Your images are not aligned:

volume.vti:

<ImageData WholeExtent="0 175 0 255 0 255" Origin="-67.81338860802146 -187.20719788146 -170.263948822697" Spacing="1.0000000000000082 1 1" Direction="1 0 0 0 1 0 0 0 1">

mask.vti

<ImageData WholeExtent="0 181 0 255 0 255" Origin="0 0 0" Spacing="1 1 1" Direction="1 0 0 0 1 0 0 0 1">

Your codesandbox sharing is helpful, you might also want to contribute your mask demo case to the existing “ResliceCursorWidget” example in VTK.js. One benefit is that it will be maintained by the community.

1 Like

Thank you for your helpful answer, I was able to solve it by adding imagefMRI.setOrigin(imageBrain.getOrigin()), but not totally solved, The extent and the spacing are not the same.

Yes I will be happy to contribute this demo, I searched in github ResliceCursorWidget example but it is not there, how do I contribute my demo instead?

You will find here the code for the ResliceCursorWidget example:

1 Like