pirt icon indicating copy to clipboard operation
pirt copied to clipboard

Registration examples failing

Open kushaangupta opened this issue 1 year ago • 1 comments

I'm unable to successfully run the examples of registration (pairwise and groupwise). The code seem to ask for a sampling attribute from numpy.ndarray which doesn't exist.

https://github.com/almarklein/pirt/blob/1647f8fd94aaf20350c972e0c405338ee841f8bf/pirt/reg/reg_gravity.py#L146

Due to the same issue the groupwise example seem to fail here. FieldDescription is automatically creating inconsistent sampling values that lead to error

https://github.com/almarklein/pirt/blob/1647f8fd94aaf20350c972e0c405338ee841f8bf/pirt/deform/_deformfield.py#L137

The only cheap hack I could come up with was to comment these lines, but I was wondering if there's a better fix

kushaangupta avatar Feb 07 '25 03:02 kushaangupta

It's been a while since I looked at this code. Pirt implements and uses the Aarray class, which is a ndarray subclass that also contains samping info, so it can deal correctly with anisotropic data.

I suspect that some function in numpy or skimage changed a bit, so they now return a plain numpy array instead of anAarray, which means the sampling attribute is lost. E.g. I found that in _create_mass() in reg_gravity.py the return mass should now be return Aarray(mass, im.sampling).

However, this raises another error about a sampling mismatch, so it needs a closer examination to fix this. I don't have the time to look into it closer at the moment, but feel free to have a look yourself.

almarklein avatar Feb 07 '25 09:02 almarklein