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

Update script scil_viz_gradients_screenshot #1097

Merged
merged 3 commits into from
Dec 18, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions scripts/scil_viz_gradients_screenshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import os

from dipy.data import get_sphere
from dipy.io.gradients import read_bvals_bvecs

from scilpy.gradients.bvec_bval_tools import identify_shells
from scilpy.io.utils import (add_overwrite_arg,
Expand Down Expand Up @@ -88,7 +89,7 @@ def main():

if len(args.in_gradient_scheme) == 2:
assert_gradients_filenames_valid(parser, args.in_gradient_scheme,
'fsl')
True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please put input_is_fsl=True, instead of only True?

elif len(args.in_gradient_scheme) == 1:
basename, ext = os.path.splitext(args.in_gradient_scheme[0])
if ext in ['.bvec', '.bvecs', '.bvals', '.bval']:
Expand All @@ -97,7 +98,7 @@ def main():
else:
assert_gradients_filenames_valid(parser,
args.in_gradient_scheme,
'mrtrix')
False)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

else:
parser.error('Depending on the gradient format you should have '
'two files for FSL format and one file for MRtrix')
Expand All @@ -120,11 +121,8 @@ def main():
if len(args.in_gradient_scheme) == 2:
in_gradient_schemes = args.in_gradient_scheme
in_gradient_schemes.sort() # [bval, bvec]
# bvecs/bvals (FSL) format, X Y Z AND b (or transpose)
points = np.genfromtxt(in_gradient_schemes[1])
if points.shape[0] == 3:
points = points.T
bvals = np.genfromtxt(in_gradient_schemes[0])
bvals, points = read_bvals_bvecs(in_gradient_schemes[0],
in_gradient_schemes[1])
centroids, shell_idx = identify_shells(bvals)
else:
# MRtrix format X, Y, Z, b
Expand Down
Loading