Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Padding ---> Cropping: indices issue? #200

Closed
ntustison opened this issue Jul 24, 2020 · 2 comments
Closed

Padding ---> Cropping: indices issue? #200

ntustison opened this issue Jul 24, 2020 · 2 comments
Labels

Comments

@ntustison
Copy link
Member

Describe the bug

Cropping following padding throws an error: Requested region is (at least partially) outside the largest possible region.

To Reproduce

import ants
image = ants.image_read(ants.get_ants_data('r16'))
padded_image = ants.pad_image(image, shape=(300,300))
cropped_image = ants.crop_indices(padded_image, (0, 0), (300, 300))

# This is where the error is thrown.  Perhaps this is expected considering 
# a behind-the-scenes changing of the indices of the image.  The following
# two lines also throw the same error (just for completeness):

cropped_image = ants.crop_indices(padded_image*1, (0, 0), (300, 300))
cropped_image = ants.crop_indices(ants.image_clone(padded_image), (0, 0), (300, 300))

# However, if I do the following:

cropped_image = ants.crop_indices(ants.image_clone(padded_image)*1, (0, 0), (300, 300))

# the operation happens without issue.  I don't know if this is a bug, per se, 
# but it's quirky behavior.  Is this an issue of ANTsPy/ANTsR not keeping
# track of the image indices?
@stnava
Copy link
Member

stnava commented Jul 30, 2020

I think this is a bug - I also expect something related in the recent padding functions that were added - noting different behavior from R - should confirm/address this later.

@stnava stnava added the bug label Jul 30, 2020
@cookpa
Copy link
Member

cookpa commented May 14, 2024

This looks to be fixed now, possibly by #588

@cookpa cookpa closed this as completed May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants