ome / omero-scripts

Core OMERO Scripts
https://pypi.org/project/omero-scripts/
12 stars 32 forks source link

Avoid division by 0 in Plot Profile. (rebased onto develop) #90

Closed bpindelski closed 10 years ago

bpindelski commented 10 years ago

This is the same as gh-89 but rebased onto develop.


This PR fixes the situation in which a ZeroDivisionError is thrown when the ROI line is parallel to the X axis and hence the y1 and y2 values are equal, returning 0 in the subtraction.

The error returned was:

Traceback (most recent call last):
  File "./script", line 453, in <module>
    fileAnns, message = processImages(conn, scriptParams)
  File "./script", line 382, in processImages
    processLines(conn, scriptParams, image, lines, lineWidth, f)
  File "./script", line 264, in processLines
    lineWidth, theZ, theC, theT)
  File "./script", line 93, in getLineData
    rads = math.atan(float(lineX) / lineY)
ZeroDivisionError: float division

To test - check that the values returned from the script make sense. /cc @will-moore

bpindelski commented 10 years ago

--rebased-from #89

sbesson commented 10 years ago

Tested against trout.openmicroscopy.org with the scenario above. No error thrown. Merging.