yichechang / chromotion

1 stars 0 forks source link

masking is not robust #1

Open yichechang opened 6 months ago

yichechang commented 6 months ago

Masking is not robust and relies on some workarounds and/or assumptions now. This is due to the possibilities of:

  1. image data and mask might not have the same units for their common coordinate vars
  2. image data and/or mask might not even have coordinate vars for some of their shared dimensions.

https://github.com/yichechang/chromotion/blob/d7e091e74514170d11e6ba971a938782c75553e7/src/chromotion/pivop.py#L126-L131

https://github.com/yichechang/chromotion/blob/d7e091e74514170d11e6ba971a938782c75553e7/src/chromotion/imageop.py#L108-L122


Moving forward to bim-xarray's implementation is even more problematic as it requires coordinate vars to exist in both data and mask. But perhaps that's safer when it works.

yichechang commented 6 months ago

This is due to how bim-xarray is currently designed to remove coord vars if their real-world units (microns and seconds, for spatial and temporal, respectively) are not found in the ome-metadata. This is actually different from AICSImage's behavior...

See issue tracked in bim-xarray's repo: https://github.com/SoftLivingMatter/bim-xarray/issues/3#issuecomment-1873614475