jumbojing
(Jumbo Jing)
February 19, 2022, 9:20am
1
Can the OrientationMarkerType be customized?
我想用椎体代替human , 我该怎么做呢?
I want to replace the OrientationMarkerTypehuman with a vertebral body, how can I do that?
@lassoan @Juicy@jamesobutler @jcfr @pieper
lassoan
(Andras Lasso)
February 19, 2022, 2:22pm
2
Yes, sure, you can use any model as orientation marker. See for example how it is done in SlicerHeart:
moduleDir = os.path.dirname(slicer.modules.valveannulusanalysis.path)
orientationMarkerModelFilePath = os.path.join(moduleDir, 'Resources', 'HeartOrientationMarker.vtp')
orientationMarkerNode = slicer.util.loadModel(orientationMarkerModelFilePath)
orientationMarkerNode.HideFromEditorsOn()
orientationMarkerNode.GetDisplayNode().SetVisibility(False) # hide from the viewers, just use it as an orientation marker
orientationMarkerNode.SetName('HeartOrientationMarker')
viewNode.SetOrientationMarkerHumanModelNodeID(orientationMarkerNode.GetID() )
viewNode.SetOrientationMarkerType(slicer.vtkMRMLAbstractViewNode.OrientationMarkerTypeHuman)
viewNode.SetOrientationMarkerSize(slicer.vtkMRMLAbstractViewNode.OrientationMarkerSizeMedium)
jumbojing
(Jumbo Jing)
February 20, 2022, 4:22am
3
太好了, 可是,老师,我做的model导出后,再次导入就变成了黄色,怎么做带不同的颜色的vtp模型呢?就像这样:
Great, but, teacher, after the model I made is exported, it turns yellow when I import it again. How can I make a vtp model with different colors? Like this:
lassoan
(Andras Lasso)
February 20, 2022, 4:54am
4
You can use VTK filters for this: add an RGB color vector to each model node (using vtkArrayCalculator) and then merge them into a single polydata (using vtkAppendPolyData).