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

Python CLI changes #2678

Merged
merged 84 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
cd8bbfb
Created custom callables for different datatypes on cmd
ankitasanil Feb 6, 2023
075db52
Used callable types in commands - mrtrix_cleanup and dwicat
ankitasanil Feb 6, 2023
8d91a38
Changes done as instructed in the review
ankitasanil Feb 7, 2023
ebd36cf
Used callable types in few more commands
ankitasanil Feb 7, 2023
2988229
Python API: Integrate argument types across commands
Lestropie Feb 7, 2023
481462f
Changed the syntax as per https://github.com/ankitasanil/mrtrix3/pull…
ankitasanil Feb 7, 2023
54bca48
Python API: Used Python list comprehension as per https://github.com/…
ankitasanil Feb 7, 2023
cd33930
population_template: Refine cmdline interface
Lestropie Feb 7, 2023
9f3d624
Change interfaces for robust linear registration estimators
Lestropie Feb 10, 2023
51ccc67
Python API: Updated class names as per https://github.com/ankitasanil…
ankitasanil Feb 13, 2023
47fec95
Modifications in existing code to handle new argument types
ankitasanil Feb 13, 2023
b72c211
Modifications in existing code to handle new argument types (contd.)
ankitasanil Feb 14, 2023
6dcfe53
Added inheritance for TracksIn checks as per (https://github.com/anki…
ankitasanil Feb 14, 2023
935a8aa
Python API: Ability to handle piped commands
ankitasanil Mar 7, 2023
e749fe9
Changes for output image piping
ankitasanil Mar 14, 2023
a830bf4
Python CLI: Tweaks to custom types
Lestropie Jul 12, 2023
4560880
Python CLI: Code cleanup
Lestropie Jul 13, 2023
2894b1d
Move handling of envvar MRTRIX_PRESERVE_TMPFILE
Lestropie Aug 10, 2023
294ea57
Fix pylint warnings for python_cmd_changes branch
Lestropie Aug 10, 2023
70c154e
Python: Move some functions from path to utils module
Lestropie Aug 10, 2023
e9393d7
First functional version of image piping with Python scripts
Lestropie Aug 10, 2023
913ce00
mrtrix3.app: Terminate if piping image to stdout
Lestropie Aug 10, 2023
2e1efdb
mrtrix3.app: Improvements to __print_full_usage__ behaviour
Lestropie Aug 11, 2023
ff56d40
dwibiascorrect ants: Change command-line options
Lestropie Aug 11, 2023
a847938
mrtrix3.app: Fix __print_full_usage__ for subparser algorithms
Lestropie Aug 11, 2023
94abafa
Docs: Improved metavar usage in Python scripts
Lestropie Aug 11, 2023
dda5db7
Merge branch 'dev' into python_cmd_changes
Lestropie Aug 11, 2023
1a9759e
dwi2mask consensus: Generalise -algorithm interface
Lestropie Aug 11, 2023
a22382f
dwi2mask legacy: Make use of Python command image piping
Lestropie Aug 11, 2023
7f27e89
Python API: Ranged integers and floats
Lestropie Jan 30, 2024
18e6850
Python: Broad fixing of typed command-line argument usage
Lestropie Feb 4, 2024
d511e3d
Python API: Multiple related changes
Lestropie Feb 13, 2024
b31c9d9
New unit test for Python CLI typing
Lestropie Feb 14, 2024
7791a38
Fix Python help pages for bound integers & floats
Lestropie Feb 18, 2024
4da90a0
Python API: Multiple API/CLI changes
Lestropie Feb 18, 2024
4c74759
Testing: Verify piped image support for Python scripts
Lestropie Feb 19, 2024
ff86c44
Python API: Fix __print_full_usage__ for algorithm wrappers
Lestropie Feb 19, 2024
24f1c32
Fix Python issues identified by latest tests
Lestropie Feb 19, 2024
6778522
Merge remote-tracking branch 'origin/dev' into python_cmd_changes
Lestropie Feb 28, 2024
a483d00
Python: Code formatting & documentation regeneration
Lestropie Feb 28, 2024
9822d58
Python CLI: Better metavar handling
Lestropie Feb 28, 2024
d158891
clang-format and clang-tidy fixes for #2678
Lestropie Feb 28, 2024
d5a4596
Add unit testing of Python CLI
Lestropie Feb 28, 2024
4c331e2
Merge remote-tracking branch 'origin/dev' into python_cmd_changes
Lestropie Feb 28, 2024
9cee5ae
dwicat: Use F-strings
Lestropie Feb 28, 2024
d783f8c
population_template: Resolve merge conflicts
Lestropie Feb 28, 2024
55929b0
5ttgen: Algorithms return path of final image to test using 5ttcheck
Lestropie Feb 29, 2024
db3ca00
Resolution of pylint errors for #2678
Lestropie Feb 29, 2024
ff983de
Python CLI: Fixes to typing & alternative typing interface
Lestropie Mar 1, 2024
553a4fb
Python CLI: Move relevant functions / classes into Parser class
Lestropie Mar 1, 2024
e25e977
Fix for population_template for #2678
Lestropie Mar 1, 2024
23f436d
Python API: Fixes to typed CLI
Lestropie Mar 4, 2024
45738a2
Python CLI: Default flags to None
Lestropie Mar 4, 2024
2e6c28a
Merge remote-tracking branch 'origin/dev' into python_cmd_changes
Lestropie Mar 5, 2024
e98ecc6
Testing: Finalise Python CLI testing
Lestropie Mar 5, 2024
40b7a7c
population_template: Syntax fixes
Lestropie Mar 5, 2024
8a0d639
Python CLI: Fix for __print_usage_markdown__
Lestropie Mar 5, 2024
e384c18
Add argument to specify environment for bash tests
daljit46 Mar 5, 2024
7790fd3
testing: Set PYTHONPATH for non-cpp-standalone unit tests
Lestropie Mar 5, 2024
d9587e6
Testing: DO not use sed in Python CLI tests
Lestropie Mar 6, 2024
8065803
Testing: Add C++ CLI evaluation
Lestropie Mar 11, 2024
be75618
CI: Fix PYTHONPATH setting in MSYS2
Lestropie Mar 11, 2024
08bc526
CI: Fix CLI dunder function checks on MSYS2
Lestropie Mar 11, 2024
e014b24
Merge remote-tracking branch 'origin/python_cmd_changes' into fix_pyt…
Lestropie Mar 11, 2024
4c9247b
CI: Fix C++ CLI tests on MSYS2
Lestropie Mar 11, 2024
f57bbd8
Merge pull request #2846 from MRtrix3/fix_python_cli_ci_test
Lestropie Mar 11, 2024
d6a84ba
CI: Final fixes for addition of C++ CLI tests
Lestropie Mar 12, 2024
9ce93f3
Merge remote-tracking branch 'origin/dev' into python_cmd_changes
Lestropie May 13, 2024
65ba856
Testing: Greater testing of Python image piping support
Lestropie May 13, 2024
99dd927
mask2glass: Ensure input image is 3D
Lestropie May 13, 2024
7115593
Testing: Verify that Python commands handle paths with whitespaces
Lestropie May 13, 2024
4095d76
Testing: Import new test data for new mask2glass tests
Lestropie May 13, 2024
05b68d5
Python: Multiple fixes following merge of split tests & CLI changes
Lestropie May 14, 2024
69d3590
Merge remote-tracking branch 'origin/dev' into python_cmd_changes
Lestropie May 15, 2024
92f9a89
5ttgen hsvs: Fixes to whitespace handling changes
Lestropie May 16, 2024
fc4b798
population_template: Fix handling of output directory paths
Lestropie May 16, 2024
f34730d
dwi2mask consensus: Fix for whitespace in scratch directory path
Lestropie May 16, 2024
2a55a43
Testing: Whitespaces in scratch directory paths
Lestropie May 17, 2024
ef5b8c5
mrtrix3.app: Fix argparse exception on existing output filesystem path
Lestropie May 18, 2024
40fdc8e
Testing: Fix execution of bash unit tests
Lestropie May 18, 2024
b3d98c1
Testing: Add comments to CLI tests
Lestropie May 18, 2024
4d8f766
Python CLI & testing fixes
Lestropie May 18, 2024
de5ebe7
Docs: Auto update for changes to -scratch option
MRtrixBot May 20, 2024
c2b2e76
Merge branch 'dev' into python_cmd_changes
Lestropie May 23, 2024
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
14 changes: 7 additions & 7 deletions bin/dwi2response
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ def usage(cmdline): #pylint: disable=unused-variable

# General options
common_options = cmdline.add_argument_group('General dwi2response options')
common_options.add_argument('-mask', help='Provide an initial mask for response voxel selection')
common_options.add_argument('-voxels', help='Output an image showing the final voxel selection(s)')
common_options.add_argument('-shells', help='The b-value(s) to use in response function estimation (comma-separated list in case of multiple b-values, b=0 must be included explicitly)')
common_options.add_argument('-lmax', help='The maximum harmonic degree(s) for response function estimation (comma-separated list in case of multiple b-values)')
common_options.add_argument('-mask', type=app.Parser.ImageIn(), metavar='image', help='Provide an initial mask for response voxel selection')
common_options.add_argument('-voxels', type=app.Parser.ImageOut(), metavar='image', help='Output an image showing the final voxel selection(s)')
common_options.add_argument('-shells', type=app.Parser.SequenceFloat(), help='The b-value(s) to use in response function estimation (comma-separated list in case of multiple b-values, b=0 must be included explicitly)')
common_options.add_argument('-lmax', type=app.Parser.SequenceInt(), help='The maximum harmonic degree(s) for response function estimation (comma-separated list in case of multiple b-values)')
app.add_dwgrad_import_options(cmdline)

# Import the command-line settings for all algorithms found in the relevant directory
Expand All @@ -62,7 +62,7 @@ def execute(): #pylint: disable=unused-variable
# Sanitise some inputs, and get ready for data import
if app.ARGS.lmax:
try:
lmax = [ int(x) for x in app.ARGS.lmax.split(',') ]
lmax = app.ARGS.lmax
if any(lmax_value%2 for lmax_value in lmax):
raise MRtrixError('Value of lmax must be even')
except ValueError as exception:
Expand All @@ -72,12 +72,12 @@ def execute(): #pylint: disable=unused-variable
shells_option = ''
if app.ARGS.shells:
try:
shells_values = [ int(round(float(x))) for x in app.ARGS.shells.split(',') ]
shells_values = [ int(round(x)) for x in app.ARGS.shells ]
except ValueError as exception:
raise MRtrixError('-shells option should provide a comma-separated list of b-values') from exception
if alg.needs_single_shell() and not len(shells_values) == 1:
raise MRtrixError('Can only specify a single b-value shell for single-shell algorithms')
shells_option = ' -shells ' + app.ARGS.shells
shells_option = ' -shells ' + ','.join(str(item) for item in app.ARGS.shells)
singleshell_option = ''
if alg.needs_single_shell():
singleshell_option = ' -singleshell -no_bzero'
Expand Down
4 changes: 2 additions & 2 deletions bin/dwibiascorrect
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def usage(cmdline): #pylint: disable=unused-variable
'More information on mask derivation from DWI data can be found at the following link: \n'
'https://mrtrix.readthedocs.io/en/' + _version.__tag__ + '/dwi_preprocessing/masking.html')
common_options = cmdline.add_argument_group('Options common to all dwibiascorrect algorithms')
common_options.add_argument('-mask', metavar='image', help='Manually provide a mask image for bias field estimation')
common_options.add_argument('-bias', metavar='image', help='Output the estimated bias field')
common_options.add_argument('-mask', type=app.Parser.ImageIn(), metavar='image', help='Manually provide an input mask image for bias field estimation')
common_options.add_argument('-bias', type=app.Parser.ImageOut(), metavar='image', help='Output an image containing the estimated bias field')
app.add_dwgrad_import_options(cmdline)

