mschumaker
(Michael Schumaker)
August 16, 2018, 9:55pm
1
I have a 3D model that I would like to display as intersections on some 2D slice views, but hide it on another. I have a vtkMRMLModelNode called arteryModelNode:
arteryModelDisplayNode = arteryModelNode.GetModelDisplayNode()
arteryModelDisplayNode.SetSliceIntersectionVisibility(True)
Below is an image. I want the intersection to show on the Red, Green, and Yellow slices, but not on the grey one “S1”. Is there a way to do this?
pieper
(Steve Pieper (Isomics, Inc.))
August 17, 2018, 1:09pm
2
Hi @mschumaker -
Yes, if you explicitly set the view node ids where you want a displayable to appear it won’t be shown in the others.
/// Add View Node ID for the view to display this node in.
/// \sa ViewNodeIDs, RemoveViewNodeID(), RemoveAllViewNodeIDs()
void AddViewNodeID(const char* viewNodeID);
/// Remove View Node ID for the view to display this node in.
/// \sa ViewNodeIDs, AddViewNodeID(), RemoveAllViewNodeIDs()
void RemoveViewNodeID(char* viewNodeID);
/// Remove All View Node IDs for the views to display this node in.
/// \sa ViewNodeIDs, AddViewNodeID(), RemoveViewNodeID()
void RemoveAllViewNodeIDs();
/// Get number of View Node ID's for the view to display this node in.
/// If 0, display in all views
/// \sa ViewNodeIDs, GetViewNodeIDs(), AddViewNodeID()
inline int GetNumberOfViewNodeIDs()const;
/// Get View Node ID's for the view to display this node in.
/// If NULL, display in all views
/// \sa ViewNodeIDs, GetViewNodeIDs(), AddViewNodeID()
const char* GetNthViewNodeID(unsigned int index);
/// Get all View Node ID's for the view to display this node in.
/// If empty, display in all views
/// \sa ViewNodeIDs, GetNthViewNodeID(), AddViewNodeID()
This file has been truncated. show original
I don’t know if there’s a model slice intersection example, but here’s how it works for fiducials:
def restrictLandmarksToViews(self):
"""Set fiducials so they only show up in the view
for the volume on which they were defined.
Also turn off other fiducial lists, since leaving
them visible can interfere with picking.
Since multiple landmarks will be in the same lists, keep track of the
lists that have been processed to avoid duplicated updates.
"""
slicer.mrmlScene.StartState(slicer.mrmlScene.BatchProcessState)
volumeNodes = self.currentVolumeNodes()
if self.sliceNodesByViewName:
landmarks = self.logic.landmarksForVolumes(volumeNodes)
activeFiducialLists = []
processedFiducialLists = []
for landmarkName in landmarks:
for fiducialList,index in landmarks[landmarkName]:
if fiducialList in processedFiducialLists:
continue
processedFiducialLists.append(fiducialList)
activeFiducialLists.append(fiducialList)
This file has been truncated. show original
2 Likes
mschumaker
(Michael Schumaker)
August 17, 2018, 4:24pm
3
Thank you! That’s exactly what I was looking for.