From 00a747eb121e0d307eb576d05952ef89cd45448b Mon Sep 17 00:00:00 2001
From: Arin Wongprommoon <arin.wongprommoon@ed.ac.uk>
Date: Tue, 17 Jan 2023 11:06:33 +0000
Subject: [PATCH] fix!(aliby): dimensions in tiler consistent with image

WHY IS THIS CHANGE NEEDED?:
- tiler dimensions are ctzyx, but image dimensions are tczyx by default.
  this leads to incorrect storage of shapes

HOW DOES THE CHANGE SOLVE THE PROBLEM?:
- re-arrange the dimensions in the shape property to match image
- justifying this for the purpose of getting ImageDummy to play well
  with Tiler

WHAT SIDE EFFECTS DOES THIS CHANGE HAVE?:
- this exposes technical debt: there are places in which the order of
  dimensions are hard-coded and later assumed like this, and leads to
  indexing dimensions by index rather than by name.  in addition, the
  assumed order of dimensions is inconsistent throughout tiler.  this is
  a recipe for confusion.  worth a refactor soon.
---
 src/aliby/tile/tiler.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/aliby/tile/tiler.py b/src/aliby/tile/tiler.py
index f1db705c..9de61621 100644
--- a/src/aliby/tile/tiler.py
+++ b/src/aliby/tile/tiler.py
@@ -358,7 +358,12 @@ class Tiler(StepABC):
             no of pixels in y direction
             no of pixels in z direction
         """
-        c, t, z, y, x = self.image.shape
+        # FIXME: TECHNICAL DEBT -- hard-coding dimension order.
+        # This is valid for dummy tiler and conforms to the default order
+        # in Image instances.  However, there is no guarantee that it will
+        # work with the other tiler instances.
+        # c, t, z, y, x = self.image.shape
+        t, c, z, y, x = self.image.shape
         return (c, t, x, y, z)
 
     @property
-- 
GitLab