# Import the command-line settings for all algorithms found in the relevant directory
Expand Down
8 changes: 5 additions & 3 deletions bin/dwicat
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@ import json, shutil


def usage(cmdline): #pylint: disable=unused-variable
from mrtrix3 import app

cmdline.set_author('Lena Dorfschmidt (ld548@cam.ac.uk) and Jakub Vohryzek (jakub.vohryzek@queens.ox.ac.uk) and Robert E. Smith (robert.smith@florey.edu.au)')
cmdline.set_synopsis('Concatenating multiple DWI series accounting for differential intensity scaling')
cmdline.add_description('This script concatenates two or more 4D DWI series, accounting for the '
'fact that there may be differences in intensity scaling between those series. '
'This intensity scaling is corrected by determining scaling factors that will '
'make the overall image intensities in the b=0 volumes of each series approximately '
'equivalent.')
cmdline.add_argument('inputs', nargs='+', help='Multiple input diffusion MRI series')
cmdline.add_argument('output', help='The output image series (all DWIs concatenated)')
cmdline.add_argument('-mask', metavar='image', help='Provide a binary mask within which image intensities will be matched')
cmdline.add_argument('inputs', nargs='+', type=app.Parser.ImageIn(), help='Multiple input diffusion MRI series')
cmdline.add_argument('output', type=app.Parser.ImageOut(), help='The output image series (all DWIs concatenated)')
cmdline.add_argument('-mask', metavar='image', type=app.Parser.ImageIn(), help='Provide a binary mask within which image intensities will be matched')



