Skip to content

Commit d0acf1b

Browse files
Merge remote-tracking branch 'upstream/dev'
Merge current MRtrix3 dev branch for MRtrix3Tissue v1.0.0 release Also update core/version.h for corresponding 3Tissue_v1.0.0 tag Also update README.md tag checkout example to 3Tissue_v1.0.0
2 parents 4ff9b6d + 5cb2397 commit d0acf1b

File tree

943 files changed

+20945
-15101
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

943 files changed

+20945
-15101
lines changed

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ matrix:
2323
# Run a single OSX job to test compilation only #
2424
#################################################
2525
- os: osx
26-
env: CFLAGS="-Werror" TRAVIS_CXX=clang++ py=python test=build
26+
env: CFLAGS="-Werror" TRAVIS_CXX=clang++ HOMEBREW_LOGS=$HOME/homebrew-logs HOMEBREW_TEMP=$HOME/homebrew-temp py=python test=build
2727
###############################################
2828
# All subsequent tests are performed on Linux #
2929
###############################################
@@ -64,6 +64,7 @@ install:
6464
##################################################
6565
- |
6666
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
67+
brew update
6768
brew install qt5
6869
brew link --force qt5
6970
fi
@@ -85,6 +86,7 @@ install:
8586
- |
8687
if [[ "${test}" == "pylint" ]]; then
8788
if [[ "${py}" == "python2" ]]; then
89+
pip install --user --upgrade setuptools;
8890
pip install --user pylint;
8991
else
9092
pip3 install --user --upgrade setuptools;

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ MRtrix3Tissue is a fork of the MRtrix3 project. It adds capabilities for 3-Tissu
6464

6565
You can build a particular release of MRtrix3Tissue by checking out the corresponding _tag_, and using the same procedure as above to build it:
6666

67-
git checkout 3Tissue_v0.1.0
67+
git checkout 3Tissue_v1.0.0
6868

6969
./configure
7070

appveyor.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ configuration: Release
55
clone_folder: c:\msys64\mrtrix3
66
shallow_clone: false
77

8+
init:
9+
- git config --global core.autocrlf input
10+
811
build_script:
9-
- cmd: echo "empty build to allow passing on master branch"
12+
- cmd: C:\msys64\msys2_shell.cmd -mingw64 -here -defterm -no-start -c "pacman -S --noconfirm bc mingw-w64-x86_64-diffutils mingw-w64-x86_64-eigen3 mingw-w64-x86_64-fftw mingw-w64-x86_64-libtiff mingw-w64-x86_64-qt5 python > pacman.log" || (appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%/pacman.log & EXIT 1)
13+
- cmd: C:\msys64\msys2_shell.cmd -mingw64 -here -defterm -no-start -c "python --version"
14+
- cmd: C:\msys64\msys2_shell.cmd -mingw64 -here -defterm -no-start -c "./configure -assert" || (appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%/configure.log & EXIT 1)
15+
- cmd: C:\msys64\msys2_shell.cmd -mingw64 -here -defterm -no-start -c "./build -nowarnings -nopaginate" || (appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%/build.log & EXIT 1)
16+
17+
test_script:
18+
- cmd: C:\msys64\msys2_shell.cmd -mingw64 -here -defterm -no-start -c "./run_tests" || (appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%/testing.log & EXIT 1)
19+
20+
artifacts:
21+
- path: pacman.log
22+
- path: config
23+
- path: configure.log
24+
- path: build.log
25+
- path: testing.log
1026

bin/5ttgen

Lines changed: 42 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,48 +9,57 @@
99
# defining the appropriate functions; 5ttgen will automatically make that algorithm available at the command-line
1010

1111

12-
# Make the corresponding MRtrix3 Python libraries available
13-
import inspect, os, sys
14-
lib_folder = os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(inspect.getfile(inspect.currentframe()))), os.pardir, 'lib'))
15-
if not os.path.isdir(lib_folder):
16-
sys.stderr.write('Unable to locate MRtrix3 Python libraries')
17-
sys.exit(1)
18-
sys.path.insert(0, lib_folder)
1912

13+
def usage(cmdline): #pylint: disable=unused-variable
14+
from mrtrix3 import algorithm
15+
16+
cmdline.set_author('Robert E. Smith (robert.smith@florey.edu.au)')
17+
cmdline.set_synopsis('Generate a 5TT image suitable for ACT')
18+
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')
19+
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.')
20+
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\'.')
21+
22+
common_options = cmdline.add_argument_group('Options common to all 5ttgen algorithms')
23+
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)')
24+
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')
25+
26+
# Import the command-line settings for all algorithms found in the relevant directory
27+
algorithm.usage(cmdline)
2028

21-
from mrtrix3 import algorithm, app, path, run
2229

23-
app.init('Robert E. Smith (robert.smith@florey.edu.au)', 'Generate a 5TT image suitable for ACT')
24-
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)
25-
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.')
26-
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\'.')
2730

28-
common_options = app.cmdline.add_argument_group('Options common to all 5ttgen algorithms')
29-
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)')
30-
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')
31+
def execute(): #pylint: disable=unused-variable
32+
from mrtrix3 import algorithm, run
3133

32-
# Import the command-line settings for all algorithms found in the relevant directory
33-
algorithm.initialise()
34+
# Find out which algorithm the user has requested
35+
alg = algorithm.get_module(app.ARGS.algorithm)
3436

35-
app.parse()
37+
alg.check_output_paths()
3638

