Skip to content

Commit

Permalink
Fixed files for pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
durm2107 committed Feb 11, 2021
1 parent 231a13a commit 53dbd94
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
13 changes: 7 additions & 6 deletions scilpy/image/operations.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-

"""
Utility operations provided for scil_image_math.py and scil_connectivity_math.py
Utility operations provided for scil_image_math.py
and scil_connectivity_math.py
They basically act as wrappers around numpy to avoid installing MRtrix/FSL
to apply simple operations on nibabel images or numpy arrays.
"""
Expand Down Expand Up @@ -511,23 +512,23 @@ def concatenate(input_list, ref_img):
concatenate: IMGs
Concatenate a list of 3D and 4D images into a single 4D image.
"""

_validate_imgs_concat(*input_list, ref_img)
if len(input_list[0].header.get_data_shape()) > 4:
raise ValueError('Concatenate require 3D or 4D arrays.')

input_data = []
for img in input_list:

data = img.get_fdata(dtype=np.float64)

if len(img.header.get_data_shape()) == 4:
data = np.rollaxis(data, 3)
for i in range(0, len(data)):
input_data.append(data[i])
else:
input_data.append(data)
input_data.append(data)

img.uncache()

return np.rollaxis(np.stack(input_data), axis=0, start=4)
Expand Down
5 changes: 3 additions & 2 deletions scripts/scil_image_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,14 @@ def main():
found_ref = True
break

# If there's a 4D image, replace the previous 3D image with this one for reference
# If there's a 4D image, replace the previous 3D image with
# this one for reference
for input_arg in args.in_images:
if not is_float(input_arg):
ref_img = nib.load(input_arg)
if len(ref_img.shape) == 4:
mask = np.zeros(ref_img.shape)
break
break

if not found_ref:
raise ValueError('Requires at least one nifti image.')
Expand Down

0 comments on commit 53dbd94

Please sign in to comment.