Expand Down
24 changes: 12 additions & 12 deletions bin/dwifslpreproc
Original file line number Diff line number Diff line change
Expand Up @@ -50,27 +50,27 @@ def usage(cmdline): #pylint: disable=unused-variable
cmdline.add_citation('Andersson, J. L. R.; Graham, M. S.; Zsoldos, E. & Sotiropoulos, S. N. Incorporating outlier detection and replacement into a non-parametric framework for movement and distortion correction of diffusion MR images. NeuroImage, 2016, 141, 556-572', condition='If including "--repol" in -eddy_options input', is_external=True)
cmdline.add_citation('Andersson, J. L. R.; Graham, M. S.; Drobnjak, I.; Zhang, H.; Filippini, N. & Bastiani, M. Towards a comprehensive framework for movement and distortion correction of diffusion MR images: Within volume movement. NeuroImage, 2017, 152, 450-466', condition='If including "--mporder" in -eddy_options input', is_external=True)
cmdline.add_citation('Bastiani, M.; Cottaar, M.; Fitzgibbon, S.P.; Suri, S.; Alfaro-Almagro, F.; Sotiropoulos, S.N.; Jbabdi, S.; Andersson, J.L.R. Automated quality control for within and between studies diffusion MRI data using a non-parametric framework for movement and distortion correction. NeuroImage, 2019, 184, 801-812', condition='If using -eddyqc_text or -eddyqc_all option and eddy_quad is installed', is_external=True)
cmdline.add_argument('input', help='The input DWI series to be corrected')
cmdline.add_argument('output', help='The output corrected image series')
cmdline.add_argument('-json_import', metavar=('file'), help='Import image header information from an associated JSON file (may be necessary to determine phase encoding information)')
cmdline.add_argument('input', type=app.Parser.ImageIn(), help='The input DWI series to be corrected')
cmdline.add_argument('output', type=app.Parser.ImageOut(), help='The output corrected image series')
cmdline.add_argument('-json_import', type=app.Parser.FileIn(), metavar=('file'), help='Import image header information from an associated JSON file (may be necessary to determine phase encoding information)')
pe_options = cmdline.add_argument_group('Options for manually specifying the phase encoding of the input DWIs')
pe_options.add_argument('-pe_dir', metavar=('PE'), help='Manually specify the phase encoding direction of the input series; can be a signed axis number (e.g. -0, 1, +2), an axis designator (e.g. RL, PA, IS), or NIfTI axis codes (e.g. i-, j, k)')
pe_options.add_argument('-readout_time', metavar=('time'), type=float, help='Manually specify the total readout time of the input series (in seconds)')
pe_options.add_argument('-readout_time', metavar='time', type=float, help='Manually specify the total readout time of the input series (in seconds)')
distcorr_options = cmdline.add_argument_group('Options for achieving correction of susceptibility distortions')
distcorr_options.add_argument('-se_epi', metavar=('image'), help='Provide an additional image series consisting of spin-echo EPI images, which is to be used exclusively by topup for estimating the inhomogeneity field (i.e. it will not form part of the output image series)')
distcorr_options.add_argument('-se_epi', type=app.Parser.ImageIn(), metavar='image', help='Provide an additional image series consisting of spin-echo EPI images, which is to be used exclusively by topup for estimating the inhomogeneity field (i.e. it will not form part of the output image series)')
distcorr_options.add_argument('-align_seepi', action='store_true', help='Achieve alignment between the SE-EPI images used for inhomogeneity field estimation, and the DWIs (more information in Description section)')
distcorr_options.add_argument('-topup_options', metavar=('" TopupOptions"'), help='Manually provide additional command-line options to the topup command (provide a string within quotation marks that contains at least one space, even if only passing a single command-line option to topup)')
distcorr_options.add_argument('-topup_files', metavar=('prefix'), help='Provide files generated by prior execution of the FSL "topup" command to be utilised by eddy')
distcorr_options.add_argument('-topup_options', metavar='" TopupOptions"', help='Manually provide additional command-line options to the topup command (provide a string within quotation marks that contains at least one space, even if only passing a single command-line option to topup)')
distcorr_options.add_argument('-topup_files', metavar='prefix', help='Provide files generated by prior execution of the FSL "topup" command to be utilised by eddy')
cmdline.flag_mutually_exclusive_options( [ 'topup_files', 'se_epi' ], False )
cmdline.flag_mutually_exclusive_options( [ 'topup_files', 'align_seepi' ], False )
cmdline.flag_mutually_exclusive_options( [ 'topup_files', 'topup_options' ], False )
eddy_options = cmdline.add_argument_group('Options for affecting the operation of the FSL "eddy" command')
eddy_options.add_argument('-eddy_mask', metavar=('image'), help='Provide a processing mask to use for eddy, instead of having dwifslpreproc generate one internally using dwi2mask')
eddy_options.add_argument('-eddy_slspec', metavar=('file'), help='Provide a file containing slice groupings for eddy\'s slice-to-volume registration')
eddy_options.add_argument('-eddy_options', metavar=('" EddyOptions"'), help='Manually provide additional command-line options to the eddy command (provide a string within quotation marks that contains at least one space, even if only passing a single command-line option to eddy)')
eddy_options.add_argument('-eddy_mask', type=app.Parser.ImageIn(), metavar='image', help='Provide a processing mask to use for eddy, instead of having dwifslpreproc generate one internally using dwi2mask')
eddy_options.add_argument('-eddy_slspec', type=app.Parser.FileIn(), metavar='file', help='Provide a file containing slice groupings for eddy\'s slice-to-volume registration')
eddy_options.add_argument('-eddy_options', metavar='" EddyOptions"', help='Manually provide additional command-line options to the eddy command (provide a string within quotation marks that contains at least one space, even if only passing a single command-line option to eddy)')
eddyqc_options = cmdline.add_argument_group('Options for utilising EddyQC')
eddyqc_options.add_argument('-eddyqc_text', metavar=('directory'), help='Copy the various text-based statistical outputs generated by eddy, and the output of eddy_qc (if installed), into an output directory')
eddyqc_options.add_argument('-eddyqc_all', metavar=('directory'), help='Copy ALL outputs generated by eddy (including images), and the output of eddy_qc (if installed), into an output directory')
eddyqc_options.add_argument('-eddyqc_text', type=app.Parser.DirectoryOut(), metavar='directory', help='Copy the various text-based statistical outputs generated by eddy, and the output of eddy_qc (if installed), into an output directory')
eddyqc_options.add_argument('-eddyqc_all', type=app.Parser.DirectoryOut(), metavar='directory', help='Copy ALL outputs generated by eddy (including images), and the output of eddy_qc (if installed), into an output directory')
cmdline.flag_mutually_exclusive_options( [ 'eddyqc_text', 'eddyqc_all' ], False )
app.add_dwgrad_export_options(cmdline)
app.add_dwgrad_import_options(cmdline)
Expand Down
4 changes: 2 additions & 2 deletions bin/dwigradcheck
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def usage(cmdline): #pylint: disable=unused-variable
'More information on mask derivation from DWI data can be found at the following link: \n'
'https://mrtrix.readthedocs.io/en/' + _version.__tag__ + '/dwi_preprocessing/masking.html')
cmdline.add_citation('Jeurissen, B.; Leemans, A.; Sijbers, J. Automated correction of improperly rotated diffusion gradient orientations in diffusion weighted MRI. Medical Image Analysis, 2014, 18(7), 953-962')
cmdline.add_argument('input', help='The input DWI series to be checked')
cmdline.add_argument('-mask', metavar='image', help='Provide a mask image within which to seed & constrain tracking')
cmdline.add_argument('input', type=app.Parser.ImageIn(), help='The input DWI series to be checked')
cmdline.add_argument('-mask', metavar='image', type=app.Parser.ImageIn(), help='Provide a mask image within which to seed & constrain tracking')
cmdline.add_argument('-number', type=int, default=10000, help='Set the number of tracks to generate for each test')

