Closed LuisOlivaresJ closed 1 year ago
I have added a proposition inside commit #445.
Thanks for the find and the fix. It also appears that the crop method needs to be updated. E.g. doing img.crop(pixels=0, ...)
will set the array shape to 0 which is unintended behavior.
I will change this line to be <= 0
:
Thanks. This issue could be closed if you want.
Closing. Thanks for the contribution.
I am using pylinac 3.11.0
Describe the bug I have a bug (ZeroDivisionError) when I use
equate_images
for two images that actually have the same physical size but different resolution.To Reproduce
Expected behavior I2.shape to be (20,20)
Additional context The problem begins with the
crop
method. https://github.com/jrkerns/pylinac/blob/73ffc6229e785799c86e751ff0b7397c88a5ce5a/pylinac/core/image.py#L102 It is called even ifpixel_height_diff == 0
. In other words, when crop is called with the parameter pixels = 0, the method gives unwanted results.Proposed solution
Crop
method should be called only whenpixel_width_diff > 0
I'll make a pull request for this.