Skip to content

Commit

Permalink
Correcting a bug related to the shape for 3D volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasser Alemán Gómez committed Nov 14, 2024
1 parent b958493 commit ad354ae
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions clabtoolkit/imagetools.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ def cropped_to_native(in_image: str, native_image: str, out_image: str):

# Get data from IM2
img2_data = img2.get_fdata()
img2_shape = img2_data.shape

# If the img2 is a 4D add the forth dimension to the shape of the img1
if len(img2_shape) == 4:
img1_shape = (img1_shape[0], img1_shape[1], img1_shape[2], img2_shape[3])

# Create an empty array with the same dimensions as IM1
new_data = np.zeros(img1_shape)
Expand Down

0 comments on commit ad354ae

Please sign in to comment.