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

Add Sciply version - part 3 #1135

Merged
merged 7 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
24 changes: 12 additions & 12 deletions scripts/scil_gradients_validate_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
optimal b-vectors on a single shell and then saves them as png. Use one or the
other, not both. For more options on visualization, please use
scil_viz_gradients_screenshot.py.
------------------------------------------------------------------------------
Reference:
[1] Emmanuel Caruyer, Christophe Lenglet, Guillermo Sapiro,
Rachid Deriche. Design of multishell gradient sampling with uniform coverage
in diffusion MRI. Magnetic Resonance in Medicine, Wiley, 2013, 69 (6),
pp. 1534-1540. <http://dx.doi.org/10.1002/mrm.24736>
------------------------------------------------------------------------------
"""

import argparse
Expand All @@ -45,21 +52,14 @@
from scilpy.gradients.gen_gradient_sampling import (generate_gradient_sampling,
energy_comparison)
from scilpy.viz.gradients import (plot_proj_shell, build_ms_from_shell_idx)


EPILOG = """
References: [1] Emmanuel Caruyer, Christophe Lenglet, Guillermo Sapiro,
Rachid Deriche. Design of multishell gradient sampling with uniform coverage
in diffusion MRI. Magnetic Resonance in Medicine, Wiley, 2013, 69 (6),
pp. 1534-1540. <http://dx.doi.org/10.1002/mrm.24736>
"""
from scilpy.version import version_string


def _build_arg_parser():
p = argparse.ArgumentParser(
formatter_class=argparse.RawTextHelpFormatter,
description=__doc__,
epilog=EPILOG)
p = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawTextHelpFormatter,
epilog=version_string)

p.add_argument('in_gradients', nargs='+',
help='Path(s) to the gradient file(s). Either FSL '
'(.bval, .bvec) or MRtrix (.b).')
Expand Down
5 changes: 4 additions & 1 deletion scripts/scil_plot_stats_per_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@
assert_output_dirs_exist_and_empty,
add_verbose_arg)
from scilpy.viz.plot import plot_metrics_stats
from scilpy.version import version_string


def _build_arg_parser():
p = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawTextHelpFormatter)
formatter_class=argparse.RawTextHelpFormatter,
epilog=version_string)

p.add_argument('in_json',
help='JSON file containing the mean/std per point. For '
'example, can be created using '
Expand Down
7 changes: 5 additions & 2 deletions scripts/scil_qball_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,17 @@
assert_inputs_exist, assert_outputs_exist,
parse_sh_basis_arg, validate_nbr_processes,
assert_headers_compatible)
from scilpy.version import version_string


DEFAULT_SMOOTH = 0.006


def _build_arg_parser():
p = argparse.ArgumentParser(
description=__doc__, formatter_class=argparse.RawTextHelpFormatter)
p = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawTextHelpFormatter,
epilog=version_string)

p.add_argument('in_dwi',
help='Path of the input diffusion volume.')
p.add_argument('in_bval',
Expand Down
7 changes: 4 additions & 3 deletions scripts/scil_rgb_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@

from scilpy.io.utils import (add_overwrite_arg, assert_inputs_exist,
assert_outputs_exist, add_verbose_arg)
from scilpy.version import version_string


def _build_arg_parser():
p = argparse.ArgumentParser(
formatter_class=argparse.RawTextHelpFormatter,
description=__doc__)
p = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawTextHelpFormatter,
epilog=version_string)

p.add_argument('in_image',
help='name of input RGB image.\n' +
Expand Down
4 changes: 3 additions & 1 deletion scripts/scil_search_keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@
)
from scilpy.utils.scilpy_bot import SPACING_LEN, VOCAB_FILE_PATH
from scilpy.io.utils import add_verbose_arg
from scilpy.version import version_string


def _build_arg_parser():
p = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawTextHelpFormatter)
formatter_class=argparse.RawTextHelpFormatter,
epilog=version_string)

p.add_argument('expressions', nargs='+',
help='Search the provided list of expressions.\n'
Expand Down
6 changes: 4 additions & 2 deletions scripts/scil_sh_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@
add_processes_arg, add_verbose_arg,
assert_inputs_exist, assert_outputs_exist,
parse_sh_basis_arg)
from scilpy.version import version_string


def _build_arg_parser():
p = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter,
description=__doc__)
p = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawTextHelpFormatter,
epilog=version_string)

p.add_argument('in_sh',
help='Input SH filename. (nii or nii.gz)')
Expand Down
32 changes: 16 additions & 16 deletions scripts/scil_sh_fusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@
Based on [1] and [2].

Formerly: scil_merge_sh.py
---------------------------------------------------------------------------------
References:
[1] Garyfallidis, E., Zucchelli, M., Houde, J-C., Descoteaux, M.
How to perform best ODF reconstruction from the Human Connectome
Project sampling scheme?
ISMRM 2014.

[2] Khachaturian, M. H., Wisco, J. J., & Tuch, D. S. (2007). Boosting the
sampling efficiency of q‐ball imaging using multiple wavevector fusion.
Magnetic Resonance in Medicine: An Official Journal of the International
Society for Magnetic Resonance in Medicine, 57(2), 289-296.
---------------------------------------------------------------------------------
"""

