Skip to content

NotesJune2022

John Bogovic edited this page Jun 7, 2022 · 9 revisions

Notes for an in-person discussion at the Janelia Cell Map hackathon June 2022

Color channels

Suppose we have an array 3 x N x M that should be interpreted as an N x M RGB image.

Example RGB image metadata
{
  "spaces" : [
      {
        "name" : "rgb",
        "axes" : [
          { "name" : "c", "type" : "channel", "discrete" : true },
          { "name" : "x", "type" : "space", "unit" : "micrometers" },
          { "name" : "y", "type" : "space", "unit" : "micrometers" }
        ]
      }
  ],
  "coordinateTransformations" : [
    { "type" : "scale", "scale" : [1, 0.1, 0.1], "output" : "rgb" }
  ]
}

where the coordinate transform maps from array indexes to physical space. In this example, the pixel spacing is 0.1 micrometers in both x and y.

If channels need to be re-ordered create a new space, and make a transformation from the original to the new space.

like this
{
  "spaces" : [
      {
        "name" : "rgb",
        "axes" : [
          { "name" : "c", "type" : "channel", "discrete" : true },
          { "name" : "x", "type" : "space", "unit" : "micrometers" },
          { "name" : "y", "type" : "space", "unit" : "micrometers" }
        ]
      },
      {
        "name" : "gbr",
        "axes" : [
          { "name" : "c", "type" : "channel", "discrete" : true },
          { "name" : "x", "type" : "space", "unit" : "micrometers" },
          { "name" : "y", "type" : "space", "unit" : "micrometers" }
        ]
      }
  ],
  "coordinateTransformations" : [
    
    { 
      "type" : "dimensionWise",
      "transformations" : [ { "type" : "coordinates", "coordinates" : [2, 0, 1] }, "input" : ["c"], "output" : ["c"] 
                { "type" : "scale", "scale" : [0.1, 0.1], "input" : ["x","y"], "output" : ["x","y"] },],
      "input" : "rgb",
      "output" : "gbr"
    }
  ]
}

where the coordinate transform maps from array indexes to physical space. In this example, the pixel spacing is 0.1 micrometers in both x and y.

Need for inverseOf

  • Some transformations are not closed-form invertible
  • Transformations applied to images need to be "inverse" transformations

inverseOf indicates to implementations that this is the situation.

for example
{
  "type" : "inverseOf",
  "transform" : { "type" : "displacementField", "path" : "/dfield" },
  "input" : "src",
  "output" : "tgt"
}

indicates that the displacement field moves points from "tgt" to "src" space and therefore may be used to transform images from "src" to "tgt" space

The alternative

Don't wrap in an inverseOf, but flip the input and output space names. Implementations need to find "inverse" transformations when applying transformations to images.

like this
{
  "type" : "displacementField",
  "path" : "/dfield",
  "input" : "tgt",
  "output" : "src"
}