Read In JSON Landmark files

Hi, I was wondering fi there was a way to read in landmark json files into 3D Slicer. I have Json files such as the following: [{“id”:“A”,“coordinates”:[-24.27351391435728,28.911588222173073,-123.59017318765929],“uncertainty”:{“stddevs”:[1.0314645489033252,1.0102904254707992,0.9816888397547289],“pcvectors”:[[-0.5679702259804069,-0.8192947708623337,-0.07852325029825062],[0.8142129897713141,-0.5732519865382224,0.09186602863757418],[-0.12027896610556417,-0.011757481346694274,0.9926705052256556]]}} created from another program and would like to be able to display them in 3D Slicer.

In short term, you can probably implement this in 10-15 lines of python code (read in the json file, iterate through its items and add each point to a markups node).

We are planning to implement markups import/export in json format. Is the file that you received follows some commonly used standard or it is just invented for a particular project?

It’s a common standard. I’ve found it in several statistical shape modelling programs.

Can you provide some references? It would be nice to know if there’s community agreement on such a standard. Does the standard have a name?

1 Like

So not sure if you’re talking about references for the standard itself or the software, but the software I have found that uses it is RvtkStatismo, Statismo, and Scalismo all for statistical shape modelling.

JSON itself is not a standard for anything specific, it is a format to exchange data of many different kinds. What we are interested in learning if there was a common convention to describe landmark coordinates agreed upon communities. From what I am seeing in the few lines of the sample in the original email, it doesn’t appear that way to me but I might be mistaken.

1 Like

Hi @stevenagl12 - Yes, that is the question. Your original email implied that this particular json encoding is a kind of agreed upon standard for interchange of these landmark files, so my question is whether this kind of file has a particular name (json is of course generic). Even better, perhaps there is a json schema and/or a human readable description of the file format?

If there’s something well defined we could consider supporting it - as @lassoan says, it doesn’t look like it would be much work to implement.

1 Like

I’m not exactly sure, all I know is that using those softwares previously mentioend produces the same type of JSON formatted files with coordinates, uncertainty, and pcvectors from any mesh being landmarked.

Can you post a link to a json file that contains named landmarks? Statismo file format is probably only used by that software, so Slicer would not adopt it as is, but we could still learn from it.

Hi

EPAD also works with JSON landmarks using AIM protocolAnnotation and Image Markup - AIM.

We checked out AIM but in many aspects it was too complex, yet it would have been too limiting to be used as an internal storage format. We decided that if there is interest then exporter/importer can be added for this format (similarly to DICOM).