app.add_dwgrad_export_options(cmdline)
Expand Down
9 changes: 7 additions & 2 deletions bin/dwishellmath
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ def usage(cmdline): #pylint: disable=unused-variable
cmdline.add_description('The output of this command is a 4D image, where '
'each volume corresponds to a b-value shell (in order of increasing b-value), and '
'the intensities within each volume correspond to the chosen statistic having been computed from across the DWI volumes belonging to that b-value shell.')
cmdline.add_argument('input', help='The input diffusion MRI series')
cmdline.add_argument('input', type=app.Parser.ImageIn(), help='The input diffusion MRI series')
cmdline.add_argument('operation', choices=SUPPORTED_OPS, help='The operation to be applied to each shell; this must be one of the following: ' + ', '.join(SUPPORTED_OPS))
cmdline.add_argument('output', help='The output image series')
cmdline.add_argument('output', type=app.Parser.ImageOut(), help='The output image series')
cmdline.add_example_usage('To compute the mean diffusion-weighted signal in each b-value shell',
'dwishellmath dwi.mif mean shellmeans.mif')
app.add_dwgrad_import_options(cmdline)
Expand All @@ -37,6 +37,8 @@ def usage(cmdline): #pylint: disable=unused-variable
def execute(): #pylint: disable=unused-variable
from mrtrix3 import MRtrixError #pylint: disable=no-name-in-module, import-outside-toplevel
from mrtrix3 import app, image, path, run #pylint: disable=no-name-in-module, import-outside-toplevel
import sys

