Help with orientation marker and ruler

Hello,
I need help with the following.

  1. Is there a line of Python code that I can add to my scripted module to make the Axes Orientation Marker show up on the red and yellow slices automatically, without navigating to the “Show Orientation Marker” menu for the red & yellow slices?

  2. What tools can I use to measure objects in an image other than this one? Something that allows the user to get more precise measurement of things like tumor diameter would be great.


    Please note that I want the user to be able to use the ruler while still having my scripted module selected. I don’t want the user switching back and forth between a “Measurement” module and my module in order to make a tumor diameter measurement. Is there any ruler option other than the one shown in my screenshot that is not a separate module?
    Thanks,
    Rohan Nadkarni

Orientation markers can be configured by adjusting properties of the corresponding view node. For example:

viewNode = getNode('vtkMRMLSliceNodeRed')
viewNode.SetOrientationMarkerType(viewNode.OrientationMarkerTypeHuman)

For manual diameter measurements, you can use markup line.

For automated measurements, you can segment the tumor using one of the semi-automatic or fully automatic methods in Segment Editor, then use Segment Statistics to compute its parameters (volume, largest diameter, smallest diameter, sphericity, surface area, mean/min/max intensity etc.).

I would recommend to add a qSlicerSimpleMarkupsWidget to your module GUI. It allows you to create a new markups (the type(s) you specify), rename, delete, start/stop placement, edit control points, show/hide, jump to points, etc.

You can see results in your module by adding a qMRMLSubjectHierarchyTreeView to your module widget.

To view/edit/copy/save quantification results, you can also add a qMRMLTableView. It can display the content of a table node. Table node is stored as a .csv file.

Thanks. I got the orientation marker part. Is there a good Slicer python code example for me to look at for the Markups Widget and Hierarchy Tree View?