Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

208 structure info #209

Merged
merged 3 commits into from
Mar 7, 2022
Merged

208 structure info #209

merged 3 commits into from
Mar 7, 2022

Conversation

allemangD
Copy link
Collaborator

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

  • getWorldRASToIJKTransform
  • getAllenLabelIndex
  • getAnnotation

Updates getCrosshairPixelString and getPixelString to use them.

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

  • AllenStructurePaths
  • AllenLayerStructurePaths
  • AllenStructureNames
  • SlicerToAllenMapping
  • AllenToSlicerMapping

Adds methods to HomeLogic

- `getWorldRASToIJKTransform`
- `getAllenLabelIndex`
- `getAnnotation`

Updates `getCrosshairPixelString` and `getPixelString` to use them.
Adds `structure` to each control point in JSON output. This value is ignored during file loading, only used as metadata in consuming applications. See #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`.
@allemangD
Copy link
Collaborator Author

allemangD commented Mar 4, 2022

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
Copy link

This looks good to me. Thank you @allemangD !

@allemangD allemangD merged commit 26b770a into master Mar 7, 2022
@jcfr jcfr deleted the 208-structure-info branch May 27, 2022 20:07
jcfr added a commit to jcfr/cell-locator that referenced this pull request Jul 22, 2022
This commit explicitly list version introduced in 6ca9f71 (ENH: Add structure
ID to JSON format) and 5cedbdf (ENH: Support structure ID in file format
converter. ) through PR BICCN#209
jcfr added a commit that referenced this pull request Jul 25, 2022
This commit explicitly list version introduced in 6ca9f71 (ENH: Add structure
ID to JSON format) and 5cedbdf (ENH: Support structure ID in file format
converter. ) through PR #209
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add structure id and acronym to JSON
2 participants