diff options
author | Aaron LI <aly@aaronly.me> | 2017-10-23 21:59:06 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2017-10-23 22:00:24 +0800 |
commit | fd48971ee510687401f7e383af7b6bd3478db299 (patch) | |
tree | ceb83c85bb2a1b0e0da6d4fa7aa0a08b54587564 /fg21sim | |
parent | c1a561a8c05a7e59cdf3a34ac2112eed5ea7c406 (diff) | |
download | fg21sim-fd48971ee510687401f7e383af7b6bd3478db299.tar.bz2 |
utils/transform/circle2ellipse: skip rotation if it's None
Diffstat (limited to 'fg21sim')
-rw-r--r-- | fg21sim/utils/transform.py | 9 |
1 files 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 |