Json markups colors do not work

Hi all,

I am trying to show a bunch of markup points using json file. The points are being loaded, and their positions are correct. However, I am also trying to set their colors and sizes, but somehow, slicer uses the default color and size. It is as if the colors and sizes I set in json do not have an effect at all…

I am using Slicer 5.6.2 and Json scheme here:

Does anyone have any idea about what might be going on ?
Would a mismatch in versions cause this ? I assume if my json file format was totally wrong, the positions would be wrong too, not just colors and sizes.

Thanks a lot !!
Fatih.

I can’t replicate this in 5.6.2. PointList markup load exactly with the color I specified. I suspect your JSON is incorrect somehow.

Perhaps work of an example you saved directly from Slicer?

1 Like

Thank you ! I am trying it.

Just to make sure: With the correct json file, I should be able to adjust the colors of markups such that, I am using a continuous colorbar for hundreds of points, right ?
I mean, I am not forced to use the same color for all markup points when I use json, right ?

Thanks!

All the control points in a markup node (whether it is a curve or pointlist) will have the same color.

From a different thread, I saw that it is possible to write a JSON file that will have multiple markup nodes. that way you can create one node for every point and have full control over its colors. But you have to do it yourself.

I couldn’t find the thread (I am really no happy with the search on discourse), but it was last week, someone was asking a similar thing.

Markup control points all displayed with the selected or unselected color. I would not recommend to add a new markup node for each point for performance reasons. If you want to assign an individual color to each point then you can do it with a model node.

It woild not be hard at all to color control points by a data array, but it has not been requested yet.

Thanks a lot for helpful comments !

How about simply creating many different json files, one for each markup point, with its corresponding color, size, etc. properties ? I know it sounds odd. But I don’t know how to do it the way @lassoan described:

Blockquote
If you want to assign an individual color to each point then you can do it with a model node.

Also, I think it could be useful to have this feature in Slicer. I don’t know if I we are the only ones who use Slicer to display brain electrophysiology recordings and activity, but indeed we frequently need to show different subset of points with different display properties, and sometimes we also need to change display properties in a continuous manner, as in this case.

Thanks a lot,
Fatih.

Depends on how many you have, if you have hundreds your scene fill get bogged down, and interactions will be too slow.

You can convert the markups to models (3d spheres), see the example here:
SlicerMorph/Scripts (github.com)

You can modify the script to change their color properties…

Thanks!

To be able able to run these python scripts, do I need to run them using Slicer python extension? Or should I save the control points in a way that allows this script to work?

Thanks a lot,
Fatih

Create your points. And copy paste the script into the python console. You may need to change the pointList name to match it to the script one (F)