Changing Size and color of individual interaction handles of ROI

To implement ROI I am using vtkMRMLMarkupsROINode class. There is SetInteractionHandleScale() method in this class, but it is changing size of all interaction handles.
Is it possible to change size and color of one individual interaction handle of ROI?

@RafaelPalomar maybe you can give some insight here?

The handle sizes and colors are hard-coded, see


Thanks for the insight @cpinter

@maptekarev Can you tell us a bit about the motivation? I think the color can be made customizable relatively easily if you don’t need a GUI for that.

@cpinter Ii want the green and red handle on roi to correspond with feet color of the human model, and also change size or opacity of white corner handles.

Ah OK, so it’s about ROIs. It is different from what I was investigating. FYI this is what interaction handle means without the special context you just mentioned:


The code is quite similar for ROIs though:

I think customizing the color could be solved by adding members for the interaction handle colors to the markup display node (initialized with the hard-coded colors), and using these members in the two functions I have linked about colors. Note that in ROIs you have not three but six interaction colors, so this would need to be handled somehow if you want the left-right colors to be different (note the same red color setting for L and R). Maybe we could have X, Y, and Z interaction handle color getter/setters, with optional AlternateX or something similar for the inverse directions in the ROIs. @lassoan what do you think?

ROI can be rotated, so there is no strict relationship between world coordinate system axis and ROI axis directions.

That said, the colors could be made customizable. If it is acceptable to provide only a low-level API (expose the color on the ROI representation class) then it is a very simple and small change. If we want to store it in MRML then it is a bigger change and I’m not sure if it is worth it (if it is an important use case or many users will ask for it then it is probaly worth the trouble implementing it).

1 Like