Skip to content

Conversation

@madil90
Copy link
Contributor

@madil90 madil90 commented Mar 3, 2020

Fixes #107 .

Description

Adds the zoom transform

Status

Work in progress

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or new feature that would cause existing functionality to change)
  • New tests added to cover the changes
  • Docstrings/Documentation updated

@madil90 madil90 requested review from Nic-Ma, ericspod and wyli March 3, 2020 18:49
from cupyx.scipy.ndimage import zoom as zoom_gpu
zoomed = cupy.asnumpy(zoom_gpu(cupy.array(data), zoom=zoom, order=interpolation))
except Exception:
print('Warning: Zoom gpu failed. Defaulting to cpu.')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defaulting to cpu if gpu not found. Is this expected behavior?

# pad_vec[d] = [0, shape[d] - zoomed.shape[d]]
pad_h = (float(shape[d]) - float(zoomed.shape[d]))/2
pad_vec[d] = [int(np.floor(pad_h)), int(np.ceil(pad_h))]
zoomed = zoomed[0:crop_vec[0], 0:crop_vec[1], 0:crop_vec[2]]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To handle both 2d and 3d i need to way to write this sentence if crop_vec is of size 3 or 4. @wyli @Nic-Ma do you know how to do this?

@madil90 madil90 closed this Mar 3, 2020
@madil90 madil90 deleted the 107-resize branch March 3, 2020 22:34
wyli pushed a commit that referenced this pull request Sep 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port spatial zoom transform

2 participants