37-
# Find out which algorithm the user has requested
38-
alg = algorithm.getModule(app.args.algorithm)
39+
app.make_scratch_dir()
40+
alg.get_inputs()
41+
app.goto_scratch_dir()
3942

40-
app.checkOutputPath(app.args.output)
41-
alg.checkOutputPaths()
43+
alg.execute()
4244

43-
app.makeTempDir()
44-
alg.getInputs()
45-
app.gotoTempDir()
45+
stderr = run.command('5ttcheck result.mif').stderr
46+
if '[WARNING]' in stderr:
47+
app.warn('Generated image does not perfectly conform to 5TT format:')
48+
for line in stderr.splitlines():
49+
app.warn(line)
4650

47-
alg.execute()
4851

49-
stderr = run.command('5ttcheck result.mif')[1]
50-
if stderr:
51-
app.warn('Generated image does not perfectly conform to 5TT format:')
52-
for line in stderr:
53-
app.warn(line)
5452

55-
run.command('mrconvert result.mif ' + path.fromUser(app.args.output, True) + (' -force' if app.forceOverwrite else ''))
56-
app.complete()
53+
54+
55+
56+
# Make the corresponding MRtrix3 Python libraries available
57+
import inspect, os, sys
58+
LIB_FOLDER = os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(inspect.getfile(inspect.currentframe()))), os.pardir, 'lib'))
59+
if not os.path.isdir(LIB_FOLDER):
60+
sys.stderr.write('Unable to locate MRtrix3 Python libraries')
61+
sys.exit(1)
62+
sys.path.insert(0, LIB_FOLDER)
63+
# Execute the script
64+
from mrtrix3 import app
65+
app.execute()

bin/average_response

Lines changed: 0 additions & 51 deletions
This file was deleted.

bin/blend

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@ if len(sys.argv) <= 1:
88
sys.stderr.write('eg: blend folder1 folder2 20 output_folder\n')
99
sys.exit(1)
1010

11-
input_folder1 = sys.argv[1]
12-
input_folder2 = sys.argv[2]
13-
file_list1 = sorted(os.listdir(input_folder1))
14-
file_list2 = sorted(os.listdir(input_folder2))
15-
num_overlap = int(sys.argv[3])
16-
output_folder = sys.argv[4]
11+
INPUT_FOLDER_1 = sys.argv[1]
12+
INPUT_FOLDER_2 = sys.argv[2]
13+
FILE_LIST_1 = sorted(os.listdir(INPUT_FOLDER_1))
14+
FILE_LIST_2 = sorted(os.listdir(INPUT_FOLDER_2))
15+
NUM_OVERLAP = int(sys.argv[3])
16+
OUTPUT_FOLDER = sys.argv[4]
1717

18-
if not os.path.exists(output_folder):
19-
os.mkdir(output_folder)
18+
if not os.path.exists(OUTPUT_FOLDER):
19+
os.mkdir(OUTPUT_FOLDER)
2020

21-
total_num_output_frames = len(file_list1) + len(file_list2) - num_overlap
22-
for i in range(total_num_output_frames):
21+
NUM_OUTPUT_FRAMES = len(FILE_LIST_1) + len(FILE_LIST_2) - NUM_OVERLAP
22+
for i in range(NUM_OUTPUT_FRAMES):
2323
file_name = 'frame' + '%0*d' % (5, i) + '.png'
24-
if i <= len(file_list1) - num_overlap:
25-
os.system('cp -L ' + input_folder1 + '/' + file_list1[i] + ' ' + output_folder + '/' + file_name)
26-
if len(file_list1) - num_overlap < i < len(file_list1):
27-
i2 = i - (len(file_list1) - num_overlap) - 1
28-
blend_amount = 100 * float(i2 + 1) / float(num_overlap)
29-
os.system('convert ' + input_folder1 + '/' + file_list1[i] + ' ' + input_folder2 + '/' + file_list2[i2] + ' -alpha on -compose blend -define compose:args=' + str(blend_amount) + ' -gravity South -composite ' + output_folder + '/' + file_name)
30-
if i >= (len(file_list1)):
31-
i2 = i - (len(file_list1) - num_overlap) - 1
32-
os.system('cp -L ' + input_folder2 + '/' + file_list2[i2] + ' ' + output_folder + '/' + file_name)
24+
if i <= len(FILE_LIST_1) - NUM_OVERLAP:
25+
os.system('cp -L ' + INPUT_FOLDER_1 + '/' + FILE_LIST_1[i] + ' ' + OUTPUT_FOLDER + '/' + file_name)
26+
if len(FILE_LIST_1) - NUM_OVERLAP < i < len(FILE_LIST_1):
27+
i2 = i - (len(FILE_LIST_1) - NUM_OVERLAP) - 1
28+
blend_amount = 100 * float(i2 + 1) / float(NUM_OVERLAP)
29+
os.system('convert ' + INPUT_FOLDER_1 + '/' + FILE_LIST_1[i] + ' ' + INPUT_FOLDER_2 + '/' + FILE_LIST_2[i2] + ' -alpha on -compose blend -define compose:args=' + str(blend_amount) + ' -gravity South -composite ' + OUTPUT_FOLDER + '/' + file_name)
30+
if i >= (len(FILE_LIST_1)):
31+
i2 = i - (len(FILE_LIST_1) - NUM_OVERLAP) - 1
32+
os.system('cp -L ' + INPUT_FOLDER_2 + '/' + FILE_LIST_2[i2] + ' ' + OUTPUT_FOLDER + '/' + file_name)

0 commit comments

Comments
 (0)