Skip to content

Commit

Permalink
expand tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ncullen93 committed May 30, 2024
1 parent 58d29bf commit d631b01
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ants/ops/crop_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ def crop_indices(image, lowerind, upperind):
>>> decropped = ants.decrop_image( cropped, fi )
"""
if image.has_components:
return ants.merge_channels([crop_indices(img, lowerind, upperind) for img in ants.split_channels(image)])
return ants.merge_channels([crop_indices(img, lowerind, upperind) for img in ants.split_channels(image)],
channels_first=image.channels_first)

inpixeltype = 'float'
if image.pixeltype != 'float':
Expand Down
7 changes: 7 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,13 @@ def test_crop_indices_example(self):
cropped = ants.crop_indices(fi, (10, 10, 10), (100, 100))
cropped = ants.crop_indices(fi, (10, 10), (100, 100, 100))

# vector images
fi = ants.image_read( ants.get_ants_data("r16"))
cropped = ants.crop_indices( fi, (10,10), (100,100) )
fi2 = ants.merge_channels([fi,fi])
cropped2 = ants.crop_indices( fi, (10,10), (100,100) )
self.assertEqual(cropped.shape, cropped2.shape)

def test_decrop_image_example(self):
fi = ants.image_read(ants.get_ants_data("r16"))
mask = ants.get_mask(fi)
Expand Down

0 comments on commit d631b01

Please sign in to comment.