# check inputs and outputs
dwi_header = image.Header(path.from_user(app.ARGS.input, False))
if len(dwi_header.size()) != 4:
Expand All @@ -63,6 +65,9 @@ def execute(): #pylint: disable=unused-variable
# make a 4D image with one volume
app.warn('Only one unique b-value present in DWI data; command mrmath with -axis 3 option may be preferable')
run.command('mrconvert ' + files[0] + ' ' + path.from_user(app.ARGS.output) + ' -axes 0,1,2,-1', mrconvert_keyval=path.from_user(app.ARGS.input, False), force=app.FORCE_OVERWRITE)

if('mrtrix-tmp-' in app.ARGS.output):
sys.stdout.write(app.ARGS.output)


# Execute the script
Expand Down
9 changes: 5 additions & 4 deletions bin/labelsgmfix
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,16 @@ import math, os


def usage(cmdline): #pylint: disable=unused-variable
from mrtrix3 import app
cmdline.set_author('Robert E. Smith (robert.smith@florey.edu.au)')
cmdline.set_synopsis('In a FreeSurfer parcellation image, replace the sub-cortical grey matter structure delineations using FSL FIRST')
cmdline.add_citation('Patenaude, B.; Smith, S. M.; Kennedy, D. N. & Jenkinson, M. A Bayesian model of shape and appearance for subcortical brain segmentation. NeuroImage, 2011, 56, 907-922', is_external=True)
cmdline.add_citation('Smith, S. M.; Jenkinson, M.; Woolrich, M. W.; Beckmann, C. F.; Behrens, T. E.; Johansen-Berg, H.; Bannister, P. R.; De Luca, M.; Drobnjak, I.; Flitney, D. E.; Niazy, R. K.; Saunders, J.; Vickers, J.; Zhang, Y.; De Stefano, N.; Brady, J. M. & Matthews, P. M. Advances in functional and structural MR image analysis and implementation as FSL. NeuroImage, 2004, 23, S208-S219', is_external=True)
cmdline.add_citation('Smith, R. E.; Tournier, J.-D.; Calamante, F. & Connelly, A. The effects of SIFT on the reproducibility and biological accuracy of the structural connectome. NeuroImage, 2015, 104, 253-265')
cmdline.add_argument('parc', help='The input FreeSurfer parcellation image')
cmdline.add_argument('t1', help='The T1 image to be provided to FIRST')
cmdline.add_argument('lut', help='The lookup table file that the parcellated image is based on')
cmdline.add_argument('output', help='The output parcellation image')
cmdline.add_argument('parc', type=app.Parser.ImageIn(), help='The input FreeSurfer parcellation image')
cmdline.add_argument('t1', type=app.Parser.ImageIn(), help='The T1 image to be provided to FIRST')
cmdline.add_argument('lut', type=app.Parser.FileIn(), help='The lookup table file that the parcellated image is based on')
cmdline.add_argument('output', type=app.Parser.ImageOut(), help='The output parcellation image')
cmdline.add_argument('-premasked', action='store_true', default=False, help='Indicate that brain masking has been applied to the T1 input image')
cmdline.add_argument('-sgm_amyg_hipp', action='store_true', default=False, help='Consider the amygdalae and hippocampi as sub-cortical grey matter structures, and also replace their estimates with those from FIRST')

