Hello Slicer Community,
My ultimate goal is to create a button that copies a manual segmentation from the slice below/above and copies it into the current slice (presumably axial/Red SliceView). Note that due to the problems with segmenting on oblique views, I always use the “Rotate to Volume Plane” function after loading a Volume.
My plan of attack was to
- Get the Red, Yellow, Green coordinates with
layoutManager = slicer.app.layoutManager() offsets =  for sliceViewName in ['Red','Yellow','Green']: sliceWidget = layoutManager.sliceWidget(sliceViewName) sliceWidgetLogic = sliceWidget.sliceLogic() offset = sliceWidgetLogic.GetSliceOffset() offsets.append(offset) z,x,y = offsets
- Use the z (“Red”) offset and use RAS to IJK to get the slice level
- Copy the z-1 or z+1 slice from the segment array onto the current z slice
- Update the segment in order to finalize the “copy”
However, after doing “Rotate to Volume Plane”, the slice offsets can no longer be used to get the IJK coordinates because the Direction matrix has changed.
There are two ways of solving my problem, but I’m not sure which one is easiest/doable in Slicer
- Instead of getting the slice offset, simply get the current ‘k’ slice from the Red SliceView, if this function exists. (After “Rotate to Volume Plane” all Offsets correspond to a unique z coordinate).
- Get the transformation from “Rotate to Volume Plane” in order to transform my Red Slice Offset from the “Rotate to Volume Plane” space to the “World” space to “Voxel” space.
Thank you for any tips or comments!