Skip to content

Commit

Permalink
Fix pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmaRenauld committed Feb 1, 2024
1 parent d3c27d2 commit af2e3de
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
26 changes: 11 additions & 15 deletions scripts_python/dwiml_compute_connectivity_matrix_from_blocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def _build_arg_parser():
p = argparse.ArgumentParser(
description=__doc__, formatter_class=argparse.RawTextHelpFormatter)
p.add_argument('in_volume',
help='Input nifti volume. Only used to get the shape of the '
'volume.')
help='Input nifti volume. Only used to get the shape of '
'the volume.')
p.add_argument('streamlines',
help='Tractogram (trk or tck).')
p.add_argument('out_file',
Expand Down Expand Up @@ -85,6 +85,15 @@ def main():
matrix, start_blocs, end_blocs = compute_triu_connectivity_from_blocs(
in_sft.streamlines, in_img.shape, args.connectivity_nb_blocs)

prepare_figure_connectivity(matrix)

if args.binary:
matrix = matrix > 0

# Save results.
np.save(args.out_file, matrix)
plt.savefig(out_fig)

# Options to try to investigate the connectivity matrix:
if args.save_biggest is not None:
i, j = np.unravel_index(np.argmax(matrix, axis=None), matrix.shape)
Expand All @@ -103,22 +112,9 @@ def main():
sft = in_sft.from_sft(biggest, in_sft)
save_tractogram(sft, args.save_smallest)

prepare_figure_connectivity(matrix)

if args.binary:
matrix = matrix > 0

# Save results.
np.save(args.out_file, matrix)

plt.savefig(out_fig)

if args.show_now:
plt.show()


if __name__ == '__main__':
main()



2 changes: 1 addition & 1 deletion scripts_python/dwiml_divide_volume_into_blocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def main():

assert_inputs_exist(parser, args.in_image)
assert_outputs_exist(parser, args, required=args.out_filename)

volume = nib.load(args.in_image)
final_volume = color_mri_connectivity_blocs([6, 6, 6], volume.shape)
img = nib.Nifti1Image(final_volume, volume.affine)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
# -*- coding: utf-8 -*-

def test_help_option(script_runner):
ret = script_runner.run('dwiml_compute_connectivity_matrix_from_labels.py', '--help')
ret = script_runner.run('dwiml_compute_connectivity_matrix_from_labels.py',
'--help')
assert ret.success

0 comments on commit af2e3de

Please sign in to comment.