From fd48971ee510687401f7e383af7b6bd3478db299 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Mon, 23 Oct 2017 21:59:06 +0800 Subject: utils/transform/circle2ellipse: skip rotation if it's None --- fg21sim/utils/transform.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fg21sim/utils/transform.py b/fg21sim/utils/transform.py index c897f70..66f0d29 100644 --- a/fg21sim/utils/transform.py +++ b/fg21sim/utils/transform.py @@ -144,7 +144,7 @@ def rotate_center(imgin, angle, interp=True, reshape=True, fill_value=0.0): return imgout -def circle2ellipse(imgcirc, bfraction, rotation=0.0): +def circle2ellipse(imgcirc, bfraction, rotation=None): """ Shrink the input circle image with respect to the center along the column (axis) to transform the circle to an ellipse, and then rotate @@ -160,7 +160,8 @@ def circle2ellipse(imgcirc, bfraction, rotation=0.0): shrunk size (height) of the output image. Should be a fraction within [0, 1] rotation : float, optional - Rotation angle (unit: [ degree ]) + Rotation angle (unit: [deg]) + Default: ``None`` (i.e., no rotation) Returns ------- @@ -179,6 +180,6 @@ def circle2ellipse(imgcirc, bfraction, rotation=0.0): imgout = np.zeros(shape=(nrow, ncol)) r1 = int((nrow - nrow2) / 2) imgout[r1:(r1+nrow2), :] = img2 - # Rotate the ellipse - imgout = ndimage.rotate(imgout, angle=rotation, reshape=False, order=1) + if rotation: + imgout = ndimage.rotate(imgout, angle=rotation, reshape=False, order=1) return imgout -- cgit v1.2.2