pylinac
pylinac copied to clipboard
some bug in equate_images()??
Hi, I have used your gamma evaluation. During testing I regognised some behavior that I would interprete as a bug. if you would enter fthe function equate_images with the same file, you will get a ZeroDivisionError.
that snipset will fix that issue "quick an dirty"
'
physical_height_diff = image1.physical_shape[0] - image2.physical_shape[0]
if physical_height_diff < 0: # image2 is bigger
img = image2
elif physical_height_diff > 0:
img = image1
pixel_height_diff = abs(int(round(-physical_height_diff * img.dpmm / 2)))
img.remove_edges(pixel_height_diff, edges=('top', 'bottom'))
physical_width_diff = image1.physical_shape[1] - image2.physical_shape[1]
if physical_width_diff > 0:
img = image1
**elif physical_width_diff < 0:
img = image2
pixel_width_diff = abs(int(round(physical_width_diff*img.dpmm/2)))
img.remove_edges(pixel_width_diff, edges=('left', 'right'))`
best regards