Prepopulation of measurement issue

Hi there,

I am trying to reduce the number of clicks along my project after the initial allocation of hard and soft tissue landmarks and manual axes.

I also save and load my landmark collections and then lock their control points. I have saved the appropriate length measurements that I need across the dataset in JSON format (e.g. nasal dorsum length - two control points se and prn) with the little lock icon being unlocked, then I load them into the scene.
I am unsure why, but the measurements generated this way seem all over the place and disregard the landmarks of the current dataset (which have the same name as the sample dataset`s landmarks the markups file was generated from), and measures the distances of the sample dataset.

Am I missing a crucial part when saving the JSON or am I applying them the incorrect way?

Thank you in advance for your help!

Are the endpoints of the lines don’t appear correctly? Or the length values are not what you expect?

When you save a markup to a mrk.json file then the control points, measurements, display settings, etc. are all written into the file. If you load that file then the entire markup, along with control point positions, measurements, etc. will be added back to the scene. It is not merged with any content already in the scene (does not matter if the node name or control point labels match), but it is added to the scene.

I would recommend to create a markup point list with all the important points, then write a short Python script (that you can run with a keyboard shortcut) that adds all the measurements between those points as new markups (lines, curves, angles, etc. - anything you need).

Thank you for the very speedy reply - I think the issue lies within the saving of the coordinates of the previous scene and then opening them in current scene. The length values are what is expected but the endpoints are incorrect (again, I think they’re added to the current scene from the previous one where the length values were correct)
Do you mind giving an example or pointing me to the right code snippet in the repository of the script you mentioned?

Thank you again for your patience and assistance.

Do you construct a mrk.json file manually? Make sure you use the correct coordinate system. In all files, by default we use LPS coordinate system, while in Slicer coordinates are usually stored in RAS coordinate system. Conversion is trivial: invert the sign of the first two coordinate components.

I save my landmarks in the json file only for their description and easy loading in for the scene - they need to be re-allocated for all my models individually anyway.
I would be more interested in the programming of linear measurements in the scenes as it would save me a considerable amount of time. How do I define the lines I need (to measure or otherwise) to be generated in the markups without needing to drag the control points in each of them?

EDIT
I realise I was not clear in explaining what I’m trying to do with the suggested scripting. I am trying to define the linear measurements I need after allocating my list of landmarks - the landmarks are named the same and the measurements will be the same throughout my research. With the script repository’s code I can populate the scene with measurement names, but I still need to click to the various landmarks which I am trying to avoid via the script.

I was wondering if the issue is with the approach. For my linear measurements, the script repository offers a solution where the endpoints are generated by coordinates in the script. I, however, am trying to do the opposite - I have my endpoints as node names (e.g. prn-porion, se-sellion) and would like to compute the lines using the node names (e.g. prn-se).
Is there a script that I cloud modify? I apologise for the repeated questions, but I have no background knowledge of python…
Thank you again for your time!