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

Repair 3dQwarp workflow #454

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
manually undo accidental linting
psadil committed Oct 16, 2024

Verified

This commit was signed with the committer’s verified signature.
psadil Patrick Sadil
commit 923ab4a091e1f91c177c5f589f69bf080ed0ef40
10 changes: 3 additions & 7 deletions sdcflows/utils/epimanip.py
Original file line number Diff line number Diff line change
@@ -194,7 +194,7 @@ def get_trt(in_meta, in_file=None):

# npe = N voxels PE direction
pe_index = "ijk".index(in_meta["PhaseEncodingDirection"][0])
npe = nb.loadsave.load(in_file).shape[pe_index]
npe = nb.load(in_file).shape[pe_index]

# Use case 2: EES is defined
ees = in_meta.get("EffectiveEchoSpacing")
@@ -255,9 +255,7 @@ def epi_mask(in_file, out_file=None):
maxnorm = np.percentile(closed[closed > 0], 90)
closed = np.clip(closed, a_min=0.0, a_max=maxnorm)
# Calculate index of center of masses
cm = tuple(
np.round(ndimage.measurements.center_of_mass(closed)).astype(int)
)
cm = tuple(np.round(ndimage.measurements.center_of_mass(closed)).astype(int))
# Erode the picture of the brain by a lot
eroded = ndimage.grey_erosion(closed, structure=ball(5))
# Calculate the residual
@@ -273,8 +271,6 @@ def epi_mask(in_file, out_file=None):
hdr = img.header.copy()
hdr.set_data_dtype("uint8")
nb.Nifti1Image(
ndimage.binary_dilation(labels == 2, ball(2)).astype("uint8"),
img.affine,
hdr,
ndimage.binary_dilation(labels == 2, ball(2)).astype("uint8"), img.affine, hdr
).to_filename(out_file)
return out_file