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

Once conversion to .zarr is done, we could check time dimension's match to `frame_name` in config #220

Open vreuter opened 5 months ago

vreuter commented 5 months ago

The list that's the value of frame_name in the config file represents names to assign to each of the timepoints in the sequential imaging. Using a name of the probe used for hybridisation during that timepoint is common. Because of this meaning, the length o the frame_name list should match the size of the time dimension for each FOV (often the first value of a 5-array), stored under "shape" of the .zarray file for each FOV.

vreuter commented 5 months ago

Example file:

P0001.zarr/0/.zarray
{
    "chunks": [
        1,
        1,
        1,
        2044,
        2048
    ],
    "compressor": {
        "blocksize": 0,
        "clevel": 5,
        "cname": "zstd",
        "id": "blosc",
        "shuffle": 2
    },
    "dimension_separator": "/",
    "dtype": "<u2",
    "fill_value": 0,
    "filters": null,
    "order": "C",
    "shape": [
        61,
        2,
        38,
        2044,
        2048
    ],
    "zarr_format": 2
}
vreuter commented 5 months ago

Here's an example of the sort of traceback that should arise in bead ROI generation if there's a mismatch between number of values in the frame_name list, and the size of the time dimension in the actual image data:

  File "/looptrace/bin/cli/run_bead_roi_generation.py", line 39, in get_image_stack
    return D.get_moving_image(pos_idx=pos_idx, frame_idx=frame_idx)
  File "/opt/conda/lib/python3.10/site-packages/looptrace/Drifter.py", line 507, in get_moving_image
    return np.array(self.images_moving[pos_idx][frame_idx, self.moving_channel])
  File "/opt/conda/lib/python3.10/site-packages/dask/array/core.py", line 1979, in __getitem__
    index2 = normalize_index(index, self.shape)
  File "/opt/conda/lib/python3.10/site-packages/dask/array/slicing.py", line 919, in normalize_index
    check_index(axis, i, d)
  File "/opt/conda/lib/python3.10/site-packages/dask/array/slicing.py", line 991, in check_index
    raise IndexError(
IndexError: Index 61 is out of bounds for axis 0 with size 61
vreuter commented 5 months ago

Consider possible modifications to frame names section in #215

vreuter commented 3 months ago

Consider possible modifications to frame names section in #215

This would now need to be handled by referencing the imagingRounds in the imaging rounds configuration file.