gerlichlab / looptrace

Fork (from EMBL Gitlab) of the looptrace project: https://git.embl.de/grp-ellenberg/looptrace
MIT License
2 stars 1 forks source link

Pixel-to-nanometer conversion is derivable from .zarr metadata, no need to specify in config file #126

Open vreuter opened 10 months ago

vreuter commented 10 months ago

If it's specified, we should at least validate the specification against what we can glean from the .zarr metadata; otherwise, we can just infer this from the metadata. In particular, we can use voxel_size, axes, and unit together. Here's an example of the metadata:

$ cat .zattrs
{
    "metadata": {
        "channel_0": {
            "emissionLambdaNm": 700.5,
            "excitationLambdaNm": null,
            "name": "Far Red"
        },
        "channel_1": {
            "emissionLambdaNm": 630.0,
            "excitationLambdaNm": 561.0,
            "name": "Red"
        },
        "microscope": {
            "immersionRefractiveIndex": 1.515,
            "modalityFlags": [
                "fluorescence",
                "camera"
            ],
            "objectiveMagnification": 60.0,
            "objectiveName": 60.0,
            "objectiveNumericalAperture": 1.4,
            "zoomMagnification": 1.0
        },
        "voxel_size": [
            0.3,
            0.107325563330673,
            0.107325563330673
        ]
    },
    "multiscales": [
        {
            "axes": [
                {
                    "name": "t",
                    "type": "time",
                    "unit": "minute"
                },
                {
                    "name": "c",
                    "type": "channel"
                },
                {
                    "name": "z",
                    "type": "space",
                    "unit": "micrometer"
                },
                {
                    "name": "y",
                    "type": "space",
                    "unit": "micrometer"
                },
                {
                    "name": "x",
                    "type": "space",
                    "unit": "micrometer"
                }
            ],
            "datasets": [
                {
                    "coordinateTransformations": [
                        {
                            "scale": [
                                1.0,
                                1.0,
                                0.3,
                                0.107325563330673,
                                0.107325563330673
                            ],
                            "type": "scale"
                        }
                    ],
                    "path": "0"
                }
            ],
            "name": "seq_images_raw_zarr_P0002.zarr",
            "version": "0.4"
        }
    ]
vreuter commented 10 months ago

Look at mapping the unit name to a type and pairing with something like use of the squants library.