clio-janelia / clio-store

A serverless Connectomics Storage API based on Google Firestore and other scalable services.
0 stars 0 forks source link

Provide all neuroglancer viewer and layer settings #3

Closed stuarteberg closed 3 years ago

stuarteberg commented 3 years ago

Right now, each dataset only specifies the location** for each layer, but not the other settings for the layer, such as opacity and other rendering settings. We should store default values for those settings, so the default view of each dataset can be customized.

Here's an example of neuroglancer layer setting, taken from this link.

    {
      "type": "image",
      "source": "n5://https://janelia-cosem.s3.amazonaws.com/jrc_mus-pancreas-1/jrc_mus-pancreas-1.n5/em/fibsem-uint16",
      "opacity": 1,
      "blend": "additive",
      "shader": "#uicontrol invlerp normalized(range=[7077.78, 13041.465], window=[0, 24968.835])\n        #uicontrol int invertColormap slider(min=0, max=1, step=1, default=1)\n        #uicontrol vec3 color color(default=\"white\") \n        float inverter(float val, int invert) {return 0.5 + ((2.0 * (-float(invert) + 0.5)) * (val - 0.5));}\n          void main() {\n          emitRGB(color * inverter(normalized(), invertColormap));\n        }",
      "name": "fibsem-uint16"
    }

In addition to per-layer settings, the neuroglancer settings also include global viewer settings, such as the zoom level. We should somehow convey those defaults to the clio front-end, too.


** BTW, neuroglancer doesn't call this the location, neuroglancer calls it the source. Why do we use a different spelling?

DocSavage commented 3 years ago

@stuarteberg The location field is legacy from how Clio originally handled datasets. I could change it to source but the clients would have to change as well. If we do that, we might as well also make the grayscale image settings (currently top-level fields location and description) just another entry in the layers array. We'd especially want to add those new fields to the grayscale as well.

stuarteberg commented 3 years ago

I think I agree -- it does seem logical to have some portion of the layers array simply correspond exactly to the contents in the neuroglancer layers settings. We'll want to just copy/paste when we populate that configuration. It's a little weird because we want to add our own stuff, like roles, which will have to reside outside of those settings. But that seems doable.

DocSavage commented 3 years ago

To prevent breaking clients for now, I'll keep the top-level location for the grayscale image but start duplicating it as another layer of type image. Hopefully that will not break the clio-ui, correct @tingzhao?