Expand Down
5 changes: 3 additions & 2 deletions bin/mask2glass
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# For more details, see http://www.mrtrix.org/.

def usage(cmdline): #pylint: disable=unused-variable
from mrtrix3 import app
cmdline.set_author('Remika Mito (remika.mito@florey.edu.au) and Robert E. Smith (robert.smith@florey.edu.au)')
cmdline.set_synopsis('Create a glass brain from mask input')
cmdline.add_description('The output of this command is a glass brain image, which can be viewed '
Expand All @@ -24,8 +25,8 @@ def usage(cmdline): #pylint: disable=unused-variable
'also operate on a floating-point image. One way in which this can be exploited is to compute the mean '
'of all subject masks within template space, in which case this script will produce a smoother result '
'than if a binary template mask were to be used as input.')
cmdline.add_argument('input', help='The input mask image')
cmdline.add_argument('output', help='The output glass brain image')
cmdline.add_argument('input', type=app.Parser.ImageIn(), help='The input mask image')
cmdline.add_argument('output', type=app.Parser.ImageOut(), help='The output glass brain image')
cmdline.add_argument('-dilate', type=int, default=2, help='Provide number of passes for dilation step; default = 2')
cmdline.add_argument('-scale', type=float, default=2.0, help='Provide resolution upscaling value; default = 2.0')
cmdline.add_argument('-smooth', type=float, default=1.0, help='Provide standard deviation of smoothing (in mm); default = 1.0')
Expand Down
Loading