Using json files to create markups

Hi, I’m trying to create a line markup by loading a json file. I am able to see the line in the 3D view but not in the slice views despite trying our various display and visibility options. Could you share an example json file for a line that works? Similar to the example for fiducials provided here - Markups — 3D Slicer documentation.

Also, for the schema, I am not able to use v1.0.3 - could you provide a correct link to use for this?


In recent Slicer versions we added positionStatus field, which seems to be initialized to undefined by default. I’ll change that to be set to defined by default when position is specified. The new behavior will be available in tomorrow’s Slicer Preview Release.

As a workaround, you can specify "positionStatus": "defined" for each control point.

That works - thank you!

One more question - when creating fiducials using a json file, is there a way to change the color of each fiducial individually?

Control points in a Markups Point List can have unique label names for each control point, but the entire list has a single display which includes color. Therefore all control points in a single Point List must have the same color, but different Point Lists can have their own color.

In one point list you can use two colors - selected and unselected.

In recent Slicer versions you can add any amount of additional metadata for each control point. That can be used for coloring curves, but not yet for coloring the control points. This control point coloring would not be hard to implement, but right now I don’t know about any project that will need this in the near future.

If you need this feature and you are somewhat familiar with C++ then you can help with the implementation. Alternatively, you can generate a colored model using vtkGlyph3D filter using a short (about 10-20 lines) Python script.

Thank you for the suggestions! Sorry I don’t have experience with C++ so can’t help with that. It’s not crucial for me at the moment - the workaround of using separate point lists should be enough for now.