BICCN / cell-locator

manually align specimens to annotated 3D spaces
https://cell-locator.readthedocs.io
Other
19 stars 7 forks source link

208 structure info #209

Closed allemangD closed 2 years ago

allemangD commented 2 years ago

Adds structure to each control point in JSON output. This value is ignored during file loading, only used as metadata in consuming applications. Resolves #208. Note this change requires each Annotation instance hold a reference to the HomeLogic instance. Looking toward #196, it may make sense to introduce a "AtlasLogic" or similar which contains the volume node, color node, and related metadata for only one atlas. This metadata could then be serialized within Annotation.toDict.

Adds methods to HomeLogic

Updates getCrosshairPixelString and getPixelString to use them.

Those methods, along with these attributes, could probably go in an AtlasLogic class:

allemangD commented 2 years ago

Some sample JSON in the new format:

Note there's only one markup with three control points, and each point is in a different structure. Point 2 is outside the atlas, so its structure is null.

Such a case might not be "realistic" however it's important the file format is robust to such edge-cases.

{
  "version": "0.2.1+2022.03.04",
  "markups": [
    {
      "markup": {
        "type": "ClosedCurve",
        "coordinateSystem": "LPS",
        "controlPoints": [
          {
            "id": "1",
            "position": [
              -6897.8740234375,
              6575.0,
              -1308.8443603515625
            ],
            "orientation": [
              -1.0,
              -0.0,
              -0.0,
              -0.0,
              -1.0,
              -0.0,
              0.0,
              0.0,
              1.0
            ],
            "structure": {
              "id": 9,
              "acronym": "SSp-tr6a"
            }
          },
          {
            "id": "2",
            "position": [
              -5673.08349609375,
              6575.0,
              -607.249267578125
            ],
            "orientation": [
              -1.0,
              -0.0,
              -0.0,
              -0.0,
              -1.0,
              -0.0,
              0.0,
              0.0,
              1.0
            ],
            "structure": null
          },
          {
            "id": "3",
            "position": [
              -5143.537109375,
              6575.0,
              -2108.5126953125
            ],
            "orientation": [
              -1.0,
              -0.0,
              -0.0,
              -0.0,
              -1.0,
              -0.0,
              0.0,
              0.0,
              1.0
            ],
            "structure": {
              "id": 382,
              "acronym": "CA1"
            }
          }
        ]
      },
      "name": "Curve",
      "orientation": [
        1.0,
        0.0,
        0.0,
        5686.499999999999,
        0.0,
        0.0,
        1.0,
        -6574.999999999999,
        0.0,
        1.0,
        0.0,
        -3987.4999999999995,
        0.0,
        0.0,
        0.0,
        1.0
      ],
      "representationType": "spline",
      "thickness": 50
    }
  ],
  "currentId": 0,
  "referenceView": "Coronal",
  "ontology": "Structure",
  "stepSize": 24.999999999999996,
  "cameraPosition": [
    5873.272365267856,
    -50203.60366698136,
    -4026.6211672287745
  ],
  "cameraViewUp": [
    0.0,
    0.0,
    1.0
  ]
}
wbwakeman commented 2 years ago

This looks good to me. Thank you @allemangD !