Closed alessandrofelder closed 2 months ago
I tried it out myself today on najva4
and I agree there is a bug somewhere in the aligment process.
The bug manifests itself in two ways:
I suspect the bug was always there, but didn't manifest itself in the black cap data, because there the field-of-view was barely as large as the brain. The huge field-of-view we have here probably unmasked the problem.
BEFORE
AFTER
Alright, the first manifestation of the bug (estimated points being out of the mask), is no big mystery. My code just ensures that these points will be aligned with the mask's centroid along the symmetry axis (left-right axis). There is no guarantee that the 9 points will fall within the mask itself. That's because the code is written implicitly assuming that the brain will fill most of the field of view, which it clearly doesn't.
See the offending functions here.
I think we should change to actually using the mask's bounding box during point estimation, instead of the whole image.
Actually, the 9 points are within the mask in 2/3 axes. It's only along the y axis (axis=1) that they are out of bounds. I'll look into it.
Describe the bug Using the
napari
widget to alignnajva4
sample gives this screenshot after (what I think is a sensible choice of mid-plane points)The alignment seems to work well in the sense that the AP axis is as expected. But the centre is off?
To Reproduce Walk through the
napari
pre-processing widget with thenajva4
sample.Expected behaviour Sensible choice of mid-plane results in sensible-ish hemisphere.
Computer used (please complete the following information): Ubuntu 22 on Dell Desktop