This is a volume slice created by other module, and I can display different slices by dragging the position.
This is not a plane, but a volume node with only one sheet
so that I can transfer the sigle volume to other programs in real time through IGT.
I would like to ask if there are other ways or script to create this kind of slice, and I can specify the length and width of the slice
Hi, maybe this script helps: Volume reslice with tracking Ā· GitHub
You need to install the SlicerIGT extension for the Volume Reslice Driver module to use this script.
It uses a transform node (SliceToRas). Every time that transform changes, it updates the 2D images that is resliced from the 3D volume.
Hi ungi,
Great script so far. Is it possible to control three slices red, green and yellow together in the meantime by using the same matrix?
sliceToRasTransform = vtk.vtkTransform()
sliceToRasTransform.SetMatrix(my_matrix)
Thanks a lot!
If you duplicate the code under āShow and follow output image in red slice viewā and replace the word āredā with āgreenā, then the green slice will do the same as the red. And you may repeat this with the yellow slice too. But Iām not sure I understand what you want to achieve. Why would you show the same slice three times? They are duplicates in the 2D views, and they overlap and hide each other in the 3D view.
Thank you for the quick answer. If I pass the same matrix to sliceToRasTransform for green, red and yellow slice.
sliceToRasNode = slicer.mrmlScene.GetFirstNodeByName(āSliceToRas_%sā % strcolor)
outputNode = slicer.mrmlScene.GetFirstNodeByName(āOutputVolume_%sā % strcolor)
They will generate the same image? Or different image slice?
Thanks a lot!
The same transform matrix will generate the same image. If you want the same image in all views, then you donāt need to change the code related to reslice, because you can reuse the same image in all the views. Just duplicate lines 87-93 and change āredā to āgreenā.
Hi Tamas,
I found that by using your script can achieve the same functions by SetSliceToRASByNTP. One question is that in your script it does not use SetSliceToRASByNTP to position the slice. Is there any difference between your script and uusing SetSliceToRASByNTP? Thanks a lot!
It should be possible to achieve the same function using SetSliceToRASByNTP too. I just use Volume Reslice Driver for moving the slice, because that is more common in IGT applications. It has a user interface so we donāt always need to code.
Hi Tamas,
Ok that is good to know. Also after running the script, one of the slice edge point is on the center of wireframe box. Is it possible to overlap the center with the wireframe box? Thanks a lot!
Do you mean the yellow coordinate system model? I donāt see a wireframe box after running the script. If you mean the yellow model, then you can add a transform node in the transform hierarchy tree (Data module) between the model and the SliceToRAS transform to move the model relative to the slice.
Hi Tamas,
Another question is when I rotate the red, green and yellow slice, is it possible to rotate by the image sliceās center point? Now it seems that it is rotated by the points on the edges. Thanks.
Last time I checked, this was not directly possible. See comment near the beginning of the script. But of course you may create additional transforms in the scene and set up the transform hierarchy to achieve the same effect. Similar to how the yellow model can be translated to the center of the slice.