import argparse
Expand All @@ -23,25 +35,13 @@
from scilpy.io.image import assert_same_resolution
from scilpy.io.utils import (add_overwrite_arg, assert_inputs_exist,
assert_outputs_exist, add_verbose_arg)


EPILOG = """
Reference:
[1] Garyfallidis, E., Zucchelli, M., Houde, J-C., Descoteaux, M.
How to perform best ODF reconstruction from the Human Connectome
Project sampling scheme?
ISMRM 2014.

[2] Khachaturian, M. H., Wisco, J. J., & Tuch, D. S. (2007). Boosting the
sampling efficiency of q‐ball imaging using multiple wavevector fusion.
Magnetic Resonance in Medicine: An Official Journal of the International
Society for Magnetic Resonance in Medicine, 57(2), 289-296.
"""
from scilpy.version import version_string


def _build_arg_parser():
p = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter,
description=__doc__, epilog=EPILOG)
p = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawTextHelpFormatter,
epilog=version_string)

p.add_argument('in_shs', nargs="+",
help='List of SH files.')
Expand Down
28 changes: 15 additions & 13 deletions scripts/scil_sh_to_aodf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@
Make sure you have pyopencl installed before using this option. By default, the
OpenCL program will run on the cpu. To use a gpu instead, also specify the
option --device gpu.
----------------------------------------------------------------------------------
References:
[1] Poirier and Descoteaux, 2024, "A Unified Filtering Method for Estimating
Asymmetric Orientation Distribution Functions", Neuroimage, vol. 287,
https://doi.org/10.1016/j.neuroimage.2024.120516

[2] Poirier et al, 2021, "Investigating the Occurrence of Asymmetric Patterns
in White Matter Fiber Orientation Distribution Functions", ISMRM 2021
(abstract 0865)
---------------------------------------------------------------------------------
"""

import argparse
Expand All @@ -28,22 +38,14 @@
assert_inputs_exist, add_sh_basis_args,
assert_outputs_exist, parse_sh_basis_arg)
from scilpy.denoise.asym_filtering import (cosine_filtering, unified_filtering)


EPILOG = """
[1] Poirier and Descoteaux, 2024, "A Unified Filtering Method for Estimating
Asymmetric Orientation Distribution Functions", Neuroimage, vol. 287,
https://doi.org/10.1016/j.neuroimage.2024.120516

[2] Poirier et al, 2021, "Investigating the Occurrence of Asymmetric Patterns
in White Matter Fiber Orientation Distribution Functions", ISMRM 2021
(abstract 0865)
"""
from scilpy.version import version_string


def _build_arg_parser():
p = argparse.ArgumentParser(description=__doc__, epilog=EPILOG,
formatter_class=argparse.RawTextHelpFormatter)
p = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawTextHelpFormatter,
epilog=version_string)

p.add_argument('in_sh',
help='Path to the input file.')

Expand Down
17 changes: 11 additions & 6 deletions scripts/scil_sh_to_rish.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@

Each RISH feature will be saved as a separate file.

[1] Mirzaalian, Hengameh, et al. "Harmonizing diffusion MRI data across
multiple sites and scanners." MICCAI 2015.
https://scholar.harvard.edu/files/hengameh/files/miccai2015.pdf

Formerly: scil_compute_rish_from_sh.py
-----------------------------------------------------------------------
Reference:
[1] Mirzaalian, Hengameh, et al. "Harmonizing diffusion MRI data across
multiple sites and scanners." MICCAI 2015.
https://scholar.harvard.edu/files/hengameh/files/miccai2015.pdf
-----------------------------------------------------------------------
"""
import argparse
import logging
Expand All @@ -31,11 +33,14 @@
assert_outputs_exist, add_verbose_arg,
assert_headers_compatible)
from scilpy.reconst.sh import compute_rish
from scilpy.version import version_string


def _build_arg_parser():
p = argparse.ArgumentParser(
description=__doc__, formatter_class=argparse.RawTextHelpFormatter)
p = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawTextHelpFormatter,
epilog=version_string)

