forked from MRtrix3/mrtrix3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dev' into mrcolour
Conflicts: testing/data testing/tests/mrconvert
- Loading branch information
Showing
308 changed files
with
10,603 additions
and
7,410 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,47 +9,50 @@ | |
# defining the appropriate functions; 5ttgen will automatically make that algorithm available at the command-line | ||
|
||
|
||
# Make the corresponding MRtrix3 Python libraries available | ||
import inspect, os, sys | ||
lib_folder = os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(inspect.getfile(inspect.currentframe()))), os.pardir, 'lib')) | ||
if not os.path.isdir(lib_folder): | ||
sys.stderr.write('Unable to locate MRtrix3 Python libraries') | ||
sys.exit(1) | ||
sys.path.insert(0, lib_folder) | ||
|
||
def usage(cmdline): #pylint: disable=unused-variable | ||
from mrtrix3 import algorithm #pylint: disable=no-name-in-module | ||
|
||
from mrtrix3 import algorithm, app, run | ||
cmdline.set_author('Robert E. Smith ([email protected])') | ||
cmdline.set_synopsis('Generate a 5TT image suitable for ACT') | ||
cmdline.add_citation('Smith, R. E.; Tournier, J.-D.; Calamante, F. & Connelly, A. Anatomically-constrained tractography: Improved diffusion MRI streamlines tractography through effective use of anatomical information. NeuroImage, 2012, 62, 1924-1938') | ||
cmdline.add_description('5ttgen acts as a \'master\' script for generating a five-tissue-type (5TT) segmented tissue image suitable for use in Anatomically-Constrained Tractography (ACT). A range of different algorithms are available for completing this task. When using this script, the name of the algorithm to be used must appear as the first argument on the command-line after \'5ttgen\'. The subsequent compulsory arguments and options available depend on the particular algorithm being invoked.') | ||
cmdline.add_description('Each algorithm available also has its own help page, including necessary references; e.g. to see the help page of the \'fsl\' algorithm, type \'5ttgen fsl\'.') | ||
|
||
app.init('Robert E. Smith ([email protected])', 'Generate a 5TT image suitable for ACT') | ||
app.cmdline.addCitation('', 'Smith, R. E.; Tournier, J.-D.; Calamante, F. & Connelly, A. Anatomically-constrained tractography: Improved diffusion MRI streamlines tractography through effective use of anatomical information. NeuroImage, 2012, 62, 1924-1938', False) | ||
app.cmdline.addDescription('5ttgen acts as a \'master\' script for generating a five-tissue-type (5TT) segmented tissue image suitable for use in Anatomically-Constrained Tractography (ACT). A range of different algorithms are available for completing this task. When using this script, the name of the algorithm to be used must appear as the first argument on the command-line after \'5ttgen\'. The subsequent compulsory arguments and options available depend on the particular algorithm being invoked.') | ||
app.cmdline.addDescription('Each algorithm available also has its own help page, including necessary references; e.g. to see the help page of the \'fsl\' algorithm, type \'5ttgen fsl\'.') | ||
common_options = cmdline.add_argument_group('Options common to all 5ttgen algorithms') | ||
common_options.add_argument('-nocrop', action='store_true', default=False, help='Do NOT crop the resulting 5TT image to reduce its size (keep the same dimensions as the input image)') | ||
common_options.add_argument('-sgm_amyg_hipp', action='store_true', default=False, help='Represent the amygdalae and hippocampi as sub-cortical grey matter in the 5TT image') | ||
|
||
common_options = app.cmdline.add_argument_group('Options common to all 5ttgen algorithms') | ||
common_options.add_argument('-nocrop', action='store_true', default=False, help='Do NOT crop the resulting 5TT image to reduce its size (keep the same dimensions as the input image)') | ||
common_options.add_argument('-sgm_amyg_hipp', action='store_true', default=False, help='Represent the amygdalae and hippocampi as sub-cortical grey matter in the 5TT image') | ||
# Import the command-line settings for all algorithms found in the relevant directory | ||
algorithm.usage(cmdline) | ||
|
||
# Import the command-line settings for all algorithms found in the relevant directory | ||
algorithm.initialise() | ||
|
||
app.parse() | ||
|
||
# Find out which algorithm the user has requested | ||
alg = algorithm.getModule(app.args.algorithm) | ||
def execute(): #pylint: disable=unused-variable | ||
from mrtrix3 import algorithm, app, run #pylint: disable=no-name-in-module | ||
|
||
app.checkOutputPath(app.args.output) | ||
alg.checkOutputPaths() | ||
# Find out which algorithm the user has requested | ||
alg = algorithm.get_module(app.ARGS.algorithm) | ||
|
||
app.makeTempDir() | ||
alg.getInputs() | ||
app.gotoTempDir() | ||
alg.check_output_paths() | ||
|
||
alg.execute() | ||
app.make_scratch_dir() | ||
alg.get_inputs() | ||
app.goto_scratch_dir() | ||
|
||
stderr = run.command('5ttcheck result.mif')[1] | ||
if '[WARNING]' in stderr: | ||
app.warn('Generated image does not perfectly conform to 5TT format:') | ||
for line in stderr.splitlines(): | ||
app.warn(line) | ||
alg.execute() | ||
|
||
app.complete() | ||
stderr = run.command('5ttcheck result.mif').stderr | ||
if '[WARNING]' in stderr: | ||
app.warn('Generated image does not perfectly conform to 5TT format:') | ||
for line in stderr.splitlines(): | ||
app.warn(line) | ||
|
||
|
||
|
||
|
||
|
||
|
||
# Execute the script | ||
import mrtrix3 | ||
mrtrix3.execute() #pylint: disable=no-member |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.