Hello,
I would like to display a 2D image stored in a 3D numpy array (RGB image) only in one of the slices (for example the Red slice).
img = np.zeros((50,50,3))
img[10:40,20:30, 0] = 200 # saturate a part of the first channel
new_volume_node = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLScalarVolumeNode")
slicer.util.updateVolumeFromArray(new_volume_node, img)
slicer.app.layoutManager().sliceWidget('Red').sliceLogic().GetSliceCompositeNode().SetForegroundVolumeID(new_volume_node.GetID())
With the code above each dimension of the array is connected to one of the slices (1st dimension to Red, 2nd to Green, 3rd to Yellow). Is there a way to display the whole image to one slice?