p.add_argument('in_sh',
help='Path of the sh image. They can be formatted in any '
'sh basis, but we \nexpect it to be a symmetrical '
Expand Down
7 changes: 5 additions & 2 deletions scripts/scil_sh_to_sf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@
assert_inputs_exist, assert_outputs_exist,
parse_sh_basis_arg, validate_nbr_processes)
from scilpy.reconst.sh import convert_sh_to_sf
from scilpy.version import version_string


def _build_arg_parser():
p = argparse.ArgumentParser(
description=__doc__, formatter_class=argparse.RawTextHelpFormatter)
p = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawTextHelpFormatter,
epilog=version_string)

p.add_argument('in_sh',
help='Path of the SH volume.')
p.add_argument('out_sf',
Expand Down
7 changes: 4 additions & 3 deletions scripts/scil_stats_group_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,13 @@
get_group_data_sample,
visualise_distribution,
write_current_dictionnary)
from scilpy.version import version_string


def _build_arg_parser():

p = argparse.ArgumentParser(
description=__doc__, formatter_class=argparse.RawTextHelpFormatter)
p = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawTextHelpFormatter,
epilog=version_string)

p.add_argument('in_json', metavar='IN_JSON',
help='Input JSON file from tractometry nextflow pipeline'
Expand Down
18 changes: 9 additions & 9 deletions scripts/scil_surface_apply_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
(aligned over the b0 in MI-Brain).

Formerly: scil_apply_transform_to_surface.py.
-------------------------------------------------------------------
Reference:
[1] St-Onge, E., Daducci, A., Girard, G. and Descoteaux, M. 2018.
Surface-enhanced tractography (SET). NeuroImage.
-------------------------------------------------------------------
"""

import argparse
Expand All @@ -33,18 +38,13 @@
assert_outputs_exist,
load_matrix_in_any_format)
from scilpy.surfaces.surface_operations import apply_transform


EPILOG = """
References:
[1] St-Onge, E., Daducci, A., Girard, G. and Descoteaux, M. 2018.
Surface-enhanced tractography (SET). NeuroImage.
"""
from scilpy.version import version_string


def _build_arg_parser():
p = argparse.ArgumentParser(description=__doc__, epilog=EPILOG,
formatter_class=argparse.RawTextHelpFormatter)
p = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawTextHelpFormatter,
epilog=version_string)

p.add_argument('in_moving_surface',
help='Input surface (.vtk).')
Expand Down
17 changes: 9 additions & 8 deletions scripts/scil_surface_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
> scil_surface_convert.py surf.vtk converted_surf.ply

Formerly: scil_convert_surface.py
-----------------------------------------------------------------
Reference:
[1] St-Onge, E., Daducci, A., Girard, G. and Descoteaux, M. 2018.
Surface-enhanced tractography (SET). NeuroImage.
-----------------------------------------------------------------
"""
import argparse
import logging
Expand All @@ -26,17 +31,13 @@
add_verbose_arg,
assert_inputs_exist,
assert_outputs_exist)

EPILOG = """
References:
[1] St-Onge, E., Daducci, A., Girard, G. and Descoteaux, M. 2018.
Surface-enhanced tractography (SET). NeuroImage.
"""
from scilpy.version import version_string


def _build_arg_parser():
p = argparse.ArgumentParser(description=__doc__, epilog=EPILOG,
formatter_class=argparse.RawTextHelpFormatter)
p = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawTextHelpFormatter,
epilog=version_string)

p.add_argument('in_surface',
help='Input a surface (FreeSurfer or supported by VTK).')
Expand Down
17 changes: 9 additions & 8 deletions scripts/scil_surface_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
scil_surface_create.py out_surface.vtk \\
--in_labels s1a1/mask/S1-A1_wmparc.a2009s.nii.gz\\
--list_indices 16:32 --opening 2 --smooth 2 -v
-----------------------------------------------------------------
Reference:
[1] St-Onge, E., Daducci, A., Girard, G. and Descoteaux, M. 2018.
Surface-enhanced tractography (SET). NeuroImage.
-----------------------------------------------------------------
"""

import argparse
Expand All @@ -35,17 +40,13 @@
assert_inputs_exist,
assert_outputs_exist,
ranged_type)

EPILOG = """
References:
[1] St-Onge, E., Daducci, A., Girard, G. and Descoteaux, M. 2018.
Surface-enhanced tractography (SET). NeuroImage.
"""
from scilpy.version import version_string


def _build_arg_parser():
p = argparse.ArgumentParser(description=__doc__, epilog=EPILOG,
formatter_class=argparse.RawTextHelpFormatter)
p = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawTextHelpFormatter,
epilog=version_string)

g1 = p.add_argument_group("Input (Labels or Mask)")
mxg = g1.add_mutually_exclusive_group(required=True)
Expand Down
Loading