From 039277fc5c8646c9fee9b2d72f2779437d51f6d8 Mon Sep 17 00:00:00 2001 From: Robert Smith Date: Sun, 21 May 2023 18:30:03 +1000 Subject: [PATCH 01/17] fod2fixel: Fix -fmls_lobe_merge_ratio Mismatch between option string as loaded in usage() and the get_options() call results in user-specified option being ignored. Error introduced in b435e58 as part of #1932. --- src/dwi/fmls.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dwi/fmls.cpp b/src/dwi/fmls.cpp index 1212fc7a9f..6b0c204153 100644 --- a/src/dwi/fmls.cpp +++ b/src/dwi/fmls.cpp @@ -82,7 +82,7 @@ namespace MR { } } - opt = get_options ("fmls_merge_ratio"); + opt = get_options ("fmls_lobe_merge_ratio"); if (opt.size()) segmenter.set_lobe_merge_ratio (default_type(opt[0][0])); From ba177bd5252f222619ec98ca74ad9455d3fb1eb4 Mon Sep 17 00:00:00 2001 From: Robert Smith Date: Wed, 30 Aug 2023 01:02:11 +1000 Subject: [PATCH 02/17] mrinfo: Update author email --- cmd/mrinfo.cpp | 2 +- docs/reference/commands/mrinfo.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/mrinfo.cpp b/cmd/mrinfo.cpp index 7cb54e1526..416e801ccc 100644 --- a/cmd/mrinfo.cpp +++ b/cmd/mrinfo.cpp @@ -52,7 +52,7 @@ const OptionGroup FieldExportOptions = OptionGroup ("Options for exporting image void usage () { - AUTHOR = "J-Donald Tournier (d.tournier@brain.org.au) and Robert E. Smith (robert.smith@florey.edu.au)"; + AUTHOR = "J-Donald Tournier (jdtournier@gmail.com) and Robert E. Smith (robert.smith@florey.edu.au)"; SYNOPSIS = "Display image header information, or extract specific information from the header"; diff --git a/docs/reference/commands/mrinfo.rst b/docs/reference/commands/mrinfo.rst index ad3740d775..3a91de1396 100644 --- a/docs/reference/commands/mrinfo.rst +++ b/docs/reference/commands/mrinfo.rst @@ -130,7 +130,7 @@ Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch -**Author:** J-Donald Tournier (d.tournier@brain.org.au) and Robert E. Smith (robert.smith@florey.edu.au) +**Author:** J-Donald Tournier (jdtournier@gmail.com) and Robert E. Smith (robert.smith@florey.edu.au) **Copyright:** Copyright (c) 2008-2023 the MRtrix3 contributors. From 692ee908801ec22fd8a0bfee7ff39c277fa51e85 Mon Sep 17 00:00:00 2001 From: Robert Smith Date: Tue, 26 Sep 2023 09:22:57 +1000 Subject: [PATCH 03/17] for_each: Add example usage demonstrating shell operator escape --- bin/for_each | 3 +++ docs/reference/commands/for_each.rst | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/bin/for_each b/bin/for_each index 14665697b0..c6cfb1177b 100755 --- a/bin/for_each +++ b/bin/for_each @@ -48,6 +48,9 @@ def usage(cmdline): #pylint: disable=unused-variable cmdline.add_example_usage('Testing the command string substitution', 'for_each -test * : mrconvert IN PRE.mif', 'By specifying the -test option, the script will print to the terminal the results of text substitutions for all of the specified inputs, but will not actually execute those commands. It can therefore be used to verify that the script is receiving the intended set of inputs, and that the text substitutions on those inputs lead to the intended command strings.') + cmdline.add_example_usage('Utilising shell operators within the command substitution', + 'for_each * : tensor2metric IN/dwi.mif - "|" tensor2metric - -fa IN/fa.mif', + 'In this example, if the double-quotes were NOT placed around the pipe operator, then the shell would take the sum total output of the for_each script and pipe that to a single invocation of the tensor2metric command. Since in this example it is instead desired for the pipe operator to be a part of the command string that is executed multiple times by the for_each script, it must be escaped using double-quotes.') cmdline.add_argument('inputs', help='Each of the inputs for which processing should be run', nargs='+') cmdline.add_argument('colon', help='Colon symbol (":") delimiting the for_each inputs & command-line options from the actual command to be executed', type=str, choices=[':']) cmdline.add_argument('command', help='The command string to run for each input, containing any number of substitutions listed in the Description section', type=str) diff --git a/docs/reference/commands/for_each.rst b/docs/reference/commands/for_each.rst index 19049a5923..5ef2027ae3 100644 --- a/docs/reference/commands/for_each.rst +++ b/docs/reference/commands/for_each.rst @@ -61,6 +61,12 @@ Example usages By specifying the -test option, the script will print to the terminal the results of text substitutions for all of the specified inputs, but will not actually execute those commands. It can therefore be used to verify that the script is receiving the intended set of inputs, and that the text substitutions on those inputs lead to the intended command strings. +- *Utilising shell operators within the command substitution*:: + + $ for_each * : tensor2metric IN/dwi.mif - "|" tensor2metric - -fa IN/fa.mif + + In this example, if the double-quotes were NOT placed around the pipe operator, then the shell would take the sum total output of the for_each script and pipe that to a single invocation of the tensor2metric command. Since in this example it is instead desired for the pipe operator to be a part of the command string that is executed multiple times by the for_each script, it must be escaped using double-quotes. + Options ------- From c7e5de49b4cc4481b6f18b983992f150be20e72a Mon Sep 17 00:00:00 2001 From: Robert Smith Date: Wed, 31 Jan 2024 17:40:38 +1100 Subject: [PATCH 04/17] mrgrid: Fix help for -as option Whitespace present in name of associated compulsory argument erroneously implies that there are two input arguments expected. --- cmd/mrgrid.cpp | 2 +- docs/reference/commands/mrgrid.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/mrgrid.cpp b/cmd/mrgrid.cpp index 797f0472f6..21c3f34de0 100644 --- a/cmd/mrgrid.cpp +++ b/cmd/mrgrid.cpp @@ -107,7 +107,7 @@ void usage () + OptionGroup ("Pad and crop options (no image interpolation is performed, header transformation is adjusted)") + Option ("as", "pad or crop the input image on the upper bound to match the specified reference image grid. " "This operation ignores differences in image transformation between input and reference image.") - + Argument ("reference image").type_image_in () + + Argument ("reference_image").type_image_in () + Option ("uniform", "pad or crop the input image by a uniform number of voxels on all sides") + Argument ("number").type_integer () diff --git a/docs/reference/commands/mrgrid.rst b/docs/reference/commands/mrgrid.rst index b9a37c6ecf..f6209c5c63 100644 --- a/docs/reference/commands/mrgrid.rst +++ b/docs/reference/commands/mrgrid.rst @@ -72,7 +72,7 @@ Regridding options (involves image interpolation, applied to spatial axes only) Pad and crop options (no image interpolation is performed, header transformation is adjusted) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- **-as reference image** pad or crop the input image on the upper bound to match the specified reference image grid. This operation ignores differences in image transformation between input and reference image. +- **-as reference_image** pad or crop the input image on the upper bound to match the specified reference image grid. This operation ignores differences in image transformation between input and reference image. - **-uniform number** pad or crop the input image by a uniform number of voxels on all sides From de908631ebeaf552374551200f225c61002f3a30 Mon Sep 17 00:00:00 2001 From: Robert Smith Date: Tue, 13 Feb 2024 21:25:56 +1100 Subject: [PATCH 05/17] run.command(): Do not hide list inputs Where a command receives a long list of inputs, while collapsing that set may be preferable from the perspective of user terminal information, it should not be hidden from a raw log of the set of commands executed. This change is not currently of high consequence as there is no mechanism that reads from that log file. --- lib/mrtrix3/run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mrtrix3/run.py b/lib/mrtrix3/run.py index 3651082261..b4af7dc8b7 100644 --- a/lib/mrtrix3/run.py +++ b/lib/mrtrix3/run.py @@ -473,7 +473,7 @@ def finalise_temp_file(iostream): if shared.get_scratch_dir(): with shared.lock: with open(os.path.join(shared.get_scratch_dir(), 'log.txt'), 'a') as outfile: - outfile.write(cmdstring + '\n') + outfile.write(' '.join(cmdsplit) + '\n') return CommandReturn(return_stdout, return_stderr) From eae81d5b8500b6d56a90ee23e6f785b55727f41d Mon Sep 17 00:00:00 2001 From: Daljit Singh Date: Wed, 15 May 2024 11:27:47 +0100 Subject: [PATCH 06/17] Update sanitizers workflow following testing changes Sanitizers workflow needs to be updated after #2865 --- .github/workflows/weekly_sanitizers.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/weekly_sanitizers.yml b/.github/workflows/weekly_sanitizers.yml index 52b72710a6..8394635069 100644 --- a/.github/workflows/weekly_sanitizers.yml +++ b/.github/workflows/weekly_sanitizers.yml @@ -28,7 +28,7 @@ jobs: - name: install dependencies run: | sudo apt-get update - sudo apt-get install clang llvm qt6-base-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev ninja-build + sudo apt-get install clang llvm qt6-base-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev ninja-build python3-numpy - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 @@ -56,7 +56,7 @@ jobs: run: cmake --build build - name: binary tests - run: cd build && ctest -R bin --output-on-failure + run: cd build && ctest -L binary --output-on-failure - name: unit tests - run: cd build && ctest -R unit --output-on-failure + run: cd build && ctest -L unittest --output-on-failure From 66b33fb2780727cbdc1791dfa74cf9bb0c16536a Mon Sep 17 00:00:00 2001 From: Robert Smith Date: Mon, 20 May 2024 10:26:03 +1000 Subject: [PATCH 07/17] mrcalc: Support -config option --- cmd/mrcalc.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/mrcalc.cpp b/cmd/mrcalc.cpp index a940502a5e..c7a7950861 100644 --- a/cmd/mrcalc.cpp +++ b/cmd/mrcalc.cpp @@ -911,6 +911,7 @@ void run () { else if (opt->is ("nthreads")) ++n; else if (opt->is ("force") || opt->is ("info") || opt->is ("debug") || opt->is ("quiet")) continue; + else if (opt->is ("config")) n+=2; #define SECTION 3 #include "mrcalc.cpp" From 15e558f2403626b689c11fcca5bb9be422867190 Mon Sep 17 00:00:00 2001 From: J-Donald Tournier Date: Wed, 19 Jun 2024 15:01:27 +0100 Subject: [PATCH 08/17] mrdegibbs: update doc to soften warning about partial Fourier --- cmd/mrdegibbs.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cmd/mrdegibbs.cpp b/cmd/mrdegibbs.cpp index 9021997d82..bc7ecb40dd 100644 --- a/cmd/mrdegibbs.cpp +++ b/cmd/mrdegibbs.cpp @@ -42,11 +42,16 @@ void usage () "you should run denoising before this command to not alter the noise structure, " "which would impact on dwidenoise's performance." + + "For best results, any form of filtering performed by the scanner should be disabled, whether " + "performed in the image domain or k-space. This includes elliptic filtering and other filters that " + "are often applied to reduce Gibbs ringing artifacts. While this method can still safely be applied " + "to such data, some residual ringing artefacts may still be present in the output." + + "Note that this method is designed to work on images acquired with full k-space coverage. " - "Running this method on partial Fourier ('half-scan') data may lead to suboptimal and/or biased " - "results, as noted in the original reference below. There is currently no means of dealing with this; " - "users should exercise caution when using this method on partial Fourier data, and inspect its output " - "for any obvious artefacts. "; + "Running this method on partial Fourier (‘half-scan’) may not fully remove all ringing artifacts, " + "and you may observe residuals of the original artifact in the partial-fourier direction. " + "Nonetheless, application of the method is still safe and worthwhile. Users are however encouraged " + "to acquired full-Fourier data where possible."; ARGUMENTS From d0c3cce0c0006fd1e1374744b00715e946d579fd Mon Sep 17 00:00:00 2001 From: J-Donald Tournier Date: Thu, 20 Jun 2024 09:42:27 +0100 Subject: [PATCH 09/17] Update cmd/mrdegibbs.cpp Co-authored-by: Robert Smith --- cmd/mrdegibbs.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/mrdegibbs.cpp b/cmd/mrdegibbs.cpp index bc7ecb40dd..a260173650 100644 --- a/cmd/mrdegibbs.cpp +++ b/cmd/mrdegibbs.cpp @@ -48,10 +48,11 @@ void usage () "to such data, some residual ringing artefacts may still be present in the output." + "Note that this method is designed to work on images acquired with full k-space coverage. " - "Running this method on partial Fourier (‘half-scan’) may not fully remove all ringing artifacts, " - "and you may observe residuals of the original artifact in the partial-fourier direction. " - "Nonetheless, application of the method is still safe and worthwhile. Users are however encouraged " - "to acquired full-Fourier data where possible."; + "If this method is executed on data acquired with partial Fourier (eg. \"half-scan\") acceleration, " + "it may not fully remove all ringing artifacts, " + "and you may observe residuals of the original artifact in the partial Fourier direction. " + "Nonetheless, application of the method is still considered safe and worthwhile. " + "Users are however encouraged to acquired full-Fourier data where possible."; ARGUMENTS From 3c97a2640a117237a2b00de90a710a7f3902eb03 Mon Sep 17 00:00:00 2001 From: J-Donald Tournier Date: Thu, 20 Jun 2024 10:06:45 +0100 Subject: [PATCH 10/17] mrdegibbs: update RST docs following previous changes --- docs/reference/commands/mrdegibbs.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/reference/commands/mrdegibbs.rst b/docs/reference/commands/mrdegibbs.rst index 8328fd81bc..c60b65ee22 100644 --- a/docs/reference/commands/mrdegibbs.rst +++ b/docs/reference/commands/mrdegibbs.rst @@ -25,7 +25,9 @@ This application attempts to remove Gibbs ringing artefacts from MRI images usin This command is designed to run on data directly after it has been reconstructed by the scanner, before any interpolation of any kind has taken place. You should not run this command after any form of motion correction (e.g. not after dwifslpreproc). Similarly, if you intend running dwidenoise, you should run denoising before this command to not alter the noise structure, which would impact on dwidenoise's performance. -Note that this method is designed to work on images acquired with full k-space coverage. Running this method on partial Fourier ('half-scan') data may lead to suboptimal and/or biased results, as noted in the original reference below. There is currently no means of dealing with this; users should exercise caution when using this method on partial Fourier data, and inspect its output for any obvious artefacts. +For best results, any form of filtering performed by the scanner should be disabled, whether performed in the image domain or k-space. This includes elliptic filtering and other filters that are often applied to reduce Gibbs ringing artifacts. While this method can still safely be applied to such data, some residual ringing artefacts may still be present in the output. + +Note that this method is designed to work on images acquired with full k-space coverage. If this method is executed on data acquired with partial Fourier (eg. "half-scan") acceleration, it may not fully remove all ringing artifacts, and you may observe residuals of the original artifact in the partial Fourier direction. Nonetheless, application of the method is still considered safe and worthwhile. Users are however encouraged to acquired full-Fourier data where possible. Options ------- From a63d6fa2a6cc3fb41e846766dba73ec049073ab9 Mon Sep 17 00:00:00 2001 From: Robert Smith Date: Thu, 27 Jun 2024 18:59:26 +1000 Subject: [PATCH 11/17] ProgressBar: Simple update method where stderr is pipe --- core/progressbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/progressbar.cpp b/core/progressbar.cpp index 6cdce80879..f9bff0ac7d 100644 --- a/core/progressbar.cpp +++ b/core/progressbar.cpp @@ -188,7 +188,7 @@ namespace MR // unable to determine nature of stderr; assuming socket stderr_to_file = false; else - stderr_to_file = S_ISREG (buf.st_mode); + stderr_to_file = S_ISREG (buf.st_mode) || S_ISFIFO (buf.st_mode); From 6ef1584f716a732608f9a2633eea3cb898902af6 Mon Sep 17 00:00:00 2001 From: Daljit Date: Tue, 25 Jun 2024 14:34:03 +0100 Subject: [PATCH 12/17] New workflow for releases This CI workflow creates artifacts of release build using Github Actions. The workflow can be triggered manually and the developer can specify the branch of MRtrix3 they want to build. --- .github/workflows/releases.yml | 137 +++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 .github/workflows/releases.yml diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml new file mode 100644 index 0000000000..9d54057cef --- /dev/null +++ b/.github/workflows/releases.yml @@ -0,0 +1,137 @@ +name: Releases + +on: + workflow_dispatch: + inputs: + branch: + description: 'Branch to release from' + required: true + default: 'dev' + +jobs: + linux-release: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.event.inputs.branch }} + + - name: Set env vars + id: envs + run: | + commit_sha=$(git rev-parse HEAD) + date=$(date +%Y_%m_%d) + echo "commit_sha=$commit_sha" >> $GITHUB_OUTPUT + echo "date=$date" >> $GITHUB_OUTPUT + echo "output_name=mrtrix3-linux-$commit_sha-$date.tar.gz" >> $GITHUB_OUTPUT + + - name: Install Eigen3 + run: | + git clone https://gitlab.com/libeigen/eigen.git && cd eigen && git checkout 3.4.0 + cmake -B build && cmake --build build + sudo cmake --install build + + - name: Install Qt 6 + uses: jurplel/install-qt-action@v3 + with: + version: '6.7.0' + set-env: true + + - name: Run build + run: | + ./packaging/package-linux-tarball.sh . + mv mrtrix.tar.gz ${{ steps.envs.outputs.output_name }} + + - name: Upload release artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.envs.outputs.output_name }} + path: ${{ steps.envs.outputs.output_name }} + + macos-release: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.event.inputs.branch }} + + - name: Set env vars + id: envs + run: | + commit_sha=$(git rev-parse HEAD) + date=$(date +%Y_%m_%d) + echo "commit_sha=$commit_sha" >> $GITHUB_OUTPUT + echo "date=$date" >> $GITHUB_OUTPUT + echo "output_name=mrtrix3-macos-$commit_sha-$date.tar.xz" >> $GITHUB_OUTPUT + + - name: Install deps + run: brew install numpy cmake qt eigen pkg-config fftw libpng ninja + + - name: Run build + run: | + cd ./packaging/macos + ./build ${{ github.event.inputs.branch }} + mv ./mrtrix3-macos-${{ github.event.inputs.branch }}.tar.xz ../../${{ steps.envs.outputs.output_name }} + + - name: Upload release artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.envs.outputs.output_name }} + path: ${{ steps.envs.outputs.output_name }} + + windows-release: + runs-on: windows-latest + defaults: + run: + shell: msys2 {0} + + env: + MINGW_PACKAGE_PREFIX: mingw-w64-ucrt-x86_64 + + steps: + - uses: msys2/setup-msys2@v2 + with: + msystem: UCRT64 + install: | + git + python + ${{env.MINGW_PACKAGE_PREFIX}}-bc + ${{env.MINGW_PACKAGE_PREFIX}}-cmake + ${{env.MINGW_PACKAGE_PREFIX}}-diffutils + ${{env.MINGW_PACKAGE_PREFIX}}-eigen3 + ${{env.MINGW_PACKAGE_PREFIX}}-fftw + ${{env.MINGW_PACKAGE_PREFIX}}-gcc + ${{env.MINGW_PACKAGE_PREFIX}}-libtiff + ${{env.MINGW_PACKAGE_PREFIX}}-ninja + ${{env.MINGW_PACKAGE_PREFIX}}-pkg-config + ${{env.MINGW_PACKAGE_PREFIX}}-qt6-base + ${{env.MINGW_PACKAGE_PREFIX}}-qt6-svg + ${{env.MINGW_PACKAGE_PREFIX}}-zlib + + - name: Checkout + run: git clone https://github.com/mrtrix3/mrtrix3 -b ${{ github.event.inputs.branch }} + + - name: Set env vars + id: envs + run: | + cd mrtrix3 + commit_sha=$(git rev-parse HEAD) + date=$(date +%Y_%m_%d) + echo "commit_sha=$commit_sha" >> $GITHUB_OUTPUT + echo "date=$date" >> $GITHUB_OUTPUT + echo "output_name=mrtrix3-windows-$commit_sha-$date.tar.zst" >> $GITHUB_OUTPUT + + - name: Run build + run: | + cd mrtrix3 + cd packaging/mingw + ./run.sh ${{ steps.envs.outputs.commit_sha }} mrtrix3 + mv mingw*.tar.zst ../../../${{ steps.envs.outputs.output_name }} + + - name: Upload release artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.envs.outputs.output_name }} + path: ${{ steps.envs.outputs.output_name }} From cd4efe88d682fd7144b284bbd31a7b75cdeabaf1 Mon Sep 17 00:00:00 2001 From: Daljit Date: Thu, 27 Jun 2024 15:02:10 +0100 Subject: [PATCH 13/17] Clone Windows source using Github Actions --- .github/workflows/releases.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 9d54057cef..12a8898644 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -109,14 +109,15 @@ jobs: ${{env.MINGW_PACKAGE_PREFIX}}-qt6-base ${{env.MINGW_PACKAGE_PREFIX}}-qt6-svg ${{env.MINGW_PACKAGE_PREFIX}}-zlib - - - name: Checkout - run: git clone https://github.com/mrtrix3/mrtrix3 -b ${{ github.event.inputs.branch }} + + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.event.inputs.branch }} - name: Set env vars id: envs run: | - cd mrtrix3 commit_sha=$(git rev-parse HEAD) date=$(date +%Y_%m_%d) echo "commit_sha=$commit_sha" >> $GITHUB_OUTPUT @@ -125,7 +126,6 @@ jobs: - name: Run build run: | - cd mrtrix3 cd packaging/mingw ./run.sh ${{ steps.envs.outputs.commit_sha }} mrtrix3 mv mingw*.tar.zst ../../../${{ steps.envs.outputs.output_name }} From f3c96e0452734139418e65bd9efe337c16589e0b Mon Sep 17 00:00:00 2001 From: Daljit Singh Date: Mon, 1 Jul 2024 10:27:46 +0100 Subject: [PATCH 14/17] Remove extension from artefact names --- .github/workflows/releases.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 12a8898644..a9fc37b5d6 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -24,7 +24,7 @@ jobs: date=$(date +%Y_%m_%d) echo "commit_sha=$commit_sha" >> $GITHUB_OUTPUT echo "date=$date" >> $GITHUB_OUTPUT - echo "output_name=mrtrix3-linux-$commit_sha-$date.tar.gz" >> $GITHUB_OUTPUT + echo "output_name=mrtrix3-linux-$commit_sha-$date" >> $GITHUB_OUTPUT - name: Install Eigen3 run: | @@ -41,13 +41,13 @@ jobs: - name: Run build run: | ./packaging/package-linux-tarball.sh . - mv mrtrix.tar.gz ${{ steps.envs.outputs.output_name }} + mv mrtrix.tar.gz ${{ steps.envs.outputs.output_name }}.tar.gz - name: Upload release artifact uses: actions/upload-artifact@v4 with: name: ${{ steps.envs.outputs.output_name }} - path: ${{ steps.envs.outputs.output_name }} + path: ${{ steps.envs.outputs.output_name }}.tar.gz macos-release: runs-on: macos-latest @@ -64,7 +64,7 @@ jobs: date=$(date +%Y_%m_%d) echo "commit_sha=$commit_sha" >> $GITHUB_OUTPUT echo "date=$date" >> $GITHUB_OUTPUT - echo "output_name=mrtrix3-macos-$commit_sha-$date.tar.xz" >> $GITHUB_OUTPUT + echo "output_name=mrtrix3-macos-$commit_sha-$date" >> $GITHUB_OUTPUT - name: Install deps run: brew install numpy cmake qt eigen pkg-config fftw libpng ninja @@ -73,13 +73,13 @@ jobs: run: | cd ./packaging/macos ./build ${{ github.event.inputs.branch }} - mv ./mrtrix3-macos-${{ github.event.inputs.branch }}.tar.xz ../../${{ steps.envs.outputs.output_name }} + mv ./mrtrix3-macos-${{ github.event.inputs.branch }}.tar.xz ../../${{ steps.envs.outputs.output_name }}.tar.xz - name: Upload release artifact uses: actions/upload-artifact@v4 with: name: ${{ steps.envs.outputs.output_name }} - path: ${{ steps.envs.outputs.output_name }} + path: ${{ steps.envs.outputs.output_name }}.tar.xz windows-release: runs-on: windows-latest @@ -122,16 +122,16 @@ jobs: date=$(date +%Y_%m_%d) echo "commit_sha=$commit_sha" >> $GITHUB_OUTPUT echo "date=$date" >> $GITHUB_OUTPUT - echo "output_name=mrtrix3-windows-$commit_sha-$date.tar.zst" >> $GITHUB_OUTPUT + echo "output_name=mrtrix3-windows-$commit_sha-$date" >> $GITHUB_OUTPUT - name: Run build run: | cd packaging/mingw ./run.sh ${{ steps.envs.outputs.commit_sha }} mrtrix3 - mv mingw*.tar.zst ../../../${{ steps.envs.outputs.output_name }} + mv mingw*.tar.zst ../../../${{ steps.envs.outputs.output_name }}.tar.zst - name: Upload release artifact uses: actions/upload-artifact@v4 with: name: ${{ steps.envs.outputs.output_name }} - path: ${{ steps.envs.outputs.output_name }} + path: ${{ steps.envs.outputs.output_name }}.tar.zst From bfa00fc63805b8dc2ed7bce9821b351dd718d47e Mon Sep 17 00:00:00 2001 From: Robert Smith Date: Tue, 30 Jul 2024 11:44:05 +1000 Subject: [PATCH 15/17] Deprecated distutils module in Python 3.12 For 3.0.x, alias shutil.which() as find_executable(); load distutils.find_executable() as itself on Python 2. Reverts and replaces fcf0ba9c0394c77ec7bb81f07756dd26cae8cf23, which had erroneous indentation. --- bin/mrtrix3.py | 1 - lib/mrtrix3/path.py | 7 ++++++- lib/mrtrix3/run.py | 7 ++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/bin/mrtrix3.py b/bin/mrtrix3.py index 21c9b827e0..12c0164325 100644 --- a/bin/mrtrix3.py +++ b/bin/mrtrix3.py @@ -15,7 +15,6 @@ # For more details, see http://www.mrtrix.org/. import os, sys -from distutils.spawn import find_executable try: # since importlib code below only works on Python 3.5+ diff --git a/lib/mrtrix3/path.py b/lib/mrtrix3/path.py index 7542dbcec3..53c7e8a8cf 100644 --- a/lib/mrtrix3/path.py +++ b/lib/mrtrix3/path.py @@ -21,13 +21,18 @@ import ctypes, errno, inspect, os, random, string, subprocess, time -from distutils.spawn import find_executable # Function can be used in isolation if potentially needing to place quotation marks around a # filesystem path that is to be included as part of a command string try: from shlex import quote except ImportError: from pipes import quote +# Distutils removed in 3.12, but shutil.which not available in 2.7 +try: + from shutil import which as find_executable +except ImportError: + from distutils.spawn import find_executable + from mrtrix3 import CONFIG from mrtrix3.utils import STRING_TYPES diff --git a/lib/mrtrix3/run.py b/lib/mrtrix3/run.py index b4af7dc8b7..f2b7bc2f0e 100644 --- a/lib/mrtrix3/run.py +++ b/lib/mrtrix3/run.py @@ -17,10 +17,15 @@ # pylint: disable=unspecified-encoding import collections, itertools, os, shlex, signal, string, subprocess, sys, tempfile, threading -from distutils.spawn import find_executable from mrtrix3 import ANSI, BIN_PATH, COMMAND_HISTORY_STRING, EXE_LIST, MRtrixBaseError, MRtrixError from mrtrix3.utils import STRING_TYPES +# Distutils removed in 3.12, but shutil.which not available in 2.7 +try: + from shutil import which as find_executable +except ImportError: + from distutils.spawn import find_executable + IOStream = collections.namedtuple('IOStream', 'handle filename') From b84625aa4cef15628e20bc2fc0ab0d5575fc3e0e Mon Sep 17 00:00:00 2001 From: Robert Smith Date: Wed, 14 Aug 2024 11:18:27 +1000 Subject: [PATCH 16/17] Windows: Delayed writeback to host Where the host drives are accessed within WSL via the 9P protocol, disable memory-mapping output data. This provides a measurable perfmance boost when writing output images directly to the host system. Relevant discussion in #2554. --- core/file/mmap.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/file/mmap.cpp b/core/file/mmap.cpp index 07af2df529..dd29a0efaf 100644 --- a/core/file/mmap.cpp +++ b/core/file/mmap.cpp @@ -112,9 +112,10 @@ namespace MR delayed_writeback = true; } - if (fsbuf.f_type == 0xff534d42 /* CIFS */|| fsbuf.f_type == 0x6969 /* NFS */ || - fsbuf.f_type == 0x65735546 /* FUSE */ || fsbuf.f_type == 0x517b /* SMB */ || - fsbuf.f_type == 0x47504653 /* GPFS */ || fsbuf.f_type == 0xbd00bd0 /* LUSTRE */ + if (fsbuf.f_type == 0xff534d42 /* CIFS */ || fsbuf.f_type == 0x6969 /* NFS */ || + fsbuf.f_type == 0x65735546 /* FUSE */ || fsbuf.f_type == 0x517b /* SMB */ || + fsbuf.f_type == 0x47504653 /* GPFS */ || fsbuf.f_type == 0xbd00bd0 /* LUSTRE */ || + fsbuf.f_type == 0x1021997 /* 9P (WSL) */ #ifdef MRTRIX_MACOSX || fsbuf.f_type == 0x0017 /* OSXFUSE */ From b0c66b565345bcf014149384dc9cd77d3068b77b Mon Sep 17 00:00:00 2001 From: Robert Smith Date: Tue, 14 Mar 2023 11:59:59 +1100 Subject: [PATCH 17/17] Pipe image format: Revise error message --- core/formats/pipe.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/formats/pipe.cpp b/core/formats/pipe.cpp index bf91887e80..1d4029b307 100644 --- a/core/formats/pipe.cpp +++ b/core/formats/pipe.cpp @@ -64,7 +64,7 @@ namespace MR return false; if (isatty (STDOUT_FILENO)) - throw Exception ("attempt to pipe image to standard output (this will leave temporary files behind)"); + throw Exception ("cannot create output piped image: no command connected at other end of pipe to receive that image"); H.name() = File::create_tempfile (0, "mif");