diff --git a/.github/workflows/auto-gen.yaml b/.github/workflows/auto-gen.yaml new file mode 100644 index 0000000..ba62df0 --- /dev/null +++ b/.github/workflows/auto-gen.yaml @@ -0,0 +1,153 @@ +#This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +# For deployment, it will be necessary to create a PyPI API token and store it as a secret +# https://docs.github.com/en/actions/reference/encrypted-secrets + +name: CI/CD + + +on: + workflow_dispatch: # Trigger this workflow manually or via a repository dispatch event + repository_dispatch: + types: [auto-gen] + + +env: + MRTRIX_HOME: /opt/mrtrix3 + MRTRIX_INSTALL: /opt/mrtrix3/install + MRTRIX_VERSION: 3.1.0 + SUBPKG_NAME: v3_1 + +jobs: + + generate: + + runs-on: ubuntu-latest + + env: + CFLAGS: -Werror + QT_SELECT: qt6 + SCCACHE_GHA_ENABLED: "true" + SCCACHE_CACHE_SIZE: "2G" + + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Set Git User + # checkout@v2 adds a header that makes branch protection report errors + # because the Github action bot is not a collaborator on the repo + run: | + git config --global user.email "dummy@email.com" + git config --global user.name "Dummy User" + - name: Unset header + # checkout@v2 adds a header that makes branch protection report errors + # because the Github action bot is not a collaborator on the repo + run: git config --local --unset http.https://github.com/.extraheader + - name: Fetch tags + run: git fetch --prune --unshallow + - name: Create auto-gen tag + run: git tag -a old-auto-gen -m "Old point of auto-generation" + - name: Checkout auto-gen branch + run: git checkout auto-gen + - name: install dependencies + run: | + sudo apt-get update + sudo apt-get install clang qt6-base-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev ninja-build + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.3 + - name: Get CMake + uses: lukka/get-cmake@latest + with: + cmakeVersion: '3.16.3' + - name: Print CMake version + run: cmake --version + - name: Create MRtrix install directory + run: | + sudo mkdir -p ${{ env.MRTRIX_INSTALL }} + sudo chown $USER ${{ env.MRTRIX_INSTALL }} + - name: Cache MRtrix Install + id: cache-install + uses: actions/cache@v4 + with: + path: ${{ env.MRTRIX_INSTALL }} + key: mrtrix-${{ env.MRTRIX_VERSION }}-${{ runner.os }} + - name: Clone latest MRtrix and switch to latest tag + run: | + mkdir $MRTRIX_HOME + sudo chown -R $USER $MRTRIX_HOME + git clone https://github.com/tclose/mrtrix3.git $MRTRIX_HOME/src + cd $MRTRIX_HOME/src + git checkout print-pydra-dev + git tag -a $MRTRIX_VERSION -m"Tag used to create a pydra-task-mrtrix3 release" + git describe --abbrev=0 +# echo "MRTRIX_VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV +# git checkout $MRTRIX_VERSION + - name: configure + run: | + cd $MRTRIX_HOME/src + cmake \ + -B build \ + -G Ninja \ + -D CMAKE_BUILD_TYPE=Release \ + -D MRTRIX_BUILD_TESTS=ON \ + -D MRTRIX_STL_DEBUGGING=ON \ + -D MRTRIX_WARNINGS_AS_ERRORS=ON \ + -D CMAKE_C_COMPILER=clang \ + -D CMAKE_CXX_COMPILER=clang++ \ + -D CMAKE_INSTALL_PREFIX=$MRTRIX_INSTALL + - name: Build Mrtrix + run: | + cd $MRTRIX_HOME/src + cmake --build build + - name: Install Mrtrix + run: | + cd $MRTRIX_HOME/src + cmake --install build + - name: Set PATH Variable + run: echo "PATH=$PATH:$MRTRIX_INSTALL/bin" >> $GITHUB_ENV + - name: Set LD_LIBRARY_PATH Variable + run: echo "LD_LIBRARY_PATH=$MRTRIX_INSTALL/lib" >> $GITHUB_ENV + - name: Change back to the root directory + run: cd .. + - name: Set up Python + uses: actions/setup-python@v5 + - name: Install Python build dependencies + run: | + python -m pip install --upgrade pip + - name: Install pydra-auto-gen requirements + run: > + pip install + -e related-packages/fileformats + -e related-packages/fileformats-extras + -e .[dev,test] + - name: Install development Pydra + run: pip install --no-deps git+https://github.com/nipype/pydra.git@develop + - name: Generate task specifications + run: > + ./generate.py + $MRTRIX_INSTALL/bin + $(pwd) + $MRTRIX_VERSION + --raise-errors + --latest + - name: Commit changes to auto-gen branch + run: | + git add . + git commit -m "Refresh of auto-generated task specifications" + git push + - name: Rebase main on auto-gen + run: | + git checkout main + git checkout -b re-auto-gen + git rebase old-auto-gen --onto auto-gen + - name: Create pull request + uses: peter-evans/create-pull-request@v4 + with: + branch: re-auto-gen + title: 'Rebase of main on re-auto-generated tasks' + body: 'This PR rebases the main branch on the re-auto-gen branch to include newly regenerated Pydra tasks.' + base: main + commit-message: 'Rebase main on auto-gen' + labels: auto-gen diff --git a/.github/workflows/ci-cd.yaml b/.github/workflows/ci-cd.yaml new file mode 100644 index 0000000..48cdf46 --- /dev/null +++ b/.github/workflows/ci-cd.yaml @@ -0,0 +1,255 @@ +#This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +# For deployment, it will be necessary to create a PyPI API token and store it as a secret +# https://docs.github.com/en/actions/reference/encrypted-secrets + +name: CI/CD + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + release: + types: [published] + repository_dispatch: + types: [create-release] + + +env: + MRTRIX_HOME: /opt/mrtrix3 + MRTRIX_INSTALL: /opt/mrtrix3/install + MRTRIX_VERSION: 3.0.4 + SUBPKG_NAME: v3_1 + +jobs: + + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.11, 3.13] + defaults: + run: + shell: bash -l {0} + steps: + - name: Set Git User + # checkout@v2 adds a header that makes branch protection report errors + # because the Github action bot is not a collaborator on the repo + run: | + git config --global user.email "auto@github-actions" + git config --global user.name "GitHub Actions Runner" + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install clang qt6-base-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev ninja-build + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.3 + - name: Get CMake + uses: lukka/get-cmake@latest + with: + cmakeVersion: '3.16.3' + - name: Print CMake version + run: cmake --version + + - name: Create MRtrix install directory + run: | + sudo mkdir -p ${{ env.MRTRIX_INSTALL }} + sudo chown $USER ${{ env.MRTRIX_INSTALL }} + + - name: Cache MRtrix Install + id: cache-install + uses: actions/cache@v4 + with: + path: ${{ env.MRTRIX_INSTALL }} + key: mrtrix-${{ env.MRTRIX_VERSION }}-${{ runner.os }} + + - name: Clone latest MRtrix and switch to latest tag + run: | + mkdir $MRTRIX_HOME + sudo chown -R $USER $MRTRIX_HOME + git clone https://github.com/tclose/mrtrix3.git $MRTRIX_HOME/src + cd $MRTRIX_HOME/src + git checkout print-pydra-dev + git tag -a $MRTRIX_VERSION -m"Tag used to create a pydra-task-mrtrix3 release" + git describe --abbrev=0 +# echo "MRTRIX_VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV +# git checkout $MRTRIX_VERSION + - name: configure + run: | + cd $MRTRIX_HOME/src + cmake \ + -B build \ + -G Ninja \ + -D CMAKE_BUILD_TYPE=Release \ + -D MRTRIX_BUILD_TESTS=ON \ + -D MRTRIX_STL_DEBUGGING=ON \ + -D MRTRIX_WARNINGS_AS_ERRORS=ON \ + -D CMAKE_C_COMPILER=clang \ + -D CMAKE_CXX_COMPILER=clang++ \ + -D CMAKE_INSTALL_PREFIX=$MRTRIX_INSTALL + - name: Build Mrtrix + run: | + cd $MRTRIX_HOME/src + cmake --build build + - name: Install Mrtrix + run: | + cd $MRTRIX_HOME/src + cmake --install build + - name: Checkout code + uses: actions/checkout@v2 + - name: Unset header + # checkout@v2 adds a header that makes branch protection report errors + # because the Github action bot is not a collaborator on the repo + run: git config --local --unset http.https://github.com/.extraheader + - name: Fetch tags + run: git fetch --prune --unshallow + - name: Strip auto package from gitignore so it is included in package + run: | + sed -i '/\/pydra\/tasks\/mrtrix3\/${{ env.SUBPKG_NAME }}/d' .gitignore + - name: Set PATH Variable + run: echo "PATH=$PATH:$MRTRIX_INSTALL/bin" >> $GITHUB_ENV + - name: Set LD_LIBRARY_PATH Variable + run: echo "LD_LIBRARY_PATH=$MRTRIX_INSTALL/lib" >> $GITHUB_ENV + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install build dependencies + run: | + python -m pip install --upgrade pip + - name: Install task package + run: > + pip install + -e ./related-packages/fileformats + -e ./related-packages/fileformats-extras + -e '.[test]' + - name: Install development Pydra + run: pip install --no-deps git+https://github.com/nipype/pydra.git@develop + - name: Test with pytest + run: pytest -sv pydra/tasks/mrtrix3 --cov pydra.tasks.mrtrix3 --cov-report xml + - uses: codecov/codecov-action@v2 + if: ${{ always() }} + + deploy-fileformats: + needs: [test] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: 0 + - name: Unset header + # checkout@v2 adds a header that makes branch protection report errors + # because the Github action bot is not a collaborator on the repo + run: git config --local --unset http.https://github.com/.extraheader + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + - name: Install build tools + run: python -m pip install build twine + - name: Build source and wheel distributions + run: python -m build ./related-packages/fileformats + - name: Check distributions + run: twine check ./related-packages/fileformats/dist/* + - name: Check for PyPI token on tag + id: deployable + if: github.event_name == 'release' || github.event_name == 'repository_dispatch' + env: + PYPI_API_TOKEN: "${{ secrets.PYPI_FILEFORMATS_API_TOKEN }}" + run: if [ -n "$PYPI_API_TOKEN" ]; then echo "DEPLOY=true" >> $GITHUB_OUTPUT; fi + - name: Upload to PyPI + if: steps.deployable.outputs.DEPLOY + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_FILEFORMATS_API_TOKEN }} + packages-dir: ./related-packages/fileformats/dist + + deploy-fileformats-extras: + needs: [deploy-fileformats] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: 0 + - name: Unset header + # checkout@v2 adds a header that makes branch protection report errors + # because the Github action bot is not a collaborator on the repo + run: git config --local --unset http.https://github.com/.extraheader + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + - name: Install build tools + run: python -m pip install build twine + - name: Build source and wheel distributions + run: python -m build ./related-packages/fileformats-extras + - name: Check distributions + run: twine check ./related-packages/fileformats-extras/dist/* + - name: Check for PyPI token on tag + id: deployable + if: github.event_name == 'release' || github.event_name == 'repository_dispatch' + env: + PYPI_API_TOKEN: "${{ secrets.PYPI_FILEFORMATS_EXTRAS_API_TOKEN }}" + run: if [ -n "$PYPI_API_TOKEN" ]; then echo "DEPLOY=true" >> $GITHUB_OUTPUT; fi + - name: Upload to PyPI + if: steps.deployable.outputs.DEPLOY + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_FILEFORMATS_EXTRAS_API_TOKEN }} + packages-dir: ./related-packages/fileformats-extras/dist + + deploy: + needs: [test, deploy-fileformats, deploy-fileformats-extras] + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + - name: Set up Git user + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + - name: Unset header + # checkout@v2 adds a header that makes branch protection report errors + # because the Github action bot is not a collaborator on the repo + run: git config --local --unset http.https://github.com/.extraheader + - name: Strip auto package from gitignore so it is included in package + run: | + sed -i '/\/pydra\/tasks\/mrtrix3\/${{ env.SUBPKG_NAME }}/d' .gitignore + - name: Set up Python 3 + uses: actions/setup-python@v3 + with: + python-version: 3.x + - name: Install build tools + run: python -m pip install --upgrade pip twine build + - name: Build source and wheel distributions + run: python -m build + - name: Check distributions + run: twine check dist/* + - name: Upload sdist + uses: actions/upload-artifact@v4 + with: + name: SDist + path: dist/*.tar.gz + # Deploy on tags if PYPI_API_TOKEN is defined in the repository secrets. + # Secrets are not accessible in the if: condition [0], so set an output variable [1] + # [0] https://github.community/t/16928 + # [1] https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter + - name: Check for PyPI token on tag + id: deployable + if: github.event_name == 'release' || github.event_name == 'repository_dispatch' + env: + PYPI_API_TOKEN: "${{ secrets.PYPI_API_TOKEN }}" + run: if [ -n "$PYPI_API_TOKEN" ]; then echo ::set-output name=DEPLOY::true; fi + - name: Upload to PyPI + if: steps.deployable.outputs.DEPLOY + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} + packages-dir: dist/ diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml deleted file mode 100644 index 94ffe4c..0000000 --- a/.github/workflows/ci-cd.yml +++ /dev/null @@ -1,403 +0,0 @@ -#This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -# For deployment, it will be necessary to create a PyPI API token and store it as a secret -# https://docs.github.com/en/actions/reference/encrypted-secrets - -name: CI/CD - -on: - push: - branches: [ main, develop ] - pull_request: - branches: [ main, develop ] - release: - types: [published] - repository_dispatch: - types: [create-release] - - -env: - MRTRIX_HOME: /opt/mrtrix3 - MRTRIX_INSTALL: /opt/mrtrix3/install - MRTRIX_VERSION: 3.0.4 - SUBPKG_NAME: v3_0 - -jobs: - - generate: - - runs-on: ubuntu-latest - - env: - CFLAGS: -Werror - QT_SELECT: qt6 - SCCACHE_GHA_ENABLED: "true" - SCCACHE_CACHE_SIZE: "2G" - - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - name: Set Git User - # checkout@v2 adds a header that makes branch protection report errors - # because the Github action bot is not a collaborator on the repo - run: | - git config --global user.email "dummy@email.com" - git config --global user.name "Dummy User" - - name: Unset header - # checkout@v2 adds a header that makes branch protection report errors - # because the Github action bot is not a collaborator on the repo - run: git config --local --unset http.https://github.com/.extraheader - - name: Fetch tags - run: git fetch --prune --unshallow - - name: install dependencies - run: | - sudo apt-get update - sudo apt-get install clang qt6-base-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev ninja-build - - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.3 - - name: Get CMake - uses: lukka/get-cmake@latest - with: - cmakeVersion: '3.16.3' - - name: Print CMake version - run: cmake --version - - name: Clone latest MRtrix and switch to latest tag - run: | - mkdir $MRTRIX_HOME - sudo chown -R $USER $MRTRIX_HOME - git clone https://github.com/tclose/mrtrix3.git $MRTRIX_HOME/src - cd $MRTRIX_HOME/src - git checkout pydra-usage-python-cmd - git tag -a $MRTRIX_VERSION -m"Tag used to create a pydra-mrtrix3 release" - git describe --abbrev=0 -# echo "MRTRIX_VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV -# git checkout $MRTRIX_VERSION - - name: configure - run: | - cd $MRTRIX_HOME/src - cmake \ - -B build \ - -G Ninja \ - -D CMAKE_BUILD_TYPE=Release \ - -D MRTRIX_BUILD_TESTS=ON \ - -D MRTRIX_STL_DEBUGGING=ON \ - -D MRTRIX_WARNINGS_AS_ERRORS=ON \ - -D CMAKE_C_COMPILER=clang \ - -D CMAKE_CXX_COMPILER=clang++ \ - -D CMAKE_INSTALL_PREFIX=$MRTRIX_INSTALL - - name: Build Mrtrix - run: | - cd $MRTRIX_HOME/src - cmake --build build - - name: Install Mrtrix - run: | - cd $MRTRIX_HOME/src - cmake --install build - - name: Set PATH Variable - run: echo "PATH=$PATH:$MRTRIX_INSTALL/bin" >> $GITHUB_ENV - - name: Set LD_LIBRARY_PATH Variable - run: echo "LD_LIBRARY_PATH=$MRTRIX_INSTALL/lib" >> $GITHUB_ENV - - name: Change back to the root directory - run: cd .. - - name: Set up Python - uses: actions/setup-python@v2 - - name: Install Python build dependencies - run: | - python -m pip install --upgrade pip - - name: Install pydra-auto-gen requirements - run: > - pip install - -e related-packages/fileformats - -e related-packages/fileformats-extras - -e .[dev,test] - - name: Generate task specifications - run: > - ./generate.py - $MRTRIX_INSTALL/bin - $(pwd) - $MRTRIX_VERSION - --log-errors - --latest - - name: Upload MRtrix3 install - uses: actions/upload-artifact@v4 - with: - name: MRtrix3 - path: ${{ env.MRTRIX_INSTALL}} - - name: Upload auto-gen pydra - uses: actions/upload-artifact@v4 - with: - name: AutoGen - path: pydra/tasks/mrtrix3/${{ env.SUBPKG_NAME }} - - name: Write version file - run: echo $MRTRIX_VERSION > mrtrix3_version.txt - - name: Upload version file - uses: actions/upload-artifact@v4 - with: - name: VersionFile - path: mrtrix3_version.txt - - devcheck: - needs: [generate] - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.8, 3.11] # Check oldest and newest versions - pip-flags: ['', '--editable'] - pydra: - - 'pydra' - - '--editable git+https://github.com/nipype/pydra.git#egg=pydra' - - steps: - - uses: actions/checkout@v2 - - name: Download version file - uses: actions/download-artifact@v4 - with: - name: VersionFile - path: mrtrix3_version.txt - - name: Extract Mrtrix version - run: echo "MRTRIX_VERSION=$(cat mrtrix3_version.txt)" >> $GITHUB_ENV - - name: Download auto-gen pydra - uses: actions/download-artifact@v4 - with: - name: AutoGen - path: pydra/tasks/mrtrix3/${{ env.SUBPKG_NAME }} - - name: Strip auto package from gitignore so it is included in package - run: | - sed -i '/\/pydra\/tasks\/mrtrix3\/${{ env.SUBPKG_NAME }}/d' .gitignore - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install build dependencies - run: | - python -m pip install --upgrade pip - - name: Install Pydra - run: | - pip install ${{ matrix.pydra }} - python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')" - - name: Install task package - run: | - pip install ${{ matrix.pip-flags }} "related-packages/fileformats" - pip install ${{ matrix.pip-flags }} ".[dev]" - python -c "import pydra.tasks.mrtrix3 as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')" - python -c "import pydra.tasks.mrtrix3.$SUBPKG_NAME" - python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')" - - test: - needs: [generate] - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.8, 3.11] - defaults: - run: - shell: bash -l {0} - steps: - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install clang qt6-base-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev ninja-build - - name: Checkout code - uses: actions/checkout@v2 - - name: Unset header - # checkout@v2 adds a header that makes branch protection report errors - # because the Github action bot is not a collaborator on the repo - run: git config --local --unset http.https://github.com/.extraheader - - name: Fetch tags - run: git fetch --prune --unshallow - - name: Download version file - uses: actions/download-artifact@v4 - with: - name: VersionFile - path: mrtrix3_version.txt - - name: Extract Mrtrix version - run: echo "MRTRIX_VERSION=$(cat mrtrix3_version.txt)" >> $GITHUB_ENV - - name: Download auto-gen pydra - uses: actions/download-artifact@v4 - with: - name: AutoGen - path: pydra/tasks/mrtrix3/${{ env.SUBPKG_NAME }} - - name: Strip auto package from gitignore so it is included in package - run: | - sed -i '/\/pydra\/tasks\/mrtrix3\/${{ env.SUBPKG_NAME }}/d' .gitignore - - name: Download MRtrix3 install - uses: actions/download-artifact@v4 - with: - name: MRtrix3 - path: ${{ env.MRTRIX_INSTALL}} - - name: Make commands executable - run: chmod +x ${{ env.MRTRIX_INSTALL }}/bin/* - - name: Set PATH Variable - run: echo "PATH=$PATH:$MRTRIX_INSTALL/bin" >> $GITHUB_ENV - - name: Set LD_LIBRARY_PATH Variable - run: echo "LD_LIBRARY_PATH=$MRTRIX_INSTALL/lib" >> $GITHUB_ENV - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install build dependencies - run: | - python -m pip install --upgrade pip - - name: Install task package - run: > - pip install - -e ./related-packages/fileformats - -e ./related-packages/fileformats-extras - -e '.[test]' - - name: Test with pytest - run: pytest -sv pydra/tasks/mrtrix3 --cov pydra.tasks.mrtrix3 --cov-report xml - - uses: codecov/codecov-action@v2 - if: ${{ always() }} - - deploy-fileformats: - needs: [devcheck, test] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 0 - - name: Unset header - # checkout@v2 adds a header that makes branch protection report errors - # because the Github action bot is not a collaborator on the repo - run: git config --local --unset http.https://github.com/.extraheader - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - name: Install build tools - run: python -m pip install build twine - - name: Build source and wheel distributions - run: python -m build ./related-packages/fileformats - - name: Check distributions - run: twine check ./related-packages/fileformats/dist/* - - name: Check for PyPI token on tag - id: deployable - if: github.event_name == 'release' || github.event_name == 'repository_dispatch' - env: - PYPI_API_TOKEN: "${{ secrets.PYPI_FILEFORMATS_API_TOKEN }}" - run: if [ -n "$PYPI_API_TOKEN" ]; then echo "DEPLOY=true" >> $GITHUB_OUTPUT; fi - - name: Upload to PyPI - if: steps.deployable.outputs.DEPLOY - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_FILEFORMATS_API_TOKEN }} - packages-dir: ./related-packages/fileformats/dist - - deploy-fileformats-extras: - needs: [deploy-fileformats] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 0 - - name: Unset header - # checkout@v2 adds a header that makes branch protection report errors - # because the Github action bot is not a collaborator on the repo - run: git config --local --unset http.https://github.com/.extraheader - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - name: Install build tools - run: python -m pip install build twine - - name: Build source and wheel distributions - run: python -m build ./related-packages/fileformats-extras - - name: Check distributions - run: twine check ./related-packages/fileformats-extras/dist/* - - name: Check for PyPI token on tag - id: deployable - if: github.event_name == 'release' || github.event_name == 'repository_dispatch' - env: - PYPI_API_TOKEN: "${{ secrets.PYPI_FILEFORMATS_EXTRAS_API_TOKEN }}" - run: if [ -n "$PYPI_API_TOKEN" ]; then echo "DEPLOY=true" >> $GITHUB_OUTPUT; fi - - name: Upload to PyPI - if: steps.deployable.outputs.DEPLOY - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_FILEFORMATS_EXTRAS_API_TOKEN }} - packages-dir: ./related-packages/fileformats-extras/dist - - - deploy: - needs: [devcheck, test, deploy-fileformats, deploy-fileformats-extras] - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v2 - - name: Set up Git user - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - - name: Unset header - # checkout@v2 adds a header that makes branch protection report errors - # because the Github action bot is not a collaborator on the repo - run: git config --local --unset http.https://github.com/.extraheader - - name: Download version file - uses: actions/download-artifact@v4 - with: - name: VersionFile - path: mrtrix3_version.txt - - name: Extract Mrtrix version - run: echo "MRTRIX_VERSION=$(cat mrtrix3_version.txt)" >> $GITHUB_ENV - - name: Download auto-gen pydra - uses: actions/download-artifact@v4 - with: - name: AutoGen - path: pydra/tasks/mrtrix3/${{ env.SUBPKG_NAME }} - - name: Strip auto package from gitignore so it is included in package - run: | - sed -i '/\/pydra\/tasks\/mrtrix3\/${{ env.SUBPKG_NAME }}/d' .gitignore - - name: Add auto-generated directory to git repo - if: github.event_name == 'release' || github.event_name == 'repository_dispatch' - run: | - git add pydra/tasks/mrtrix3/$SUBPKG_NAME - git commit -am"added auto-generated version to make new tag for package version" - git status - - name: Get latest version tag - id: latest_tag - run: | - git fetch --tags - echo "TAG=$(git tag -l | grep 'v.*' | tail -n 1 | awk -F post '{print $1}')" >> $GITHUB_OUTPUT - - name: Overwrite the tag of release event with latest commit (i.e. including the auto directory) - if: github.event_name == 'release' - run: | - git tag -d ${{ steps.latest_tag.outputs.TAG }}; - git tag -a ${{ steps.latest_tag.outputs.TAG }} -m"Tag used to create a pydra-mrtrix3 $MRTRIX_VERSION release"; - - name: Set up Python 3.11 - uses: actions/setup-python@v3 - with: - python-version: 3.11 - - name: Install build tools - run: python -m pip install --upgrade pip twine build - - name: Build source and wheel distributions - run: python -m build - - name: Check distributions - run: twine check dist/* - - name: Upload sdist - uses: actions/upload-artifact@v4 - with: - name: SDist - path: dist/*.tar.gz - # Deploy on tags if PYPI_API_TOKEN is defined in the repository secrets. - # Secrets are not accessible in the if: condition [0], so set an output variable [1] - # [0] https://github.community/t/16928 - # [1] https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter - - name: Check for PyPI token on tag - id: deployable - if: github.event_name == 'release' || github.event_name == 'repository_dispatch' - env: - PYPI_API_TOKEN: "${{ secrets.PYPI_API_TOKEN }}" - run: if [ -n "$PYPI_API_TOKEN" ]; then echo ::set-output name=DEPLOY::true; fi - - name: Upload to PyPI - if: steps.deployable.outputs.DEPLOY - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} - packages-dir: dist/ diff --git a/.gitignore b/.gitignore index a0713aa..fd5ba88 100644 --- a/.gitignore +++ b/.gitignore @@ -139,5 +139,3 @@ _version.py # Mac Garbage .DS_Store - -/pydra/tasks/mrtrix3/v3_0 diff --git a/README.rst b/README.rst index 7f202c9..9b036d5 100644 --- a/README.rst +++ b/README.rst @@ -33,12 +33,6 @@ First install the package in editable mode $ pip install -e .[test] -Then generate the automic interfaces using - -.. code-block:: - - $ python3 generate.py - This package comes with a battery of automatically generated test modules. They can be launched using .. code-block:: diff --git a/generate b/generate new file mode 100755 index 0000000..2b0276a --- /dev/null +++ b/generate @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +set -e + +PKG_DIR=$(dirname $0) + +CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) +AUTO_CONV_SUFFIX="-auto-gen" +REBASED_SUFFIX="-rebased-on-auto-gen" + +if ! git diff-index --quiet HEAD --; then + echo "Current branch '$CURRENT_BRANCH' has uncommitted changes. Please commit or stash them before proceeding." + exit 1 +fi + +echo "Automatically converting Nipype tasks to Pydra tasks..." + +echo "Create '$CURRENT_BRANCH$REBASED_SUFFIX' and '$CURRENT_BRANCH$AUTO_CONV_SUFFIX' branches if not present and switch to $CURRENT_BRANCH$AUTO_CONV_SUFFIX" +echo "NB: $CURRENT_BRANCH$AUTO_CONV_SUFFIX will contain the conversion specs from '$CURRENT_BRANCH' and the auto-generted tasks," +echo "wherease '$CURRENT_BRANCH$REBASED_SUFFIX' will be the changes in the current branch rebased on that" +if [ "$CURRENT_BRANCH" == "*$REBASED_SUFFIX"]; then + BASE_BRANCH=${CURRENT_BRANCH%"$REBASED_SUFFIX"}$AUTO_CONV_SUFFIX + REBASE_BRANCH=$CURRENT_BRANCH + git checkout $BASE_BRANCH +else + REBASE_BRANCH=${CURRENT_BRANCH}$REBASED_SUFFIX + BASE_BRANCH=${CURRENT_BRANCH}$AUTO_CONV_SUFFIX + git checkout -b $REBASE_BRANCH + git checkout -b $BASE_BRANCH +fi + + +echo "Running auto-generation of MRtrix3 tasks..." +CMD_DIR=$(dirname $(which mrconvert)) +python3 $PKG_DIR/generate.py $CMD_DIR $PKG_DIR 3.1.0 + +echo "Committing converted tasks to ${CURRENT_BRANCH}$AUTO_CONV_SUFFIX..." +git add pydra/tasks/mrtrix3 +git commit -m "auto-generated MRtrix3 Pydra tasks" || echo true + +echo "Rebasing '$REBASE_BRANCH' to apply changes..." +git checkout $REBASE_BRANCH +git rebase $BASE_BRANCH + +echo "Successfully converted Nipype tasks to Pydra tasks and rebased manual edits over the top of them in '$REBASE_BRANCH' diff --git a/generate.py b/generate.py index f832195..2eb7958 100755 --- a/generate.py +++ b/generate.py @@ -1,12 +1,12 @@ #!/usr/bin/env python3 import os import sys -import attrs from pathlib import Path import subprocess as sp import typing as ty from importlib import import_module import logging +import tempfile from traceback import format_exc import re from tqdm import tqdm @@ -15,9 +15,10 @@ import black.parsing from fileformats.core import FileSet from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, ImageOut, Tracks -from pydra.engine.helpers import make_klass -from pydra.engine import specs -from pydra.utils import add_exc_note +from pydra.compose import shell +from pydra.compose.base import NO_DEFAULT +from pydra.utils.typing import MultiInputObj +from pydra.utils.general import get_fields, add_exc_note logger = logging.getLogger("pydra-auto-gen") @@ -176,7 +177,7 @@ def auto_gen_mrtrix3_pydra( manual_path = output_dir / "pydra" / "tasks" / "mrtrix3" / "manual" if manual_path.exists(): for manual_file in manual_path.iterdir(): - manual_cmd = manual_file.stem[:-1] + manual_cmd = manual_file.stem if not manual_cmd.startswith(".") and not manual_cmd.startswith("__"): manual_cmds.append(manual_cmd) @@ -205,9 +206,9 @@ def auto_gen_mrtrix3_pydra( # Write init init_path = output_dir / "pydra" / "tasks" / "mrtrix3" / pkg_version / "__init__.py" - imports = "\n".join(f"from .{c}_ import {pascal_case_task_name(c)}" for c in cmds) + imports = "\n".join(f"from .{c} import {pascal_case_task_name(c)}" for c in cmds) imports += "\n" + "\n".join( - f"from ..manual.{c}_ import {pascal_case_task_name(c)}" for c in manual_cmds + f"from ..manual.{c} import {pascal_case_task_name(c)}" for c in manual_cmds ) init_path.write_text(f"# Auto-generated, do not edit\n\n{imports}\n") @@ -233,7 +234,7 @@ def auto_gen_cmd( base_cmd = str(cmd_dir / cmd[0]) cmd = [base_cmd] + cmd[1:] try: - code_str = sp.check_output(cmd + ["__print_usage_pydra__"]).decode("utf-8") + code_str = sp.check_output(cmd + ["__print_pydra_code__"]).decode("utf-8") except sp.CalledProcessError: if log_errors: logger.error("Could not generate interface for '%s'", cmd_name) @@ -267,20 +268,29 @@ def auto_gen_cmd( code_str = code_str.replace(f"{old_name}_output", f"{cmd_name}_output") code_str = re.sub(r"(? cutoff, and the other parameters are estimated subsequently. The output consists of 4 volumes, respectively S(0), D, f, and D'. + + Note that this command ignores the gradient orientation entirely. This approach is therefore only suited for mean DWI (trace-weighted) images or for DWI data collected with isotropically-distributed gradient directions. + + + References + ---------- + + Le Bihan, D.; Breton, E.; Lallemand, D.; Aubin, M.L.; Vignaud, J.; Laval-Jeantet, M. Separation of diffusion and perfusion in intravoxel incoherent motion MR imaging. Radiology, 1988, 168, 497–505. + + Jalnefjord, O.; Andersson, M.; Montelius; M.; Starck, G.; Elf, A.; Johanson, V.; Svensson, J.; Ljungberg, M. Comparison of methods for estimation of the intravoxel incoherent motion (IVIM) diffusion coefficient (D) and perfusion fraction (f). Magn Reson Mater Phy, 2018, 31, 715–723. + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: J-Donald Tournier (jdtournier@gmail.com) and Daan Christiaens (daan.christiaens@kuleuven.be) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "dwi2adc" + + # Arguments + in_file: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input image.""", + ) + + # Options + ivim: bool = shell.arg( + default=False, + argstr="-ivim", + help="""also estimate IVIM parameters in 2-stage fit.""", + ) + cutoff: int | None = shell.arg( + default=None, + argstr="-cutoff", + help="""minimum b-value for ADC estimation in IVIM fit (default = 120 s/mm^2).""", + ) + + # DW gradient table import options: + grad: File | None = shell.arg( + default=None, + argstr="-grad", + help="""Provide the diffusion-weighted gradient scheme used in the acquisition in a text file. This should be supplied as a 4xN text file with each line in the format [ X Y Z b ], where [ X Y Z ] describe the direction of the applied gradient, and b gives the b-value in units of s/mm^2. If a diffusion gradient scheme is present in the input image header, the data provided with this option will be instead used.""", + ) + fslgrad: tuple[File, File] | None = shell.arg( + default=None, + argstr="-fslgrad", + help="""Provide the diffusion-weighted gradient scheme used in the acquisition in FSL bvecs/bvals format files. If a diffusion gradient scheme is present in the input image header, the data provided with this option will be instead used.""", + sep=" ", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="out_file.mif", + help="""the output image.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwi2fod.py b/pydra/tasks/mrtrix3/v3_1/dwi2fod.py new file mode 100644 index 0000000..94cea13 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwi2fod.py @@ -0,0 +1,219 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Dwi2Fod(shell.Task["Dwi2Fod.Outputs"]): + """The spherical harmonic coefficients are stored according to the conventions described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/concepts/spherical_harmonics.html + + + Example usages + -------------- + + + Perform single-shell single-tissue CSD: + + `$ dwi2fod csd dwi.mif response_wm.txt wmfod.mif` + + This algorithm is designed for single-shell data and only uses a single b-value. The response function text file provided should only contain a a single row, corresponding to the b-value used for CSD. + + + Perform multi-shell multi-tissue CSD: + + `$ dwi2fod msmt_csd dwi.mif response_wm.txt wmfod.mif response_gm.txt gm.mif response_csf.txt csf.mif` + + This example is the most common use case of multi-tissue CSD, estimating a white matter FOD, and grey matter and CSF compartments. This algorithm requires at least three unique b-values to estimate three tissue compartments. Each response function text file should have a number of rows equal to the number of b-values used. If only two unique b-values are available, it's also possible to estimate only two tissue compartments, e.g., white matter and CSF. + + + References + ---------- + + * If using csd algorithm: + Tournier, J.-D.; Calamante, F. & Connelly, A. Robust determination of the fibre orientation distribution in diffusion MRI: Non-negativity constrained super-resolved spherical deconvolution. NeuroImage, 2007, 35, 1459-1472 + + * If using msmt_csd algorithm: + Jeurissen, B; Tournier, J-D; Dhollander, T; Connelly, A & Sijbers, J. Multi-tissue constrained spherical deconvolution for improved analysis of multi-shell diffusion MRI data. NeuroImage, 2014, 103, 411-426 + + Tournier, J.-D.; Calamante, F., Gadian, D.G. & Connelly, A. Direct estimation of the fiber orientation density function from diffusion-weighted MRI data using spherical deconvolution. NeuroImage, 2004, 23, 1176-1185 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: J-Donald Tournier (jdtournier@gmail.com) and Ben Jeurissen (ben.jeurissen@uantwerpen.be) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "dwi2fod" + + # Arguments + algorithm: str = shell.arg( + argstr="", + position=1, + help="""the algorithm to use for FOD estimation. (options are: csd,msmt_csd)""", + allowed_values=["csd", "msmt_csd"], + ) + dwi: ImageIn = shell.arg( + argstr="", + position=2, + help="""the input diffusion-weighted image""", + ) + response_odf: MultiInputObj[ty.Any] = shell.arg( + argstr="", + position=3, + help="""pairs of input tissue response and output ODF images""", + ) + + # Options + + # DW gradient table import options: + grad: File | None = shell.arg( + default=None, + argstr="-grad", + help="""Provide the diffusion-weighted gradient scheme used in the acquisition in a text file. This should be supplied as a 4xN text file with each line in the format [ X Y Z b ], where [ X Y Z ] describe the direction of the applied gradient, and b gives the b-value in units of s/mm^2. If a diffusion gradient scheme is present in the input image header, the data provided with this option will be instead used.""", + ) + fslgrad: tuple[File, File] | None = shell.arg( + default=None, + argstr="-fslgrad", + help="""Provide the diffusion-weighted gradient scheme used in the acquisition in FSL bvecs/bvals format files. If a diffusion gradient scheme is present in the input image header, the data provided with this option will be instead used.""", + sep=" ", + ) + + # DW shell selection options: + shells: list[float] | None = shell.arg( + default=None, + argstr="-shells", + help="""specify one or more b-values to use during processing, as a comma-separated list of the desired approximate b-values (b-values are clustered to allow for small deviations). Note that some commands are incompatible with multiple b-values, and will report an error if more than one b-value is provided. +WARNING: note that, even though the b=0 volumes are never referred to as a 'shell' in the literature, they still have to be explicitly included in the list of b-values as provided to the -shell option! Several algorithms that include the b=0 volumes in their computations may otherwise return an undesired result.""", + sep=",", + ) + + # Options common to more than one algorithm: + directions: File | None = shell.arg( + default=None, + argstr="-directions", + help="""specify the directions over which to apply the non-negativity constraint (by default, the built-in 300 direction set is used). These should be supplied as a text file containing [ az el ] pairs for the directions.""", + ) + lmax: list[int] | None = shell.arg( + default=None, + argstr="-lmax", + help="""the maximum spherical harmonic order for the output FOD(s).For algorithms with multiple outputs, this should be provided as a comma-separated list of integers, one for each output image; for single-output algorithms, only a single integer should be provided. If omitted, the command will use the lmax of the corresponding response function (i.e based on its number of coefficients), up to a maximum of 8.""", + sep=",", + ) + mask: ImageIn | None = shell.arg( + default=None, + argstr="-mask", + help="""only perform computation within the specified binary brain mask image.""", + ) + + # Options for the Constrained Spherical Deconvolution algorithm: + filter: File | None = shell.arg( + default=None, + argstr="-filter", + help="""the linear frequency filtering parameters used for the initial linear spherical deconvolution step (default = [ 1 1 1 0 0 ]). These should be supplied as a text file containing the filtering coefficients for each even harmonic order.""", + ) + neg_lambda: float | None = shell.arg( + default=None, + argstr="-neg_lambda", + help="""the regularisation parameter lambda that controls the strength of the non-negativity constraint (default = 1).""", + ) + norm_lambda: float | None = shell.arg( + default=None, + argstr="-norm_lambda", + help="""the regularisation parameter lambda that controls the strength of the constraint on the norm of the solution (default = 1).""", + ) + threshold: float | None = shell.arg( + default=None, + argstr="-threshold", + help="""the threshold below which the amplitude of the FOD is assumed to be zero, expressed as an absolute amplitude (default = 0).""", + ) + niter: int | None = shell.arg( + default=None, + argstr="-niter", + help="""the maximum number of iterations to perform for each voxel (default = 50). Use '-niter 0' for a linear unconstrained spherical deconvolution.""", + ) + + # Options for the Multi-Shell, Multi-Tissue Constrained Spherical Deconvolution algorithm: + norm_lambda: float | None = shell.arg( + default=None, + argstr="-norm_lambda", + help="""the regularisation parameter lambda that controls the strength of the constraint on the norm of the solution (default = 1e-10).""", + ) + neg_lambda: float | None = shell.arg( + default=None, + argstr="-neg_lambda", + help="""the regularisation parameter lambda that controls the strength of the non-negativity constraint (default = 1e-10).""", + ) + + # Stride options: + strides: ty.Any = shell.arg( + default=None, + argstr="-strides", + help="""specify the strides of the output data in memory; either as a comma-separated list of (signed) integers, or as a template image from which the strides shall be extracted and used. The actual strides produced will depend on whether the output image format can support it.""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + predicted_signal: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-predicted_signal", + path_template="predicted_signal.mif", + help="""output the predicted dwi image.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwi2mask_3dautomask.py b/pydra/tasks/mrtrix3/v3_1/dwi2mask_3dautomask.py new file mode 100644 index 0000000..8c866c9 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwi2mask_3dautomask.py @@ -0,0 +1,179 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class Dwi2Mask_3dautomask(shell.Task["Dwi2Mask_3dautomask.Outputs"]): + """ + + References + ---------- + + * RW Cox. AFNI: Software for analysis and visualization of functional magnetic resonance neuroimages. Computers and Biomedical Research, 29:162-173, 1996. + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Ricardo Rios (ricardo.rios@cimat.mx) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwi2mask", "3dautomask") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input DWI series", + ) + clfrac: float | None = shell.arg( + help='Set the "clip level fraction"; must be a number between 0.1 and 0.9. A small value means to make the initial threshold for clipping smaller, which will tend to make the mask larger.', + argstr="-clfrac", + default=None, + ) + nograd: bool = shell.arg( + help='The program uses a "gradual" clip level by default. Add this option to use a fixed clip level.', + argstr="-nograd", + default=False, + ) + peels: int | None = shell.arg( + help="Peel (erode) the mask n times, then unpeel (dilate).", + argstr="-peels", + default=None, + ) + nbhrs: int | None = shell.arg( + help="Define the number of neighbors needed for a voxel NOT to be eroded. It should be between 6 and 26.", + argstr="-nbhrs", + default=None, + ) + eclip: bool = shell.arg( + help="After creating the mask, remove exterior voxels below the clip threshold.", + argstr="-eclip", + default=False, + ) + SI: float | None = shell.arg( + help="After creating the mask, find the most superior voxel, then zero out everything more than SI millimeters inferior to that. 130 seems to be decent (i.e., for Homo Sapiens brains).", + argstr="-SI", + default=None, + ) + dilate: int | None = shell.arg( + help="Dilate the mask outwards n times", + argstr="-dilate", + default=None, + ) + erode: int | None = shell.arg( + help="Erode the mask outwards n times", + argstr="-erode", + default=None, + ) + NN1: bool = shell.arg( + help="Erode and dilate based on mask faces", + argstr="-NN1", + default=False, + ) + NN2: bool = shell.arg( + help="Erode and dilate based on mask edges", + argstr="-NN2", + default=False, + ) + NN3: bool = shell.arg( + help="Erode and dilate based on mask corners", + argstr="-NN3", + default=False, + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output mask image", + path_template="out_file.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwi2mask_ants.py b/pydra/tasks/mrtrix3/v3_1/dwi2mask_ants.py new file mode 100644 index 0000000..1f7b26c --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwi2mask_ants.py @@ -0,0 +1,129 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class Dwi2Mask_Ants(shell.Task["Dwi2Mask_Ants.Outputs"]): + """ + + References + ---------- + + * B. Avants, N.J. Tustison, G. Song, P.A. Cook, A. Klein, J.C. Jee. A reproducible evaluation of ANTs similarity metric performance in brain image registration. NeuroImage, 2011, 54, 2033-2044 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwi2mask", "ants") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input DWI series", + ) + template: ImageIn | None = shell.arg( + help="Provide the template image and corresponding mask for antsBrainExtraction.sh to use; the template image should be T2-weighted.", + argstr="-template", + default=None, + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output mask image", + path_template="out_file.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwi2mask_b02template.py b/pydra/tasks/mrtrix3/v3_1/dwi2mask_b02template.py new file mode 100644 index 0000000..5604a9d --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwi2mask_b02template.py @@ -0,0 +1,152 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class Dwi2Mask_B02template(shell.Task["Dwi2Mask_B02template.Outputs"]): + """ + + References + ---------- + + * If FSL software is used for registration: M. Jenkinson, C.F. Beckmann, T.E. Behrens, M.W. Woolrich, S.M. Smith. FSL. NeuroImage, 62:782-90, 2012 + + * If ANTs software is used for registration: B. Avants, N.J. Tustison, G. Song, P.A. Cook, A. Klein, J.C. Jee. A reproducible evaluation of ANTs similarity metric performance in brain image registration. NeuroImage, 2011, 54, 2033-2044 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwi2mask", "b02template") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input DWI series", + ) + flirt_options: str | None = shell.arg( + help="Command-line options to pass to the FSL flirt command (provide a string within quotation marks that contains at least one space, even if only passing a single command-line option to flirt)", + argstr="-flirt_options", + default=None, + ) + fnirt_config: File | None = shell.arg( + help="Specify a FNIRT configuration file for registration", + argstr="-fnirt_config", + default=None, + ) + ants_options: str | None = shell.arg( + help="Provide options to be passed to the ANTs registration command (see Description)", + argstr="-ants_options", + default=None, + ) + software: str | None = shell.arg( + help="The software to use for template registration; options are: antsfull,antsquick,fsl; default is antsquick", + allowed_values=["antsfull", "antsquick", "fsl"], + argstr="-software", + default=None, + ) + template: ImageIn | None = shell.arg( + help="Provide the template image to which the input data will be registered, and the mask to be projected to the input image. The template image should be T2-weighted.", + argstr="-template", + default=None, + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output mask image", + path_template="out_file.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwi2mask_consensus.py b/pydra/tasks/mrtrix3/v3_1/dwi2mask_consensus.py new file mode 100644 index 0000000..cb8dea9 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwi2mask_consensus.py @@ -0,0 +1,143 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class Dwi2Mask_Consensus(shell.Task["Dwi2Mask_Consensus.Outputs"]): + """ + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwi2mask", "consensus") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input DWI series", + ) + algorithms: str | None = shell.arg( + help="Provide a (space- or comma-separated) list of dwi2mask algorithms that are to be utilised", + argstr="-algorithms", + default=None, + ) + template: ImageIn | None = shell.arg( + help="Provide a template image and corresponding mask for those algorithms requiring such", + argstr="-template", + default=None, + ) + threshold: float | None = shell.arg( + help="The fraction of algorithms that must include a voxel for that voxel to be present in the final mask (default: 0.501)", + argstr="-threshold", + default=None, + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output mask image", + path_template="out_file.mif", + ) + masks: ImageOut | None = shell.outarg( + help="Export a 4D image containing the individual algorithm masks", + argstr="-masks", + default=None, + path_template="masks.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwi2mask_fslbet.py b/pydra/tasks/mrtrix3/v3_1/dwi2mask_fslbet.py new file mode 100644 index 0000000..4600f27 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwi2mask_fslbet.py @@ -0,0 +1,149 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class Dwi2Mask_Fslbet(shell.Task["Dwi2Mask_Fslbet.Outputs"]): + """ + + References + ---------- + + * Smith, S. M. Fast robust automated brain extraction. Human Brain Mapping, 2002, 17, 143-155 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Warda Syeda (wtsyeda@unimelb.edu.au) and Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwi2mask", "fslbet") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input DWI series", + ) + bet_f: float | None = shell.arg( + help="Fractional intensity threshold (0->1); smaller values give larger brain outline estimates", + argstr="-bet_f", + default=None, + ) + bet_g: float | None = shell.arg( + help="Vertical gradient in fractional intensity threshold (-1->1); positive values give larger brain outline at bottom, smaller at top", + argstr="-bet_g", + default=None, + ) + bet_c: typing.List[float] | None = shell.arg( + help="Centre-of-gravity (voxels not mm) of initial mesh surface", + argstr="-bet_c", + default=None, + ) + bet_r: float | None = shell.arg( + help="Head radius (mm not voxels); initial surface sphere is set to half of this", + argstr="-bet_r", + default=None, + ) + rescale: bool = shell.arg( + help="Rescale voxel size provided to BET to 1mm isotropic; can improve results for rodent data", + argstr="-rescale", + default=False, + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output mask image", + path_template="out_file.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwi2mask_hdbet.py b/pydra/tasks/mrtrix3/v3_1/dwi2mask_hdbet.py new file mode 100644 index 0000000..bf5e56b --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwi2mask_hdbet.py @@ -0,0 +1,129 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class Dwi2Mask_Hdbet(shell.Task["Dwi2Mask_Hdbet.Outputs"]): + """ + + References + ---------- + + * Isensee F, Schell M, Tursunova I, Brugnara G, Bonekamp D, Neuberger U, Wick A, Schlemmer HP, Heiland S, Wick W, Bendszus M, Maier-Hein KH, Kickingereder P. Automated brain extraction of multi-sequence MRI using artificial neural networks. Hum Brain Mapp. 2019; 1-13. https://doi.org/10.1002/hbm.24750 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwi2mask", "hdbet") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input DWI series", + ) + nogpu: bool = shell.arg( + help="Do not attempt to run on the GPU", + argstr="-nogpu", + default=False, + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output mask image", + path_template="out_file.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwi2mask_legacy.py b/pydra/tasks/mrtrix3/v3_1/dwi2mask_legacy.py new file mode 100644 index 0000000..e63c30b --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwi2mask_legacy.py @@ -0,0 +1,127 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class Dwi2Mask_Legacy(shell.Task["Dwi2Mask_Legacy.Outputs"]): + """ + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwi2mask", "legacy") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input DWI series", + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + clean_scale: int | None = shell.arg( + help="the maximum scale used to cut bridges. A certain maximum scale cuts bridges up to a width (in voxels) of 2x the provided scale. Setting this to 0 disables the mask cleaning step. (Default: 2)", + argstr="-clean_scale", + default=None, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output mask image", + path_template="out_file.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwi2mask_mean.py b/pydra/tasks/mrtrix3/v3_1/dwi2mask_mean.py new file mode 100644 index 0000000..c60ea35 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwi2mask_mean.py @@ -0,0 +1,132 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class Dwi2Mask_Mean(shell.Task["Dwi2Mask_Mean.Outputs"]): + """ + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Warda Syeda (wtsyeda@unimelb.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwi2mask", "mean") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input DWI series", + ) + shells: typing.List[float] | None = shell.arg( + help="Comma separated list of shells to be included in the volume averaging", + argstr="-shells", + default=None, + ) + clean_scale: int | None = shell.arg( + help="the maximum scale used to cut bridges. A certain maximum scale cuts bridges up to a width (in voxels) of 2x the provided scale. Setting this to 0 disables the mask cleaning step. (Default: 2)", + argstr="-clean_scale", + default=None, + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output mask image", + path_template="out_file.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwi2mask_mtnorm.py b/pydra/tasks/mrtrix3/v3_1/dwi2mask_mtnorm.py new file mode 100644 index 0000000..5c32f77 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwi2mask_mtnorm.py @@ -0,0 +1,147 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class Dwi2Mask_Mtnorm(shell.Task["Dwi2Mask_Mtnorm.Outputs"]): + """ + + References + ---------- + + * Jeurissen, B; Tournier, J-D; Dhollander, T; Connelly, A & Sijbers, J. Multi-tissue constrained spherical deconvolution for improved analysis of multi-shell diffusion MRI data. NeuroImage, 2014, 103, 411-426 + + * Dhollander, T.; Raffelt, D. & Connelly, A. Unsupervised 3-tissue response function estimation from single-shell or multi-shell diffusion MR data without a co-registered T1 image. ISMRM Workshop on Breaking the Barriers of Diffusion MRI, 2016, 5 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) and Arshiya Sangchooli (asangchooli@student.unimelb.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwi2mask", "mtnorm") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input DWI series", + ) + init_mask: ImageIn | None = shell.arg( + help="Provide an initial brain mask, which will constrain the response function estimation (if omitted, the default dwi2mask algorithm will be used)", + argstr="-init_mask", + default=None, + ) + lmax: typing.List[int] | None = shell.arg( + help='The maximum spherical harmonic degree for the estimated FODs (see Description); defaults are "4,0,0" for multi-shell and "4,0" for single-shell data', + argstr="-lmax", + default=None, + ) + threshold: float | None = shell.arg( + help="the threshold on the total tissue density sum image used to derive the brain mask; default is 0.5", + argstr="-threshold", + default=None, + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output mask image", + path_template="out_file.mif", + ) + tissuesum: ImageOut | None = shell.outarg( + help="Export the tissue sum image that was used to generate the mask", + argstr="-tissuesum", + default=None, + path_template="tissuesum.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwi2mask_synthstrip.py b/pydra/tasks/mrtrix3/v3_1/dwi2mask_synthstrip.py new file mode 100644 index 0000000..f8af615 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwi2mask_synthstrip.py @@ -0,0 +1,150 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class Dwi2Mask_Synthstrip(shell.Task["Dwi2Mask_Synthstrip.Outputs"]): + """ + + References + ---------- + + * A. Hoopes, J. S. Mora, A. V. Dalca, B. Fischl, M. Hoffmann. SynthStrip: Skull-Stripping for Any Brain Image. NeuroImage, 2022, 260, 119474 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Ruobing Chen (chrc@student.unimelb.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwi2mask", "synthstrip") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input DWI series", + ) + gpu: bool = shell.arg( + help="Use the GPU", + argstr="-gpu", + default=False, + ) + model: File | None = shell.arg( + help="Alternative model weights", + argstr="-model", + default=None, + ) + nocsf: bool = shell.arg( + help="Compute the immediate boundary of brain matter excluding surrounding CSF", + argstr="-nocsf", + default=False, + ) + border: int | None = shell.arg( + help="Control the boundary distance from the brain", + argstr="-border", + default=None, + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output mask image", + path_template="out_file.mif", + ) + stripped: ImageOut | None = shell.outarg( + help="The output stripped image", + argstr="-stripped", + default=None, + path_template="stripped.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwi2mask_trace.py b/pydra/tasks/mrtrix3/v3_1/dwi2mask_trace.py new file mode 100644 index 0000000..5bd09d7 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwi2mask_trace.py @@ -0,0 +1,142 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class Dwi2Mask_Trace(shell.Task["Dwi2Mask_Trace.Outputs"]): + """ + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Warda Syeda (wtsyeda@unimelb.edu.au) and Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwi2mask", "trace") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input DWI series", + ) + iterative: bool = shell.arg( + help="(EXPERIMENTAL) Iteratively refine the weights for combination of per-shell trace-weighted images prior to thresholding", + argstr="-iterative", + default=False, + ) + max_iters: int | None = shell.arg( + help="Set the maximum number of iterations for the algorithm (default: 10)", + argstr="-max_iters", + default=None, + ) + shells: typing.List[float] | None = shell.arg( + help="Comma-separated list of shells used to generate trace-weighted images for masking", + argstr="-shells", + default=None, + ) + clean_scale: int | None = shell.arg( + help="the maximum scale used to cut bridges. A certain maximum scale cuts bridges up to a width (in voxels) of 2x the provided scale. Setting this to 0 disables the mask cleaning step. (Default: 2)", + argstr="-clean_scale", + default=None, + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output mask image", + path_template="out_file.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwi2response_dhollander.py b/pydra/tasks/mrtrix3/v3_1/dwi2response_dhollander.py new file mode 100644 index 0000000..a019108 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwi2response_dhollander.py @@ -0,0 +1,190 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class Dwi2Response_Dhollander(shell.Task["Dwi2Response_Dhollander.Outputs"]): + """ + + References + ---------- + + * Dhollander, T.; Raffelt, D. & Connelly, A. Unsupervised 3-tissue response function estimation from single-shell or multi-shell diffusion MR data without a co-registered T1 image. ISMRM Workshop on Breaking the Barriers of Diffusion MRI, 2016, 5 + + * If -wm_algo option is not used: Dhollander, T.; Mito, R.; Raffelt, D. & Connelly, A. Improved white matter response function estimation for 3-tissue constrained spherical deconvolution. Proc Intl Soc Mag Reson Med, 2019, 555 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Thijs Dhollander (thijs.dhollander@gmail.com) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwi2response", "dhollander") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="Input DWI dataset", + ) + erode: int | None = shell.arg( + help="Number of erosion passes to apply to initial (whole brain) mask. Set to 0 to not erode the brain mask. (default: 3)", + argstr="-erode", + default=None, + ) + fa: float | None = shell.arg( + help="FA threshold for crude WM versus GM-CSF separation. (default: 0.2)", + argstr="-fa", + default=None, + ) + sfwm: float | None = shell.arg( + help="Final number of single-fibre WM voxels to select, as a percentage of refined WM. (default: 0.5 per cent)", + argstr="-sfwm", + default=None, + ) + gm: float | None = shell.arg( + help="Final number of GM voxels to select, as a percentage of refined GM. (default: 2 per cent)", + argstr="-gm", + default=None, + ) + csf: float | None = shell.arg( + help="Final number of CSF voxels to select, as a percentage of refined CSF. (default: 10 per cent)", + argstr="-csf", + default=None, + ) + wm_algo: str | None = shell.arg( + help="Use external dwi2response algorithm for WM single-fibre voxel selection (options: fa, tax, tournier) (default: built-in Dhollander 2019)", + allowed_values=["fa", "tax", "tournier"], + argstr="-wm_algo", + default=None, + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + mask: ImageIn | None = shell.arg( + help="Provide an initial mask for response voxel selection", + argstr="-mask", + default=None, + ) + shells: typing.List[float] | None = shell.arg( + 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 if desired)", + argstr="-shells", + default=None, + ) + lmax: typing.List[int] | None = shell.arg( + help="The maximum harmonic degree(s) for response function estimation (comma-separated list in case of multiple b-values)", + argstr="-lmax", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_sfwm: File = shell.outarg( + position=2, + argstr="", + help="Output single-fibre WM response function text file", + path_template="out_sfwm.txt", + ) + out_gm: File = shell.outarg( + position=3, + argstr="", + help="Output GM response function text file", + path_template="out_gm.txt", + ) + out_csf: File = shell.outarg( + position=4, + argstr="", + help="Output CSF response function text file", + path_template="out_csf.txt", + ) + voxels: ImageOut | None = shell.outarg( + help="Output an image showing the final voxel selection(s)", + argstr="-voxels", + default=None, + path_template="voxels.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwi2response_fa.py b/pydra/tasks/mrtrix3/v3_1/dwi2response_fa.py new file mode 100644 index 0000000..3999b05 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwi2response_fa.py @@ -0,0 +1,160 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define(xor=[["number", "threshold", None]]) +class Dwi2Response_Fa(shell.Task["Dwi2Response_Fa.Outputs"]): + """ + + References + ---------- + + * Tournier, J.-D.; Calamante, F.; Gadian, D. G. & Connelly, A. Direct estimation of the fiber orientation density function from diffusion-weighted MRI data using spherical deconvolution. NeuroImage, 2004, 23, 1176-1185 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwi2response", "fa") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input DWI", + ) + erode: int | None = shell.arg( + help="Number of brain mask erosion steps to apply prior to threshold (not used if mask is provided manually)", + argstr="-erode", + default=None, + ) + number: int | None = shell.arg( + help="The number of highest-FA voxels to use", + argstr="-number", + default=None, + ) + threshold: float | None = shell.arg( + help="Apply a hard FA threshold, rather than selecting the top voxels", + argstr="-threshold", + default=None, + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + mask: ImageIn | None = shell.arg( + help="Provide an initial mask for response voxel selection", + argstr="-mask", + default=None, + ) + shells: typing.List[float] | None = shell.arg( + 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 if desired)", + argstr="-shells", + default=None, + ) + lmax: typing.List[int] | None = shell.arg( + help="The maximum harmonic degree(s) for response function estimation (comma-separated list in case of multiple b-values)", + argstr="-lmax", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: File = shell.outarg( + position=2, + argstr="", + help="The output response function text file", + path_template="out_file.txt", + ) + voxels: ImageOut | None = shell.outarg( + help="Output an image showing the final voxel selection(s)", + argstr="-voxels", + default=None, + path_template="voxels.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwi2response_manual.py b/pydra/tasks/mrtrix3/v3_1/dwi2response_manual.py new file mode 100644 index 0000000..f5cb514 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwi2response_manual.py @@ -0,0 +1,153 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class Dwi2Response_Manual(shell.Task["Dwi2Response_Manual.Outputs"]): + """ + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwi2response", "manual") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input DWI", + ) + in_voxels: ImageIn = shell.arg( + position=2, + argstr="", + help="Input voxel selection mask", + ) + dirs: ImageIn | None = shell.arg( + help="Provide an input image that contains a pre-estimated fibre direction in each voxel (a tensor fit will be used otherwise)", + argstr="-dirs", + default=None, + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + mask: ImageIn | None = shell.arg( + help="Provide an initial mask for response voxel selection", + argstr="-mask", + default=None, + ) + shells: typing.List[float] | None = shell.arg( + 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 if desired)", + argstr="-shells", + default=None, + ) + lmax: typing.List[int] | None = shell.arg( + help="The maximum harmonic degree(s) for response function estimation (comma-separated list in case of multiple b-values)", + argstr="-lmax", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: File = shell.outarg( + position=3, + argstr="", + help="Output response function text file", + path_template="out_file.txt", + ) + voxels: ImageOut | None = shell.outarg( + help="Output an image showing the final voxel selection(s)", + argstr="-voxels", + default=None, + path_template="voxels.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwi2response_msmt_5tt.py b/pydra/tasks/mrtrix3/v3_1/dwi2response_msmt_5tt.py new file mode 100644 index 0000000..2fbbab9 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwi2response_msmt_5tt.py @@ -0,0 +1,188 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class Dwi2Response_Msmt_5tt(shell.Task["Dwi2Response_Msmt_5tt.Outputs"]): + """ + + References + ---------- + + * Jeurissen, B.; Tournier, J.-D.; Dhollander, T.; Connelly, A. & Sijbers, J. Multi-tissue constrained spherical deconvolution for improved analysis of multi-shell diffusion MRI data. NeuroImage, 2014, 103, 411-426 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwi2response", "msmt_5tt") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input DWI", + ) + in_5tt: ImageIn = shell.arg( + position=2, + argstr="", + help="Input co-registered 5TT image", + ) + dirs: ImageIn | None = shell.arg( + help="Provide an input image that contains a pre-estimated fibre direction in each voxel (a tensor fit will be used otherwise)", + argstr="-dirs", + default=None, + ) + fa: float | None = shell.arg( + help="Upper fractional anisotropy threshold for GM and CSF voxel selection (default: 0.2)", + argstr="-fa", + default=None, + ) + pvf: float | None = shell.arg( + help="Partial volume fraction threshold for tissue voxel selection (default: 0.95)", + argstr="-pvf", + default=None, + ) + wm_algo: str | None = shell.arg( + help="dwi2response algorithm to use for WM single-fibre voxel selection (options: fa, tax, tournier; default: tournier)", + allowed_values=["fa", "tax", "tournier"], + argstr="-wm_algo", + default=None, + ) + sfwm_fa_threshold: float | None = shell.arg( + help="Sets -wm_algo to fa and allows to specify a hard FA threshold for single-fibre WM voxels, which is passed to the -threshold option of the fa algorithm (warning: overrides -wm_algo option)", + argstr="-sfwm_fa_threshold", + default=None, + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + mask: ImageIn | None = shell.arg( + help="Provide an initial mask for response voxel selection", + argstr="-mask", + default=None, + ) + shells: typing.List[float] | None = shell.arg( + 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 if desired)", + argstr="-shells", + default=None, + ) + lmax: typing.List[int] | None = shell.arg( + help="The maximum harmonic degree(s) for response function estimation (comma-separated list in case of multiple b-values)", + argstr="-lmax", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_wm: File = shell.outarg( + position=3, + argstr="", + help="Output WM response text file", + path_template="out_wm.txt", + ) + out_gm: File = shell.outarg( + position=4, + argstr="", + help="Output GM response text file", + path_template="out_gm.txt", + ) + out_csf: File = shell.outarg( + position=5, + argstr="", + help="Output CSF response text file", + path_template="out_csf.txt", + ) + voxels: ImageOut | None = shell.outarg( + help="Output an image showing the final voxel selection(s)", + argstr="-voxels", + default=None, + path_template="voxels.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwi2response_tax.py b/pydra/tasks/mrtrix3/v3_1/dwi2response_tax.py new file mode 100644 index 0000000..775dee3 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwi2response_tax.py @@ -0,0 +1,160 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class Dwi2Response_Tax(shell.Task["Dwi2Response_Tax.Outputs"]): + """ + + References + ---------- + + * Tax, C. M.; Jeurissen, B.; Vos, S. B.; Viergever, M. A. & Leemans, A. Recursive calibration of the fiber response function for spherical deconvolution of diffusion MRI data. NeuroImage, 2014, 86, 67-80 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwi2response", "tax") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input DWI", + ) + peak_ratio: float | None = shell.arg( + help="Second-to-first-peak amplitude ratio threshold", + argstr="-peak_ratio", + default=None, + ) + max_iters: int | None = shell.arg( + help="Maximum number of iterations (set to 0 to force convergence)", + argstr="-max_iters", + default=None, + ) + convergence: float | None = shell.arg( + help="Percentile change in any RF coefficient required to continue iterating", + argstr="-convergence", + default=None, + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + mask: ImageIn | None = shell.arg( + help="Provide an initial mask for response voxel selection", + argstr="-mask", + default=None, + ) + shells: typing.List[float] | None = shell.arg( + 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 if desired)", + argstr="-shells", + default=None, + ) + lmax: typing.List[int] | None = shell.arg( + help="The maximum harmonic degree(s) for response function estimation (comma-separated list in case of multiple b-values)", + argstr="-lmax", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: File = shell.outarg( + position=2, + argstr="", + help="The output response function text file", + path_template="out_file.txt", + ) + voxels: ImageOut | None = shell.outarg( + help="Output an image showing the final voxel selection(s)", + argstr="-voxels", + default=None, + path_template="voxels.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwi2response_tournier.py b/pydra/tasks/mrtrix3/v3_1/dwi2response_tournier.py new file mode 100644 index 0000000..8829ff5 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwi2response_tournier.py @@ -0,0 +1,165 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class Dwi2Response_Tournier(shell.Task["Dwi2Response_Tournier.Outputs"]): + """ + + References + ---------- + + * Tournier, J.-D.; Calamante, F. & Connelly, A. Determination of the appropriate b-value and number of gradient directions for high-angular-resolution diffusion-weighted imaging. NMR Biomedicine, 2013, 26, 1775-1786 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwi2response", "tournier") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input DWI", + ) + number: int | None = shell.arg( + help="Number of single-fibre voxels to use when calculating response function", + argstr="-number", + default=None, + ) + iter_voxels: int | None = shell.arg( + help="Number of single-fibre voxels to select when preparing for the next iteration (default = 10 x value given in -number)", + argstr="-iter_voxels", + default=None, + ) + dilate: int | None = shell.arg( + help="Number of mask dilation steps to apply when deriving voxel mask to test in the next iteration", + argstr="-dilate", + default=None, + ) + max_iters: int | None = shell.arg( + help="Maximum number of iterations (set to 0 to force convergence)", + argstr="-max_iters", + default=None, + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + mask: ImageIn | None = shell.arg( + help="Provide an initial mask for response voxel selection", + argstr="-mask", + default=None, + ) + shells: typing.List[float] | None = shell.arg( + 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 if desired)", + argstr="-shells", + default=None, + ) + lmax: typing.List[int] | None = shell.arg( + help="The maximum harmonic degree(s) for response function estimation (comma-separated list in case of multiple b-values)", + argstr="-lmax", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: File = shell.outarg( + position=2, + argstr="", + help="The output response function text file", + path_template="out_file.txt", + ) + voxels: ImageOut | None = shell.outarg( + help="Output an image showing the final voxel selection(s)", + argstr="-voxels", + default=None, + path_template="voxels.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwi2tensor.py b/pydra/tasks/mrtrix3/v3_1/dwi2tensor.py new file mode 100644 index 0000000..fcca438 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwi2tensor.py @@ -0,0 +1,183 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Dwi2Tensor(shell.Task["Dwi2Tensor.Outputs"]): + """By default, the diffusion tensor (and optionally the kurtosis tensor) is fitted to the log-signal in two steps: firstly, using weighted least-squares (WLS) with weights based on the empirical signal intensities; secondly, by further iterated weighted least-squares (IWLS) with weights determined by the signal predictions from the previous iteration (by default, 2 iterations will be performed). This behaviour can be altered in two ways: + + * The -ols option will cause the first fitting step to be performed using ordinary least-squares (OLS); that is, all measurements contribute equally to the fit, instead of the default behaviour of weighting based on the empirical signal intensities. + + * The -iter option controls the number of iterations of the IWLS prodedure. If this is set to zero, then the output model parameters will be those resulting from the first fitting step only: either WLS by default, or OLS if the -ols option is used in conjunction with -iter 0. + + By default, the diffusion tensor (and optionally the kurtosis tensor) is fitted using unconstrained optimization. This can result in unexpected diffusion parameters, e.g. parameters that represent negative apparent diffusivities or negative apparent kurtoses, or parameters that correspond to non-monotonic decay of the predicted signal. By supplying the -constrain option, constrained optimization is performed instead and such physically implausible parameters can be avoided. Depending on the presence of the -dkt option, the -constrain option will enforce the following constraints: + + * Non-negative apparent diffusivity (always). + + * Non-negative apparent kurtosis (when the -dkt option is provided). + + * Monotonic signal decay in the b = [0 b_max] range (when the -dkt option is provided). + + The tensor coefficients are stored in the output image as follows: + volumes 0-5: D11, D22, D33, D12, D13, D23 + + If diffusion kurtosis is estimated using the -dkt option, these are stored as follows: + volumes 0-2: W1111, W2222, W3333 + volumes 3-8: W1112, W1113, W1222, W1333, W2223, W2333 + volumes 9-11: W1122, W1133, W2233 + volumes 12-14: W1123, W1223, W1233 + + + References + ---------- + + References based on fitting algorithm used: + + * OLS, WLS: + Basser, P.J.; Mattiello, J.; LeBihan, D. Estimation of the effective self-diffusion tensor from the NMR spin echo. J Magn Reson B., 1994, 103, 247–254. + + * IWLS: + Veraart, J.; Sijbers, J.; Sunaert, S.; Leemans, A. & Jeurissen, B. Weighted linear least squares estimation of diffusion MRI parameters: strengths, limitations, and pitfalls. NeuroImage, 2013, 81, 335-346 + + * any of above with constraints: + Morez, J.; Szczepankiewicz, F; den Dekker, A. J.; Vanhevel, F.; Sijbers, J. & Jeurissen, B. Optimal experimental design and estimation for q-space trajectory imaging. Human Brain Mapping, 2023, 44, 1793-1809 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Ben Jeurissen (ben.jeurissen@uantwerpen.be) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "dwi2tensor" + + # Arguments + dwi: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input dwi image.""", + ) + + # Options + ols: bool = shell.arg( + default=False, + argstr="-ols", + help="""perform initial fit using an ordinary least-squares (OLS) fit (see Description).""", + ) + iter: int | None = shell.arg( + default=None, + argstr="-iter", + help="""number of iterative reweightings for IWLS algorithm (default: 2) (see Description).""", + ) + constrain: bool = shell.arg( + default=False, + argstr="-constrain", + help="""constrain fit to non-negative diffusivity and kurtosis as well as monotonic signal decay (see Description).""", + ) + directions: File | None = shell.arg( + default=None, + argstr="-directions", + help="""specify the directions along which to apply the constraints (by default, the built-in 300 direction set is used). These should be supplied as a text file containing [ az el ] pairs for the directions.""", + ) + mask: ImageIn | None = shell.arg( + default=None, + argstr="-mask", + help="""only perform computation within the specified binary brain mask image.""", + ) + + # DW gradient table import options: + grad: File | None = shell.arg( + default=None, + argstr="-grad", + help="""Provide the diffusion-weighted gradient scheme used in the acquisition in a text file. This should be supplied as a 4xN text file with each line in the format [ X Y Z b ], where [ X Y Z ] describe the direction of the applied gradient, and b gives the b-value in units of s/mm^2. If a diffusion gradient scheme is present in the input image header, the data provided with this option will be instead used.""", + ) + fslgrad: tuple[File, File] | None = shell.arg( + default=None, + argstr="-fslgrad", + help="""Provide the diffusion-weighted gradient scheme used in the acquisition in FSL bvecs/bvals format files. If a diffusion gradient scheme is present in the input image header, the data provided with this option will be instead used.""", + sep=" ", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + dt: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="dt.mif", + help="""the output dt image.""", + ) + b0: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-b0", + path_template="b0.mif", + help="""the output b0 image.""", + ) + dkt: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-dkt", + path_template="dkt.mif", + help="""the output dkt image.""", + ) + predicted_signal: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-predicted_signal", + path_template="predicted_signal.mif", + help="""the predicted dwi image.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwibiascorrect_ants.py b/pydra/tasks/mrtrix3/v3_1/dwibiascorrect_ants.py new file mode 100644 index 0000000..c58107b --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwibiascorrect_ants.py @@ -0,0 +1,150 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class DwiBiascorrect_Ants(shell.Task["DwiBiascorrect_Ants.Outputs"]): + """ + + References + ---------- + + * Tustison, N.; Avants, B.; Cook, P.; Zheng, Y.; Egan, A.; Yushkevich, P. & Gee, J. N4ITK: Improved N3 Bias Correction. IEEE Transactions on Medical Imaging, 2010, 29, 1310-1320 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwibiascorrect", "ants") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input image series to be corrected", + ) + ants_b: str | None = shell.arg( + help="N4BiasFieldCorrection option -b: [initial mesh resolution in mm, spline order] This value is optimised for human adult data and needs to be adjusted for rodent data.", + argstr="-ants_b", + default=None, + ) + ants_c: str | None = shell.arg( + help="N4BiasFieldCorrection option -c: [numberOfIterations,convergenceThreshold]", + argstr="-ants_c", + default=None, + ) + ants_s: str | None = shell.arg( + help="N4BiasFieldCorrection option -s: shrink-factor applied to spatial dimensions", + argstr="-ants_s", + default=None, + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + mask: ImageIn | None = shell.arg( + help="Manually provide an input mask image for bias field estimation", + argstr="-mask", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output corrected image series", + path_template="out_file.mif", + ) + bias: ImageOut | None = shell.outarg( + help="Output an image containing the estimated bias field", + argstr="-bias", + default=None, + path_template="bias.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwibiascorrect_fsl.py b/pydra/tasks/mrtrix3/v3_1/dwibiascorrect_fsl.py new file mode 100644 index 0000000..7742e97 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwibiascorrect_fsl.py @@ -0,0 +1,137 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class DwiBiascorrect_Fsl(shell.Task["DwiBiascorrect_Fsl.Outputs"]): + """ + + References + ---------- + + * Zhang, Y.; Brady, M. & Smith, S. Segmentation of brain MR images through a hidden Markov random field model and the expectation-maximization algorithm. IEEE Transactions on Medical Imaging, 2001, 20, 45-57 + + * 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 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwibiascorrect", "fsl") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input image series to be corrected", + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + mask: ImageIn | None = shell.arg( + help="Manually provide an input mask image for bias field estimation", + argstr="-mask", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output corrected image series", + path_template="out_file.mif", + ) + bias: ImageOut | None = shell.outarg( + help="Output an image containing the estimated bias field", + argstr="-bias", + default=None, + path_template="bias.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwibiascorrect_mtnorm.py b/pydra/tasks/mrtrix3/v3_1/dwibiascorrect_mtnorm.py new file mode 100644 index 0000000..db10345 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwibiascorrect_mtnorm.py @@ -0,0 +1,144 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class DwiBiascorrect_Mtnorm(shell.Task["DwiBiascorrect_Mtnorm.Outputs"]): + """ + + References + ---------- + + * Jeurissen, B; Tournier, J-D; Dhollander, T; Connelly, A & Sijbers, J. Multi-tissue constrained spherical deconvolution for improved analysis of multi-shell diffusion MRI data. NeuroImage, 2014, 103, 411-426 + + * Raffelt, D.; Dhollander, T.; Tournier, J.-D.; Tabbara, R.; Smith, R. E.; Pierre, E. & Connelly, A. Bias Field Correction and Intensity Normalisation for Quantitative Analysis of Apparent Fibre Density. In Proc. ISMRM, 2017, 26, 3541 + + * Dhollander, T.; Tabbara, R.; Rosnarho-Tornstrand, J.; Tournier, J.-D.; Raffelt, D. & Connelly, A. Multi-tissue log-domain intensity and inhomogeneity normalisation for quantitative apparent fibre density. In Proc. ISMRM, 2021, 29, 2472 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) and Arshiya Sangchooli (asangchooli@student.unimelb.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwibiascorrect", "mtnorm") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input image series to be corrected", + ) + lmax: typing.List[int] | None = shell.arg( + help='The maximum spherical harmonic degree for the estimated FODs (see Description); defaults are "4,0,0" for multi-shell and "4,0" for single-shell data)', + argstr="-lmax", + default=None, + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + mask: ImageIn | None = shell.arg( + help="Manually provide an input mask image for bias field estimation", + argstr="-mask", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output corrected image series", + path_template="out_file.mif", + ) + bias: ImageOut | None = shell.outarg( + help="Output an image containing the estimated bias field", + argstr="-bias", + default=None, + path_template="bias.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwibiasnormmask.py b/pydra/tasks/mrtrix3/v3_1/dwibiasnormmask.py new file mode 100644 index 0000000..e17be76 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwibiasnormmask.py @@ -0,0 +1,192 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define(xor=[["info", "quiet", "debug", None], ["grad", "fslgrad", None]]) +class DwiBiasnormmask(shell.Task["DwiBiasnormmask.Outputs"]): + """ + + References + ---------- + + * Jeurissen, B; Tournier, J-D; Dhollander, T; Connelly, A & Sijbers, J. Multi-tissue constrained spherical deconvolution for improved analysis of multi-shell diffusion MRI data. NeuroImage, 2014, 103, 411-426 + + * Raffelt, D.; Dhollander, T.; Tournier, J.-D.; Tabbara, R.; Smith, R. E.; Pierre, E. & Connelly, A. Bias Field Correction and Intensity Normalisation for Quantitative Analysis of Apparent Fibre Density. In Proc. ISMRM, 2017, 26, 3541 + + * Dhollander, T.; Raffelt, D. & Connelly, A. Unsupervised 3-tissue response function estimation from single-shell or multi-shell diffusion MR data without a co-registered T1 image. ISMRM Workshop on Breaking the Barriers of Diffusion MRI, 2016, 5 + + * Dhollander, T.; Tabbara, R.; Rosnarho-Tornstrand, J.; Tournier, J.-D.; Raffelt, D. & Connelly, A. Multi-tissue log-domain intensity and inhomogeneity normalisation for quantitative apparent fibre density. In Proc. ISMRM, 2021, 29, 2472 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) and Arshiya Sangchooli (asangchooli@student.unimelb.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = "dwibiasnormmask" + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input DWI series to be corrected", + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + dice: float | None = shell.arg( + help="Set the Dice coefficient threshold for similarity of masks between sequential iterations that will result in termination due to convergence; default = 0.999", + argstr="-dice", + default=None, + ) + init_mask: ImageIn | None = shell.arg( + help="Provide an initial mask for the first iteration of the algorithm (if not provided, the default dwi2mask algorithm will be used)", + argstr="-init_mask", + default=None, + ) + max_iters: int | None = shell.arg( + help="The maximum number of iterations (see Description); default is 2; set to 0 to proceed until convergence", + argstr="-max_iters", + default=None, + ) + mask_algo: str | None = shell.arg( + help="The algorithm to use for mask estimation, potentially based on the ODF sum image (see Description); default: threshold", + allowed_values=[ + "dwi2mask", + "fslbet", + "hdbet", + "mrthreshold", + "synthstrip", + "threshold", + ], + argstr="-mask_algo", + default=None, + ) + lmax: typing.List[int] | None = shell.arg( + help='The maximum spherical harmonic degree for the estimated FODs (see Description); defaults are "4,0,0" for multi-shell and "4,0" for single-shell data)', + argstr="-lmax", + default=None, + ) + reference: float | None = shell.arg( + help="Set the target CSF b=0 intensity in the output DWI series (default: 1000.0)", + argstr="-reference", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + output_dwi: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output corrected DWI series", + path_template="output_dwi.mif", + ) + output_mask: ImageOut = shell.outarg( + position=3, + argstr="", + help="The output DWI mask", + path_template="output_mask.mif", + ) + output_bias: ImageOut | None = shell.outarg( + help="Export the final estimated bias field to an image", + argstr="-output_bias", + default=None, + path_template="output_bias.mif", + ) + output_scale: File | None = shell.outarg( + help="Write the scaling factor applied to the DWI series to a text file", + argstr="-output_scale", + default=None, + path_template="output_scale.txt", + ) + output_tissuesum: ImageOut | None = shell.outarg( + help="Export the tissue sum image that was used to generate the final mask", + argstr="-output_tissuesum", + default=None, + path_template="output_tissuesum.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwicat.py b/pydra/tasks/mrtrix3/v3_1/dwicat.py new file mode 100644 index 0000000..11a2ca2 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwicat.py @@ -0,0 +1,122 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define(xor=[["info", "quiet", "debug", None]]) +class DwiCat(shell.Task["DwiCat.Outputs"]): + """ + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **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) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = "dwicat" + + inputs: ImageIn = shell.arg( + position=1, + argstr="", + help="Multiple input diffusion MRI series", + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + mask: ImageIn | None = shell.arg( + help="Provide a binary mask within which image intensities will be matched", + argstr="-mask", + default=None, + ) + nointensity: bool = shell.arg( + help="Do not perform intensity matching based on b=0 volumes", + argstr="-nointensity", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output image series (all DWIs concatenated)", + path_template="out_file.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwidenoise.py b/pydra/tasks/mrtrix3/v3_1/dwidenoise.py new file mode 100644 index 0000000..a84c294 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwidenoise.py @@ -0,0 +1,143 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class DwiDenoise(shell.Task["DwiDenoise.Outputs"]): + """DWI data denoising and noise map estimation by exploiting data redundancy in the PCA domain using the prior knowledge that the eigenspectrum of random covariance matrices is described by the universal Marchenko-Pastur (MP) distribution. Fitting the MP distribution to the spectrum of patch-wise signal matrices hence provides an estimator of the noise level 'sigma', as was first shown in Veraart et al. (2016) and later improved in Cordero-Grande et al. (2019). This noise level estimate then determines the optimal cut-off for PCA denoising. + + Important note: image denoising must be performed as the first step of the image processing pipeline. The routine will fail if interpolation or smoothing has been applied to the data prior to denoising. + + Note that this function does not correct for non-Gaussian noise biases present in magnitude-reconstructed MRI images. If available, including the MRI phase data can reduce such non-Gaussian biases, and the command now supports complex input data. + + + References + ---------- + + Veraart, J.; Novikov, D.S.; Christiaens, D.; Ades-aron, B.; Sijbers, J. & Fieremans, E. Denoising of diffusion MRI using random matrix theory. NeuroImage, 2016, 142, 394-406, doi: 10.1016/j.neuroimage.2016.08.016 + + Veraart, J.; Fieremans, E. & Novikov, D.S. Diffusion MRI noise mapping using random matrix theory. Magn. Res. Med., 2016, 76(5), 1582-1593, doi: 10.1002/mrm.26059 + + Cordero-Grande, L.; Christiaens, D.; Hutter, J.; Price, A.N.; Hajnal, J.V. Complex diffusion-weighted image estimation via matrix recovery under general noise models. NeuroImage, 2019, 200, 391-404, doi: 10.1016/j.neuroimage.2019.06.039 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Daan Christiaens (daan.christiaens@kcl.ac.uk) and Jelle Veraart (jelle.veraart@nyumc.org) and J-Donald Tournier (jdtournier@gmail.com) + + Copyright: Copyright (c) 2016 New York University, University of Antwerp, and the MRtrix3 contributors + + Permission is hereby granted, free of charge, to any non-commercial entity ('Recipient') obtaining a copy of this software and associated documentation files (the 'Software'), to the Software solely for non-commercial research, including the rights to use, copy and modify the Software, subject to the following conditions: + + 1. The above copyright notice and this permission notice shall be included by Recipient in all copies or substantial portions of the Software. + + 2. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIESOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BELIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF ORIN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + 3. In no event shall NYU be liable for direct, indirect, special, incidental or consequential damages in connection with the Software. Recipient will defend, indemnify and hold NYU harmless from any claims or liability resulting from the use of the Software by recipient. + + 4. Neither anything contained herein nor the delivery of the Software to recipient shall be deemed to grant the Recipient any right or licenses under any patents or patent application owned by NYU. + + 5. The Software may only be used for non-commercial research and may not be used for clinical care. + + 6. Any publication by Recipient of research involving the Software shall cite the references listed below. + """ + + executable = "dwidenoise" + + # Arguments + dwi: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input diffusion-weighted image.""", + ) + + # Options + mask: ImageIn | None = shell.arg( + default=None, + argstr="-mask", + help="""Only process voxels within the specified binary brain mask image.""", + ) + extent: list[int] | None = shell.arg( + default=None, + argstr="-extent", + help="""Set the patch size of the denoising filter. By default, the command will select the smallest isotropic patch size that exceeds the number of DW images in the input data, e.g., 5x5x5 for data with <= 125 DWI volumes, 7x7x7 for data with <= 343 DWI volumes, etc.""", + sep=",", + ) + datatype: str | None = shell.arg( + default=None, + argstr="-datatype", + help="""Datatype for the eigenvalue decomposition (single or double precision). For complex input data, this will select complex float32 or complex float64 datatypes.""", + allowed_values=["float32", "float64"], + ) + estimator: str | None = shell.arg( + default=None, + argstr="-estimator", + help="""Select the noise level estimator (default = Exp2), either: +* Exp1: the original estimator used in Veraart et al. (2016), or +* Exp2: the improved estimator introduced in Cordero-Grande et al. (2019).""", + allowed_values=["exp1", "exp2"], + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="out.mif", + help="""the output denoised DWI image.""", + ) + noise: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-noise", + path_template="noise.mif", + help="""The output noise map, i.e., the estimated noise level 'sigma' in the data.Note that on complex input data, this will be the total noise level across real and imaginary channels, so a scale factor sqrt(2) applies.""", + ) + rank: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-rank", + path_template="rank.mif", + help="""The selected signal rank of the output denoised image.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwiextract.py b/pydra/tasks/mrtrix3/v3_1/dwiextract.py new file mode 100644 index 0000000..bcd9a1f --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwiextract.py @@ -0,0 +1,187 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class DwiExtract(shell.Task["DwiExtract.Outputs"]): + """ + Example usages + -------------- + + + Calculate the mean b=0 image from a 4D DWI series: + + `$ dwiextract dwi.mif - -bzero | mrmath - mean mean_bzero.mif -axis 3` + + The dwiextract command extracts all volumes for which the b-value is (approximately) zero; the resulting 4D image can then be provided to the mrmath command to calculate the mean intensity across volumes for each voxel. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) and Thijs Dhollander (thijs.dhollander@gmail.com) and Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "dwiextract" + + # Arguments + in_file: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input DW image.""", + ) + + # Options + bzero: bool = shell.arg( + default=False, + argstr="-bzero", + help="""Output b=0 volumes (instead of the diffusion weighted volumes, if -singleshell is not specified).""", + ) + no_bzero: bool = shell.arg( + default=False, + argstr="-no_bzero", + help="""Output only non b=0 volumes (default, if -singleshell is not specified).""", + ) + singleshell: bool = shell.arg( + default=False, + argstr="-singleshell", + help="""Force a single-shell (single non b=0 shell) output. This will include b=0 volumes, if present. Use with -bzero to enforce presence of b=0 volumes (error if not present) or with -no_bzero to exclude them.""", + ) + + # DW gradient table import options: + grad: File | None = shell.arg( + default=None, + argstr="-grad", + help="""Provide the diffusion-weighted gradient scheme used in the acquisition in a text file. This should be supplied as a 4xN text file with each line in the format [ X Y Z b ], where [ X Y Z ] describe the direction of the applied gradient, and b gives the b-value in units of s/mm^2. If a diffusion gradient scheme is present in the input image header, the data provided with this option will be instead used.""", + ) + fslgrad: tuple[File, File] | None = shell.arg( + default=None, + argstr="-fslgrad", + help="""Provide the diffusion-weighted gradient scheme used in the acquisition in FSL bvecs/bvals format files. If a diffusion gradient scheme is present in the input image header, the data provided with this option will be instead used.""", + sep=" ", + ) + + # DW shell selection options: + shells: list[float] | None = shell.arg( + default=None, + argstr="-shells", + help="""specify one or more b-values to use during processing, as a comma-separated list of the desired approximate b-values (b-values are clustered to allow for small deviations). Note that some commands are incompatible with multiple b-values, and will report an error if more than one b-value is provided. +WARNING: note that, even though the b=0 volumes are never referred to as a 'shell' in the literature, they still have to be explicitly included in the list of b-values as provided to the -shell option! Several algorithms that include the b=0 volumes in their computations may otherwise return an undesired result.""", + sep=",", + ) + + # DW gradient table export options: + + # Options for importing phase-encode tables: + import_pe_table: File | None = shell.arg( + default=None, + argstr="-import_pe_table", + help="""import a phase-encoding table from file""", + ) + import_pe_eddy: tuple[File, File] | None = shell.arg( + default=None, + argstr="-import_pe_eddy", + help="""import phase-encoding information from an EDDY-style config / index file pair""", + sep=" ", + ) + + # Options for selecting volumes based on phase-encoding: + pe: list[float] | None = shell.arg( + default=None, + argstr="-pe", + help="""select volumes with a particular phase encoding; this can be three comma-separated values (for i,j,k components of vector direction) or four (direction & total readout time)""", + sep=",", + ) + + # Stride options: + strides: ty.Any = shell.arg( + default=None, + argstr="-strides", + help="""specify the strides of the output data in memory; either as a comma-separated list of (signed) integers, or as a template image from which the strides shall be extracted and used. The actual strides produced will depend on whether the output image format can support it.""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="out_file.mif", + help="""the output image (diffusion-weighted volumes by default).""", + ) + export_grad_mrtrix: File | bool | None = shell.outarg( + default=None, + argstr="-export_grad_mrtrix", + path_template="export_grad_mrtrix.txt", + help="""export the diffusion-weighted gradient table to file in MRtrix format""", + ) + export_grad_fsl: tuple[File, File] | bool | None = shell.outarg( + default=None, + argstr="-export_grad_fsl", + path_template=( + "export_grad_fsl0.txt", + "export_grad_fsl1.txt", + ), + help="""export the diffusion-weighted gradient table to files in FSL (bvecs / bvals) format""", + sep=" ", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwifslpreproc.py b/pydra/tasks/mrtrix3/v3_1/dwifslpreproc.py new file mode 100644 index 0000000..bcc2a8e --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwifslpreproc.py @@ -0,0 +1,246 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define( + xor=[ + ["info", "quiet", "debug", None], + ["topup_files", "se_epi", None], + ["topup_files", "align_seepi", None], + ["topup_files", "topup_options", None], + ["eddyqc_text", "eddyqc_all", None], + ["export_grad_mrtrix", "export_grad_fsl", None], + ["grad", "fslgrad", None], + ["rpe_none", "rpe_pair", "rpe_all", "rpe_header"], + ["rpe_none", "se_epi", None], + ["rpe_pair", "topup_files", None], + ["se_epi", "topup_files", None], + ["rpe_header", "pe_dir", None], + ["rpe_header", "readout_time", None], + ] +) +class DwiFslpreproc(shell.Task["DwiFslpreproc.Outputs"]): + """ + + References + ---------- + + * Andersson, J. L. & Sotiropoulos, S. N. An integrated approach to correction for off-resonance effects and subject movement in diffusion MR imaging. NeuroImage, 2015, 125, 1063-1078 + + * 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 + + * If performing recombination of diffusion-weighted volume pairs with opposing phase encoding directions: Skare, S. & Bammer, R. Jacobian weighting of distortion corrected EPI data. Proceedings of the International Society for Magnetic Resonance in Medicine, 2010, 5063 + + * If performing EPI susceptibility distortion correction: Andersson, J. L.; Skare, S. & Ashburner, J. How to correct susceptibility distortions in spin-echo echo-planar images: application to diffusion tensor imaging. NeuroImage, 2003, 20, 870-888 + + * If including "--repol" in -eddy_options input: 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 + + * If including "--mporder" in -eddy_options input: 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 + + * If using -eddyqc_text or -eddyqc_all option and eddy_quad is installed: 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 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = "dwifslpreproc" + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input DWI series to be corrected", + ) + rpe_none: bool = shell.arg( + help="Specify that no reversed phase-encoding image data is being provided; eddy will perform eddy current and motion correction only", + argstr="-rpe_none", + default=False, + ) + rpe_pair: bool = shell.arg( + help="Specify that a set of images (typically b=0 volumes) will be provided for use in inhomogeneity field estimation only (using the -se_epi option)", + argstr="-rpe_pair", + default=False, + ) + rpe_all: bool = shell.arg( + help="Specify that ALL DWIs have been acquired with opposing phase-encoding", + argstr="-rpe_all", + default=False, + ) + rpe_header: bool = shell.arg( + help="Specify that the phase-encoding information can be found in the image header(s), and that this is the information that the script should use", + argstr="-rpe_header", + default=False, + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + eddy_mask: ImageIn | None = shell.arg( + help="Provide a processing mask to use for eddy, instead of having dwifslpreproc generate one internally using dwi2mask", + argstr="-eddy_mask", + default=None, + ) + eddy_slspec: File | None = shell.arg( + help="Provide a file containing slice groupings for eddy's slice-to-volume registration", + argstr="-eddy_slspec", + default=None, + ) + eddy_options: str | None = shell.arg( + 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)", + argstr="-eddy_options", + default=None, + ) + se_epi: ImageIn | None = shell.arg( + 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)", + argstr="-se_epi", + default=None, + ) + align_seepi: bool = shell.arg( + help="Achieve alignment between the SE-EPI images used for inhomogeneity field estimation and the DWIs (more information in Description section)", + argstr="-align_seepi", + default=False, + ) + topup_options: str | None = shell.arg( + 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)", + argstr="-topup_options", + default=None, + ) + topup_files: str | None = shell.arg( + help='Provide files generated by prior execution of the FSL "topup" command to be utilised by eddy', + argstr="-topup_files", + default=None, + ) + pe_dir: str | None = shell.arg( + 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)", + argstr="-pe_dir", + default=None, + ) + readout_time: float | None = shell.arg( + help="Manually specify the total readout time of the input series (in seconds)", + argstr="-readout_time", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + json_import: File | None = shell.arg( + help="Import image header information from an associated JSON file (may be necessary to determine phase encoding information)", + argstr="-json_import", + default=None, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output corrected image series", + path_template="out_file.mif", + ) + export_grad_mrtrix: File | None = shell.outarg( + help="Export the final gradient table in MRtrix format", + argstr="-export_grad_mrtrix", + default=None, + path_template="export_grad_mrtrix.txt", + ) + export_grad_fsl: File | None = shell.outarg( + help="Export the final gradient table in FSL bvecs/bvals format", + argstr="-export_grad_fsl", + default=None, + path_template="export_grad_fsl.txt", + ) + eddyqc_text: Directory | None = shell.outarg( + help="Copy the various text-based statistical outputs generated by eddy, and the output of eddy_qc (if installed), into an output directory", + argstr="-eddyqc_text", + default=None, + path_template="eddyqc_text", + ) + eddyqc_all: Directory | None = shell.outarg( + help="Copy ALL outputs generated by eddy (including images), and the output of eddy_qc (if installed), into an output directory", + argstr="-eddyqc_all", + default=None, + path_template="eddyqc_all", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwigradcheck.py b/pydra/tasks/mrtrix3/v3_1/dwigradcheck.py new file mode 100644 index 0000000..7213cab --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwigradcheck.py @@ -0,0 +1,146 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define( + xor=[ + ["info", "quiet", "debug", None], + ["export_grad_mrtrix", "export_grad_fsl", None], + ["grad", "fslgrad", None], + ] +) +class DwiGradcheck(shell.Task["DwiGradcheck.Outputs"]): + """ + + References + ---------- + + * 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 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = "dwigradcheck" + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input DWI series to be checked", + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + mask: ImageIn | None = shell.arg( + help="Provide a mask image within which to seed & constrain tracking", + argstr="-mask", + default=None, + ) + number: int | None = shell.arg( + help="Set the number of tracks to generate for each test", + argstr="-number", + default=None, + ) + + class Outputs(shell.Outputs): + export_grad_mrtrix: File | None = shell.outarg( + help="Export the final gradient table in MRtrix format", + argstr="-export_grad_mrtrix", + default=None, + path_template="export_grad_mrtrix.txt", + ) + export_grad_fsl: File | None = shell.outarg( + help="Export the final gradient table in FSL bvecs/bvals format", + argstr="-export_grad_fsl", + default=None, + path_template="export_grad_fsl.txt", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwinormalise_group.py b/pydra/tasks/mrtrix3/v3_1/dwinormalise_group.py new file mode 100644 index 0000000..a8016d6 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwinormalise_group.py @@ -0,0 +1,134 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class DwiNormalise_Group(shell.Task["DwiNormalise_Group.Outputs"]): + """ + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** David Raffelt (david.raffelt@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwinormalise", "group") + + input_dir: Directory = shell.arg( + position=1, + argstr="", + help="The input directory containing all DWI images", + ) + mask_dir: Directory = shell.arg( + position=2, + argstr="", + help="Input directory containing brain masks, corresponding to one per input image (with the same file name prefix)", + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + fa_threshold: float | None = shell.arg( + help="The threshold applied to the Fractional Anisotropy group template used to derive an approximate white matter mask (default: 0.4)", + argstr="-fa_threshold", + default=None, + ) + + class Outputs(shell.Outputs): + output_dir: Directory = shell.outarg( + position=3, + argstr="", + help="The output directory containing all of the intensity normalised DWI images", + path_template="output_dir", + ) + fa_template: ImageOut = shell.outarg( + position=4, + argstr="", + help="The output population-specific FA template, which is thresholded to estimate a white matter mask", + path_template="fa_template.mif", + ) + wm_mask: ImageOut = shell.outarg( + position=5, + argstr="", + help="The output white matter mask (in template space), used to estimate the median b=0 white matter value for normalisation", + path_template="wm_mask.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwinormalise_manual.py b/pydra/tasks/mrtrix3/v3_1/dwinormalise_manual.py new file mode 100644 index 0000000..fadd9d3 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwinormalise_manual.py @@ -0,0 +1,137 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define(xor=[["grad", "fslgrad", None]]) +class DwiNormalise_Manual(shell.Task["DwiNormalise_Manual.Outputs"]): + """ + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) and David Raffelt (david.raffelt@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwinormalise", "manual") + + input_dwi: ImageIn = shell.arg( + position=1, + argstr="", + help="The input DWI series", + ) + input_mask: ImageIn = shell.arg( + position=2, + argstr="", + help="The mask within which a reference b=0 intensity will be sampled", + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + intensity: float | None = shell.arg( + help="Normalise the b=0 signal to a specified value (Default: 1000)", + argstr="-intensity", + default=None, + ) + percentile: float | None = shell.arg( + help="Define the percentile of the b=0 image intensties within the mask used for normalisation; if this option is not supplied then the median value (50th percentile) will be normalised to the desired intensity value", + argstr="-percentile", + default=None, + ) + + class Outputs(shell.Outputs): + output_dwi: ImageOut = shell.outarg( + position=3, + argstr="", + help="The output intensity-normalised DWI series", + path_template="output_dwi.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwinormalise_mtnorm.py b/pydra/tasks/mrtrix3/v3_1/dwinormalise_mtnorm.py new file mode 100644 index 0000000..cfac264 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwinormalise_mtnorm.py @@ -0,0 +1,151 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define(xor=[["grad", "fslgrad", None]]) +class DwiNormalise_Mtnorm(shell.Task["DwiNormalise_Mtnorm.Outputs"]): + """ + + References + ---------- + + * Jeurissen, B; Tournier, J-D; Dhollander, T; Connelly, A & Sijbers, J. Multi-tissue constrained spherical deconvolution for improved analysis of multi-shell diffusion MRI data. NeuroImage, 2014, 103, 411-426 + + * Raffelt, D.; Dhollander, T.; Tournier, J.-D.; Tabbara, R.; Smith, R. E.; Pierre, E. & Connelly, A. Bias Field Correction and Intensity Normalisation for Quantitative Analysis of Apparent Fibre Density. In Proc. ISMRM, 2017, 26, 3541 + + * Dhollander, T.; Tabbara, R.; Rosnarho-Tornstrand, J.; Tournier, J.-D.; Raffelt, D. & Connelly, A. Multi-tissue log-domain intensity and inhomogeneity normalisation for quantitative apparent fibre density. In Proc. ISMRM, 2021, 29, 2472 + + * Dhollander, T.; Raffelt, D. & Connelly, A. Unsupervised 3-tissue response function estimation from single-shell or multi-shell diffusion MR data without a co-registered T1 image. ISMRM Workshop on Breaking the Barriers of Diffusion MRI, 2016, 5 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) and Arshiya Sangchooli (asangchooli@student.unimelb.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("dwinormalise", "mtnorm") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input DWI series", + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + lmax: typing.List[int] | None = shell.arg( + help='The maximum spherical harmonic degree for the estimated FODs (see Description); defaults are "4,0,0" for multi-shell and "4,0" for single-shell data)', + argstr="-lmax", + default=None, + ) + mask: ImageIn | None = shell.arg( + help="Provide a mask image for relevant calculations (if not provided, the default dwi2mask algorithm will be used)", + argstr="-mask", + default=None, + ) + reference: float | None = shell.arg( + help="Set the target CSF b=0 intensity in the output DWI series (default: 1000)", + argstr="-reference", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The normalised DWI series", + path_template="out_file.mif", + ) + scale: File | None = shell.outarg( + help="Write the scaling factor applied to the DWI series to a text file", + argstr="-scale", + default=None, + path_template="scale.txt", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/dwishellmath.py b/pydra/tasks/mrtrix3/v3_1/dwishellmath.py new file mode 100644 index 0000000..9688daa --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/dwishellmath.py @@ -0,0 +1,141 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define(xor=[["info", "quiet", "debug", None], ["grad", "fslgrad", None]]) +class DwiShellmath(shell.Task["DwiShellmath.Outputs"]): + """ + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Daan Christiaens (daan.christiaens@kcl.ac.uk) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = "dwishellmath" + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input diffusion MRI series", + ) + operation: str = shell.arg( + position=2, + argstr="", + help="The operation to be applied to each shell; this must be one of the following: mean, median, sum, product, rms, norm, var, std, min, max, absmax, magmax", + allowed_values=[ + "mean", + "median", + "sum", + "product", + "rms", + "norm", + "var", + "std", + "min", + "max", + "absmax", + "magmax", + ], + ) + grad: File | None = shell.arg( + help="Provide the diffusion gradient table in MRtrix format", + argstr="-grad", + default=None, + ) + fslgrad: File | None = shell.arg( + help="Provide the diffusion gradient table in FSL bvecs/bvals format", + argstr="-fslgrad", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=3, + argstr="", + help="The output image series", + path_template="out_file.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/fivett2gmwmi.py b/pydra/tasks/mrtrix3/v3_1/fivett2gmwmi.py new file mode 100644 index 0000000..5704da8 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/fivett2gmwmi.py @@ -0,0 +1,100 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Fivett2Gmwmi(shell.Task["Fivett2Gmwmi.Outputs"]): + """ + References + ---------- + + 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 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "5tt2gmwmi" + + # Arguments + in_5tt: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input 5TT segmented anatomical image""", + ) + + # Options + mask_in: ImageIn | None = shell.arg( + default=None, + argstr="-mask_in", + help="""Filter an input mask image according to those voxels that lie upon the grey matter - white matter boundary. If no input mask is provided, the output will be a whole-brain mask image calculated using the anatomical image only.""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + mask_out: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="mask_out.mif", + help="""the output mask image""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/fivett2vis.py b/pydra/tasks/mrtrix3/v3_1/fivett2vis.py new file mode 100644 index 0000000..079966e --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/fivett2vis.py @@ -0,0 +1,123 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Fivett2Vis(shell.Task["Fivett2Vis.Outputs"]): + """ + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "5tt2vis" + + # Arguments + in_file: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input 4D tissue-segmented image""", + ) + + # Options + bg: float | None = shell.arg( + default=None, + argstr="-bg", + help="""image intensity of background (default: 0)""", + ) + cgm: float | None = shell.arg( + default=None, + argstr="-cgm", + help="""image intensity of cortical grey matter (default: 0.5)""", + ) + sgm: float | None = shell.arg( + default=None, + argstr="-sgm", + help="""image intensity of sub-cortical grey matter (default: 0.75)""", + ) + wm: float | None = shell.arg( + default=None, + argstr="-wm", + help="""image intensity of white matter (default: 1)""", + ) + csf: float | None = shell.arg( + default=None, + argstr="-csf", + help="""image intensity of CSF (default: 0.15)""", + ) + path: float | None = shell.arg( + default=None, + argstr="-path", + help="""image intensity of pathological tissue (default: 2)""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="out_file.mif", + help="""the output 3D image for visualisation""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/fivettcheck.py b/pydra/tasks/mrtrix3/v3_1/fivettcheck.py new file mode 100644 index 0000000..0f5a7a6 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/fivettcheck.py @@ -0,0 +1,93 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class FivettCheck(shell.Task["FivettCheck.Outputs"]): + """ + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "5ttcheck" + + # Arguments + in_file: MultiInputObj[ImageIn] = shell.arg( + argstr="", + position=1, + help="""the 5TT image(s) to be tested""", + ) + + # Options + voxels: str | None = shell.arg( + default=None, + argstr="-voxels", + help="""output mask images highlighting voxels where the input does not conform to 5TT requirements""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + pass diff --git a/pydra/tasks/mrtrix3/v3_1/fivettedit.py b/pydra/tasks/mrtrix3/v3_1/fivettedit.py new file mode 100644 index 0000000..cc5f4bb --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/fivettedit.py @@ -0,0 +1,123 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class FivettEdit(shell.Task["FivettEdit.Outputs"]): + """ + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "5ttedit" + + # Arguments + in_file: ImageIn = shell.arg( + argstr="", + position=1, + help="""the 5TT image to be modified""", + ) + + # Options + cgm: ImageIn | None = shell.arg( + default=None, + argstr="-cgm", + help="""provide a mask of voxels that should be set to cortical grey matter""", + ) + sgm: ImageIn | None = shell.arg( + default=None, + argstr="-sgm", + help="""provide a mask of voxels that should be set to sub-cortical grey matter""", + ) + wm: ImageIn | None = shell.arg( + default=None, + argstr="-wm", + help="""provide a mask of voxels that should be set to white matter""", + ) + csf: ImageIn | None = shell.arg( + default=None, + argstr="-csf", + help="""provide a mask of voxels that should be set to CSF""", + ) + path: ImageIn | None = shell.arg( + default=None, + argstr="-path", + help="""provide a mask of voxels that should be set to pathological tissue""", + ) + none: ImageIn | None = shell.arg( + default=None, + argstr="-none", + help="""provide a mask of voxels that should be cleared (i.e. are non-brain); note that this will supersede all other provided masks""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="out_file.mif", + help="""the output modified 5TT image""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/fivettgen_deep_atropos.py b/pydra/tasks/mrtrix3/v3_1/fivettgen_deep_atropos.py new file mode 100644 index 0000000..96fa986 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/fivettgen_deep_atropos.py @@ -0,0 +1,131 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class FivettGen_Deep_atropos(shell.Task["FivettGen_Deep_atropos.Outputs"]): + """ + + References + ---------- + + * 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 + + * N.J. Tustison, P.A. Cook, A.J. Holbrook, H.J. Johnson, J. Muschelli, G.A. Devenyi, J.T. Duda, S.R. Das, N.C. Cullen, D.L. Gillen, M.A. Yassa, J.R. Stone, J.C. Gee, and B.B. Avants. The ANTsX ecosystem for quantitative biological and medical imaging. Scientific Reports, 11(1):9068 (2021), pp. 1-13. + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Lucius S. Fekonja (lucius.fekonja[at]charite.de) and Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("5ttgen", "deep_atropos") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input Deep Atropos segmentation image", + ) + nocrop: bool = shell.arg( + help="Do NOT crop the resulting 5TT image to reduce its size (keep the same dimensions as the input image)", + argstr="-nocrop", + default=False, + ) + sgm_amyg_hipp: bool = shell.arg( + help="Represent the amygdalae and hippocampi as sub-cortical grey matter in the 5TT image", + argstr="-sgm_amyg_hipp", + default=False, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + white_stem: bool = shell.arg( + help="Classify the brainstem as white matter", + argstr="-white_stem", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output 5TT image", + path_template="out_file.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/fivettgen_freesurfer.py b/pydra/tasks/mrtrix3/v3_1/fivettgen_freesurfer.py new file mode 100644 index 0000000..b254e85 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/fivettgen_freesurfer.py @@ -0,0 +1,129 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class FivettGen_Freesurfer(shell.Task["FivettGen_Freesurfer.Outputs"]): + """ + + References + ---------- + + * 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 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("5ttgen", "freesurfer") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help='The input FreeSurfer parcellation image (any image containing "aseg" in its name)', + ) + lut: File | None = shell.arg( + help="Manually provide path to the lookup table on which the input parcellation image is based (e.g. FreeSurferColorLUT.txt)", + argstr="-lut", + default=None, + ) + nocrop: bool = shell.arg( + help="Do NOT crop the resulting 5TT image to reduce its size (keep the same dimensions as the input image)", + argstr="-nocrop", + default=False, + ) + sgm_amyg_hipp: bool = shell.arg( + help="Represent the amygdalae and hippocampi as sub-cortical grey matter in the 5TT image", + argstr="-sgm_amyg_hipp", + default=False, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output 5TT image", + path_template="out_file.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/fivettgen_fsl.py b/pydra/tasks/mrtrix3/v3_1/fivettgen_fsl.py new file mode 100644 index 0000000..b4d77fc --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/fivettgen_fsl.py @@ -0,0 +1,147 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define(xor=[["mask", "premasked", None]]) +class FivettGen_Fsl(shell.Task["FivettGen_Fsl.Outputs"]): + """ + + References + ---------- + + * 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 + + * Smith, S. M. Fast robust automated brain extraction. Human Brain Mapping, 2002, 17, 143-155 + + * Zhang, Y.; Brady, M. & Smith, S. Segmentation of brain MR images through a hidden Markov random field model and the expectation-maximization algorithm. IEEE Transactions on Medical Imaging, 2001, 20, 45-57 + + * 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 + + * 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 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("5ttgen", "fsl") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input T1-weighted image", + ) + t2: ImageIn | None = shell.arg( + help="Provide a T2-weighted image in addition to the default T1-weighted image; this will be used as a second input to FSL FAST", + argstr="-t2", + default=None, + ) + mask: ImageIn | None = shell.arg( + help="Manually provide a brain mask, rather than deriving one in the script", + argstr="-mask", + default=None, + ) + premasked: bool = shell.arg( + help="Indicate that brain masking has already been applied to the input image", + argstr="-premasked", + default=False, + ) + nocrop: bool = shell.arg( + help="Do NOT crop the resulting 5TT image to reduce its size (keep the same dimensions as the input image)", + argstr="-nocrop", + default=False, + ) + sgm_amyg_hipp: bool = shell.arg( + help="Represent the amygdalae and hippocampi as sub-cortical grey matter in the 5TT image", + argstr="-sgm_amyg_hipp", + default=False, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output 5TT image", + path_template="out_file.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/fivettgen_gif.py b/pydra/tasks/mrtrix3/v3_1/fivettgen_gif.py new file mode 100644 index 0000000..24a46dd --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/fivettgen_gif.py @@ -0,0 +1,124 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class FivettGen_Gif(shell.Task["FivettGen_Gif.Outputs"]): + """ + + References + ---------- + + * 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 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Matteo Mancini (m.mancini@ucl.ac.uk) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("5ttgen", "gif") + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input Geodesic Information Flow (GIF) segmentation image", + ) + nocrop: bool = shell.arg( + help="Do NOT crop the resulting 5TT image to reduce its size (keep the same dimensions as the input image)", + argstr="-nocrop", + default=False, + ) + sgm_amyg_hipp: bool = shell.arg( + help="Represent the amygdalae and hippocampi as sub-cortical grey matter in the 5TT image", + argstr="-sgm_amyg_hipp", + default=False, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output 5TT image", + path_template="out_file.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/fivettgen_hsvs.py b/pydra/tasks/mrtrix3/v3_1/fivettgen_hsvs.py new file mode 100644 index 0000000..f4630c9 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/fivettgen_hsvs.py @@ -0,0 +1,169 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define +class FivettGen_Hsvs(shell.Task["FivettGen_Hsvs.Outputs"]): + """ + + References + ---------- + + * 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 + + * Smith, R.; Skoch, A.; Bajada, C.; Caspers, S.; Connelly, A. Hybrid Surface-Volume Segmentation for improved Anatomically-Constrained Tractography. In Proc OHBM 2020 + + * Fischl, B. Freesurfer. NeuroImage, 2012, 62(2), 774-781 + + * If FreeSurfer hippocampal subfields module is utilised: Iglesias, J.E.; Augustinack, J.C.; Nguyen, K.; Player, C.M.; Player, A.; Wright, M.; Roy, N.; Frosch, M.P.; Mc Kee, A.C.; Wald, L.L.; Fischl, B.; and Van Leemput, K. A computational atlas of the hippocampal formation using ex vivo, ultra-high resolution MRI: Application to adaptive segmentation of in vivo MRI. NeuroImage, 2015, 115, 117-137 + + * If FreeSurfer hippocampal subfields module is utilised and includes amygdalae segmentation: Saygin, Z.M. & Kliemann, D.; Iglesias, J.E.; van der Kouwe, A.J.W.; Boyd, E.; Reuter, M.; Stevens, A.; Van Leemput, K.; Mc Kee, A.; Frosch, M.P.; Fischl, B.; Augustinack, J.C. High-resolution magnetic resonance imaging reveals nuclei of the human amygdala: manual segmentation to automatic atlas. NeuroImage, 2017, 155, 370-382 + + * If -thalami nuclei is used: Iglesias, J.E.; Insausti, R.; Lerma-Usabiaga, G.; Bocchetta, M.; Van Leemput, K.; Greve, D.N.; van der Kouwe, A.; ADNI; Fischl, B.; Caballero-Gaudes, C.; Paz-Alonso, P.M. A probabilistic atlas of the human thalamic nuclei combining ex vivo MRI and histology. NeuroImage, 2018, 183, 314-326 + + * If ACPCDetect is installed: Ardekani, B.; Bachman, A.H. Model-based automatic detection of the anterior and posterior commissures on MRI scans. NeuroImage, 2009, 46(3), 677-682 + + * If FSL FIRST is used for subcortical structures: 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 + + * If FSL is installed: Zhang, Y.; Brady, M. & Smith, S. Segmentation of brain MR images through a hidden Markov random field model and the expectation-maximization algorithm. IEEE Transactions on Medical Imaging, 2001, 20, 45-57 + + * If FSL is installed: 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 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = ("5ttgen", "hsvs") + + in_file: Directory = shell.arg( + position=1, + argstr="", + help="The input FreeSurfer subject directory", + ) + nocrop: bool = shell.arg( + help="Do NOT crop the resulting 5TT image to reduce its size (keep the same dimensions as the input image)", + argstr="-nocrop", + default=False, + ) + sgm_amyg_hipp: bool = shell.arg( + help="Represent the amygdalae and hippocampi as sub-cortical grey matter in the 5TT image", + argstr="-sgm_amyg_hipp", + default=False, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + freesurfer_lut: File | None = shell.arg( + help="Manually provide the path to the FreeSurfer lookup table file", + argstr="-freesurfer_lut", + default=None, + ) + template: ImageIn | None = shell.arg( + help="Provide an image that will form the template for the generated 5TT image", + argstr="-template", + default=None, + ) + hippocampi: str | None = shell.arg( + help="Select method to be used for hippocampi (& amygdalae) segmentation; options are: subfields,first,aseg", + allowed_values=["subfields", "first", "aseg"], + argstr="-hippocampi", + default=None, + ) + thalami: str | None = shell.arg( + help="Select method to be used for thalamic segmentation; options are: nuclei,first,aseg", + allowed_values=["nuclei", "first", "aseg"], + argstr="-thalami", + default=None, + ) + white_stem: bool = shell.arg( + help="Classify the brainstem as white matter", + argstr="-white_stem", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output 5TT image", + path_template="out_file.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/fixel2peaks.py b/pydra/tasks/mrtrix3/v3_1/fixel2peaks.py new file mode 100644 index 0000000..83336dc --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/fixel2peaks.py @@ -0,0 +1,108 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Fixel2Peaks(shell.Task["Fixel2Peaks.Outputs"]): + """If a fixel data file is provided as input, then the 3-vectors in the output image will be scaled based on the data in that file. If the input is instead the fixel directory, or the index or directions file, then all output 3-vectors will possess unit norm. + + Fixel data are stored utilising the fixel directory format described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/fixel_based_analysis/fixel_directory_format.html + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "fixel2peaks" + + # Arguments + in_: ty.Any = shell.arg( + argstr="", + position=1, + help="""the input fixel information""", + ) + + # Options + number: int | None = shell.arg( + default=None, + argstr="-number", + help="""maximum number of fixels in each voxel (default: based on input data)""", + ) + nan: bool = shell.arg( + default=False, + argstr="-nan", + help="""fill excess peak data with NaNs rather than zeroes""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="out.mif", + help="""the output peaks image""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/fixel2sh.py b/pydra/tasks/mrtrix3/v3_1/fixel2sh.py new file mode 100644 index 0000000..4da23d7 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/fixel2sh.py @@ -0,0 +1,106 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Fixel2Sh(shell.Task["Fixel2Sh.Outputs"]): + """This command generates spherical harmonic data from fixels that can be visualised using the ODF tool in MRview. The output ODF lobes are scaled according to the values in the input fixel image. + + The spherical harmonic coefficients are stored according to the conventions described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/concepts/spherical_harmonics.html + + Fixel data are stored utilising the fixel directory format described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/fixel_based_analysis/fixel_directory_format.html + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) and David Raffelt (david.raffelt@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "fixel2sh" + + # Arguments + fixel_in: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input fixel data file.""", + ) + + # Options + lmax: int | None = shell.arg( + default=None, + argstr="-lmax", + help="""set the maximum harmonic order for the output series (Default: 8)""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + sh_out: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="sh_out.mif", + help="""the output sh image.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/fixel2tsf.py b/pydra/tasks/mrtrix3/v3_1/fixel2tsf.py new file mode 100644 index 0000000..d77044e --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/fixel2tsf.py @@ -0,0 +1,108 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Fixel2Tsf(shell.Task["Fixel2Tsf.Outputs"]): + """This command is useful for visualising all brain fixels (e.g. the output from fixelcfestats) in 3D. + + Fixel data are stored utilising the fixel directory format described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/fixel_based_analysis/fixel_directory_format.html + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "fixel2tsf" + + # Arguments + fixel_in: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input fixel data file (within the fixel directory)""", + ) + tracks: Tracks = shell.arg( + argstr="", + position=2, + help="""the input track file""", + ) + + # Options + angle: float | None = shell.arg( + default=None, + argstr="-angle", + help="""the max anglular threshold for computing correspondence between a fixel direction and track tangent (default = 45 degrees)""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + tsf: File = shell.outarg( + argstr="", + position=3, + path_template="tsf.txt", + help="""the output track scalar file""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/fixel2voxel.py b/pydra/tasks/mrtrix3/v3_1/fixel2voxel.py new file mode 100644 index 0000000..07f577c --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/fixel2voxel.py @@ -0,0 +1,148 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Fixel2Voxel(shell.Task["Fixel2Voxel.Outputs"]): + """Fixel data can be reduced to voxel data in a number of ways: + + - Some statistic computed across all fixel values within a voxel: mean, sum, product, min, max, absmax, magmax + + - The number of fixels in each voxel: count + + - Some measure of crossing-fibre organisation: complexity, sf ('single-fibre') + + - A 4D directionally-encoded colour image: dec_unit, dec_scaled + + - A 4D image containing all fixel data values in each voxel unmodified: none + + The -weighted option deals with the case where there is some per-fixel metric of interest that you wish to collapse into a single scalar measure per voxel, but each fixel possesses a different volume, and you wish for those fixels with greater volume to have a greater influence on the calculation than fixels with lesser volume. For instance, when estimating a voxel-based measure of mean axon diameter from per-fixel mean axon diameters, a fixel's mean axon diameter should be weigthed by its relative volume within the voxel in the calculation of that voxel mean. + + Fixel data are stored utilising the fixel directory format described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/fixel_based_analysis/fixel_directory_format.html + + + References + ---------- + + * Reference for 'complexity' operation: + Riffert, T. W.; Schreiber, J.; Anwander, A. & Knosche, T. R. Beyond Fractional Anisotropy: Extraction of bundle-specific structural metrics from crossing fibre models. NeuroImage, 2014, 100, 176-191 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) and David Raffelt (david.raffelt@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "fixel2voxel" + + # Arguments + fixel_in: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input fixel data file""", + ) + operation: str = shell.arg( + argstr="", + position=2, + help="""the operation to apply, one of: mean, sum, product, min, max, absmax, magmax, count, complexity, sf, dec_unit, dec_scaled, none.""", + allowed_values=[ + "mean", + "sum", + "product", + "min", + "max", + "absmax", + "magmax", + "count", + "complexity", + "sf", + "dec_unit", + "dec_scaled", + "none", + ], + ) + + # Options + number: int | None = shell.arg( + default=None, + argstr="-number", + help="""use only the largest N fixels in calculation of the voxel-wise statistic; in the case of operation "none", output only the largest N fixels in each voxel.""", + ) + fill: float | None = shell.arg( + default=None, + argstr="-fill", + help="""for "none" operation, specify the value to fill when number of fixels is fewer than the maximum (default: 0.0)""", + ) + weighted: ImageIn | None = shell.arg( + default=None, + argstr="-weighted", + help="""weight the contribution of each fixel to the per-voxel result according to its volume.""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + image_out: ImageOut = shell.outarg( + argstr="", + position=3, + path_template="image_out.mif", + help="""the output scalar image.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/fixelcfestats.py b/pydra/tasks/mrtrix3/v3_1/fixelcfestats.py new file mode 100644 index 0000000..5f111fd --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/fixelcfestats.py @@ -0,0 +1,242 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class FixelCfestats(shell.Task["FixelCfestats.Outputs"]): + """Unlike previous versions of this command, where a whole-brain tractogram file would be provided as input in order to generate the fixel-fixel connectivity matrix and smooth fixel data, this version expects to be provided with the directory path to a pre-calculated fixel-fixel connectivity matrix (likely generated using the MRtrix3 command fixelconnectivity), and for the input fixel data to have already been smoothed (likely using the MRtrix3 command fixelfilter). + + Note that if the -mask option is used, the output fixel directory will still contain the same set of fixels as that present in the input fixel template, in order to retain fixel correspondence. However a consequence of this is that all fixels in the template will be initialy visible when the output fixel directory is loaded in mrview. Those fixels outside the processing mask will immediately disappear from view as soon as any data-file-based fixel colouring or thresholding is applied. + + In some software packages, a column of ones is automatically added to the GLM design matrix; the purpose of this column is to estimate the "global intercept", which is the predicted value of the observed variable if all explanatory variables were to be zero. However there are rare situations where including such a column would not be appropriate for a particular experimental design. Hence, in MRtrix3 statistical inference commands, it is up to the user to determine whether or not this column of ones should be included in their design matrix, and add it explicitly if necessary. The contrast matrix must also reflect the presence of this additional column. + + Fixel data are stored utilising the fixel directory format described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/fixel_based_analysis/fixel_directory_format.html + + + References + ---------- + + Raffelt, D.; Smith, RE.; Ridgway, GR.; Tournier, JD.; Vaughan, DN.; Rose, S.; Henderson, R.; Connelly, A. Connectivity-based fixel enhancement: Whole-brain statistical analysis of diffusion MRI measures in the presence of crossing fibres.Neuroimage, 2015, 15(117):40-55 + + * If not using the -cfe_legacy option: + Smith, RE.; Dimond, D; Vaughan, D.; Parker, D.; Dhollander, T.; Jackson, G.; Connelly, A. Intrinsic non-stationarity correction for Fixel-Based Analysis. In Proc OHBM 2019 M789 + + * If using the -nonstationary option: + Salimi-Khorshidi, G. Smith, S.M. Nichols, T.E. Adjusting the effect of nonstationarity in cluster-based and TFCE inference. NeuroImage, 2011, 54(3), 2006-19 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) and Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "fixelcfestats" + + # Arguments + in_fixel_directory: Directory = shell.arg( + argstr="", + position=1, + help="""the fixel directory containing the data files for each subject (after obtaining fixel correspondence""", + ) + subjects: ImageIn = shell.arg( + argstr="", + position=2, + help="""a text file listing the subject identifiers (one per line). This should correspond with the filenames in the fixel directory (including the file extension), and be listed in the same order as the rows of the design matrix.""", + ) + design: File = shell.arg( + argstr="", + position=3, + help="""the design matrix""", + ) + contrast: File = shell.arg( + argstr="", + position=4, + help="""the contrast matrix, specified as rows of weights""", + ) + connectivity: ty.Any = shell.arg( + argstr="", + position=5, + help="""the fixel-fixel connectivity matrix""", + ) + out_fixel_directory: str = shell.arg( + argstr="", + position=6, + help="""the output directory where results will be saved. Will be created if it does not exist""", + ) + + # Options + mask: ImageIn | None = shell.arg( + default=None, + argstr="-mask", + help="""provide a fixel data file containing a mask of those fixels to be used during processing""", + ) + + # Options relating to shuffling of data for nonparametric statistical inference: + notest: bool = shell.arg( + default=False, + argstr="-notest", + help="""don't perform statistical inference; only output population statistics (effect size, stdev etc)""", + ) + errors: str | None = shell.arg( + default=None, + argstr="-errors", + help="""specify nature of errors for shuffling; options are: ee,ise,both (default: ee)""", + allowed_values=["ee", "ise", "both"], + ) + exchange_within: File | None = shell.arg( + default=None, + argstr="-exchange_within", + help="""specify blocks of observations within each of which data may undergo restricted exchange""", + ) + exchange_whole: File | None = shell.arg( + default=None, + argstr="-exchange_whole", + help="""specify blocks of observations that may be exchanged with one another (for independent and symmetric errors, sign-flipping will occur block-wise)""", + ) + strong: bool = shell.arg( + default=False, + argstr="-strong", + help="""use strong familywise error control across multiple hypotheses""", + ) + nshuffles: int | None = shell.arg( + default=None, + argstr="-nshuffles", + help="""the number of shuffles (default: 5000)""", + ) + permutations: File | None = shell.arg( + default=None, + argstr="-permutations", + help="""manually define the permutations (relabelling). The input should be a text file defining a m x n matrix, where each relabelling is defined as a column vector of size m, and the number of columns n defines the number of permutations. Can be generated with the palm_quickperms function in PALM (http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/PALM). Overrides the -nshuffles option.""", + ) + nonstationarity: bool = shell.arg( + default=False, + argstr="-nonstationarity", + help="""perform non-stationarity correction""", + ) + skew_nonstationarity: float | None = shell.arg( + default=None, + argstr="-skew_nonstationarity", + help="""specify the skew parameter for empirical statistic calculation (default for this command is 1)""", + ) + nshuffles_nonstationarity: int | None = shell.arg( + default=None, + argstr="-nshuffles_nonstationarity", + help="""the number of shuffles to use when precomputing the empirical statistic image for non-stationarity correction (default: 5000)""", + ) + permutations_nonstationarity: File | None = shell.arg( + default=None, + argstr="-permutations_nonstationarity", + help="""manually define the permutations (relabelling) for computing the emprical statistics for non-stationarity correction. The input should be a text file defining a m x n matrix, where each relabelling is defined as a column vector of size m, and the number of columns n defines the number of permutations. Can be generated with the palm_quickperms function in PALM (http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/PALM). Overrides the -nshuffles_nonstationarity option.""", + ) + + # Parameters for the Connectivity-based Fixel Enhancement algorithm: + cfe_dh: float | None = shell.arg( + default=None, + argstr="-cfe_dh", + help="""the height increment used in the cfe integration (default: 0.1)""", + ) + cfe_e: float | None = shell.arg( + default=None, + argstr="-cfe_e", + help="""cfe extent exponent (default: 2)""", + ) + cfe_h: float | None = shell.arg( + default=None, + argstr="-cfe_h", + help="""cfe height exponent (default: 3)""", + ) + cfe_c: float | None = shell.arg( + default=None, + argstr="-cfe_c", + help="""cfe connectivity exponent (default: 0.5)""", + ) + cfe_legacy: bool = shell.arg( + default=False, + argstr="-cfe_legacy", + help="""use the legacy (non-normalised) form of the cfe equation""", + ) + + # Options related to the General Linear Model (GLM): + variance: File | None = shell.arg( + default=None, + argstr="-variance", + help="""define variance groups for the G-statistic; measurements for which the expected variance is equivalent should contain the same index""", + ) + ftests: File | None = shell.arg( + default=None, + argstr="-ftests", + help="""perform F-tests; input text file should contain, for each F-test, a row containing ones and zeros, where ones indicate the rows of the contrast matrix to be included in the F-test.""", + ) + fonly: bool = shell.arg( + default=False, + argstr="-fonly", + help="""only assess F-tests; do not perform statistical inference on entries in the contrast matrix""", + ) + column: MultiInputObj[File] | None = shell.arg( + default=None, + argstr="-column", + help="""add a column to the design matrix corresponding to subject fixel-wise values (note that the contrast matrix must include an additional column for each use of this option); the text file provided via this option should contain a file name for each subject""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + pass diff --git a/pydra/tasks/mrtrix3/v3_1/fixelconnectivity.py b/pydra/tasks/mrtrix3/v3_1/fixelconnectivity.py new file mode 100644 index 0000000..b431da9 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/fixelconnectivity.py @@ -0,0 +1,139 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class FixelConnectivity(shell.Task["FixelConnectivity.Outputs"]): + """This command will generate a directory containing three images, which encodes the fixel-fixel connectivity matrix. Documentation regarding this format and how to use it will come in the future. + + Fixel data are stored utilising the fixel directory format described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/fixel_based_analysis/fixel_directory_format.html + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "fixelconnectivity" + + # Arguments + fixel_directory: Directory = shell.arg( + argstr="", + position=1, + help="""the directory containing the fixels between which connectivity will be quantified""", + ) + tracks: Tracks = shell.arg( + argstr="", + position=2, + help="""the tracks used to determine fixel-fixel connectivity""", + ) + + # Options + + # Options that influence generation of the connectivity matrix / matrices: + threshold: float | None = shell.arg( + default=None, + argstr="-threshold", + help="""a threshold to define the required fraction of shared connections to be included in the neighbourhood (default: 0.01)""", + ) + angle: float | None = shell.arg( + default=None, + argstr="-angle", + help="""the max angle threshold for assigning streamline tangents to fixels (Default: 45 degrees)""", + ) + mask: ImageIn | None = shell.arg( + default=None, + argstr="-mask", + help="""provide a fixel data file containing a mask of those fixels to be computed; fixels outside the mask will be empty in the output matrix""", + ) + tck_weights_in: File | None = shell.arg( + default=None, + argstr="-tck_weights_in", + help="""specify a text scalar file containing the streamline weights""", + ) + + # Options for additional outputs to be generated: + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + matrix: Directory = shell.outarg( + argstr="", + position=3, + path_template="matrix", + help="""the output fixel-fixel connectivity matrix directory path""", + ) + count: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-count", + path_template="count.mif", + help="""export a fixel data file encoding the number of connections for each fixel""", + ) + extent: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-extent", + path_template="extent.mif", + help="""export a fixel data file encoding the extent of connectivity (sum of weights) for each fixel""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/fixelconvert.py b/pydra/tasks/mrtrix3/v3_1/fixelconvert.py new file mode 100644 index 0000000..1e96811 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/fixelconvert.py @@ -0,0 +1,155 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class FixelConvert(shell.Task["FixelConvert.Outputs"]): + """Fixel data are stored utilising the fixel directory format described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/fixel_based_analysis/fixel_directory_format.html + + + Example usages + -------------- + + + Convert from the old file format to the new directory format: + + `$ fixelconvert old_fixels.msf new_fixels/ -out_size` + + This performs a simple conversion from old to new format, and additionally writes the contents of the "size" field within old-format fixel images stored using the "FixelMetric" class (likely all of them) as an additional fixel data file. + + + Convert multiple files from old to new format, preserving fixel correspondence: + + `$ for_each *.msf : fixelconvert IN NAME_new/ -template template_fixels/` + + In this example, the for_each script is used to execute the fixelconvert command once for each of a series of input files in the old fixel format, generating a new output fixel directory for each. Importantly here though, the -template option is used to ensure that the ordering of fixels within these output directories is identical, such that fixel data files can be exchanged between them (e.g. accumulating fixel data files across subjects into a single template fixel directory + + + Convert from the new directory format to the old file format: + + `$ fixelconvert new_fixels/ old_fixels.msf -value parameter.mif -in_size new_fixels/afd.mif` + + Conversion from the new directory format will contain the value 1.0 for all output fixels in both the "size" and "value" fields of the "FixelMetric" class, unless the -in_size and/or -value options are used respectively to indicate which fixel data files should be used as the source(s) of this information. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) and Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "fixelconvert" + + # Arguments + fixel_in: ty.Any = shell.arg( + argstr="", + position=1, + help="""the input fixel file / directory.""", + ) + fixel_out: ty.Any = shell.arg( + argstr="", + position=2, + help="""the output fixel file / directory.""", + ) + + # Options + + # Options for converting from old to new format: + name: str | None = shell.arg( + default=None, + argstr="-name", + help="""assign a different name to the value field output (Default: value). Do not include the file extension.""", + ) + nii: bool = shell.arg( + default=False, + argstr="-nii", + help="""output the index, directions and data file in NIfTI format instead of .mif""", + ) + out_size: bool = shell.arg( + default=False, + argstr="-out_size", + help="""also output the 'size' field from the old format""", + ) + template: Directory | None = shell.arg( + default=None, + argstr="-template", + help="""specify an existing fixel directory (in the new format) to which the new output should conform""", + ) + + # Options for converting from new to old format: + value: File | None = shell.arg( + default=None, + argstr="-value", + help="""nominate the data file to import to the 'value' field in the old format""", + ) + in_size: File | None = shell.arg( + default=None, + argstr="-in_size", + help="""import data for the 'size' field in the old format""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + pass diff --git a/pydra/tasks/mrtrix3/v3_1/fixelcorrespondence.py b/pydra/tasks/mrtrix3/v3_1/fixelcorrespondence.py new file mode 100644 index 0000000..4431c3c --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/fixelcorrespondence.py @@ -0,0 +1,113 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class FixelCorrespondence(shell.Task["FixelCorrespondence.Outputs"]): + """It is assumed that the subject image has already been spatially normalised and is aligned with the template. The output fixel image will have the same fixels (and directions) of the template. + + Fixel data are stored utilising the fixel directory format described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/fixel_based_analysis/fixel_directory_format.html + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "fixelcorrespondence" + + # Arguments + subject_data: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input subject fixel data file. This should be a file inside the fixel directory""", + ) + template_directory: Directory = shell.arg( + argstr="", + position=2, + help="""the input template fixel directory.""", + ) + output_directory: str = shell.arg( + argstr="", + position=3, + help="""the fixel directory where the output file will be written.""", + ) + output_data: str = shell.arg( + argstr="", + position=4, + help="""the name of the output fixel data file. This will be placed in the output fixel directory""", + ) + + # Options + angle: float | None = shell.arg( + default=None, + argstr="-angle", + help="""the max angle threshold for computing inter-subject fixel correspondence (Default: 45 degrees)""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + pass diff --git a/pydra/tasks/mrtrix3/v3_1/fixelcrop.py b/pydra/tasks/mrtrix3/v3_1/fixelcrop.py new file mode 100644 index 0000000..46d0139 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/fixelcrop.py @@ -0,0 +1,103 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class FixelCrop(shell.Task["FixelCrop.Outputs"]): + """The mask must be input as a fixel data file the same dimensions as the fixel data file(s) to be cropped. + + Fixel data are stored utilising the fixel directory format described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/fixel_based_analysis/fixel_directory_format.html + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) and Rami Tabarra (rami.tabarra@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "fixelcrop" + + # Arguments + input_fixel_directory: Directory = shell.arg( + argstr="", + position=1, + help="""input fixel directory; all data files and directions file will be cropped and saved in the output fixel directory""", + ) + input_fixel_mask: ImageIn = shell.arg( + argstr="", + position=2, + help="""the input fixel data file defining which fixels to crop. Fixels with zero values will be removed""", + ) + + # Options + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + output_fixel_directory: Directory = shell.outarg( + argstr="", + position=3, + path_template="output_fixel_directory", + help="""the output directory to store the cropped directions and data files""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/fixelfilter.py b/pydra/tasks/mrtrix3/v3_1/fixelfilter.py new file mode 100644 index 0000000..619d67b --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/fixelfilter.py @@ -0,0 +1,137 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class FixelFilter(shell.Task["FixelFilter.Outputs"]): + """If the first input to the command is a specific fixel data file, then a filtered version of only that file will be generated by the command. Alternatively, if the input is the location of a fixel directory, then the command will create a duplicate of the fixel directory, and apply the specified filter operation to all fixel data files within the directory. + + Fixel data are stored utilising the fixel directory format described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/fixel_based_analysis/fixel_directory_format.html + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "fixelfilter" + + # Arguments + input: ty.Any = shell.arg( + argstr="", + position=1, + help="""the input: either a fixel data file, or a fixel directory (see Description)""", + ) + filter: str = shell.arg( + argstr="", + position=2, + help="""the filtering operation to perform; options are: connect, smooth""", + allowed_values=["connect", "smooth"], + ) + output: ty.Any = shell.arg( + argstr="", + position=3, + help="""the output: either a fixel data file, or a fixel directory (see Description)""", + ) + + # Options + matrix: Directory = shell.arg( + argstr="-matrix", + help="""provide a fixel-fixel connectivity matrix for filtering operations that require it""", + ) + + # Options specific to the "connect" filter: + threshold_value: float | None = shell.arg( + default=None, + argstr="-threshold_value", + help="""specify a threshold for the input fixel data file values (default = 0.5)""", + ) + threshold_connectivity: float | None = shell.arg( + default=None, + argstr="-threshold_connectivity", + help="""specify a fixel-fixel connectivity threshold for connected-component analysis (default = 0.10000000000000001)""", + ) + + # Options specific to the "smooth" filter: + fwhm: float | None = shell.arg( + default=None, + argstr="-fwhm", + help="""the full-width half-maximum (FWHM) of the spatial component of the smoothing filter (default = 10mm)""", + ) + minweight: float | None = shell.arg( + default=None, + argstr="-minweight", + help="""apply a minimum threshold to smoothing weights (default = 0.01)""", + ) + mask: ImageIn | None = shell.arg( + default=None, + argstr="-mask", + help="""only perform smoothing within a specified binary fixel mask""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + pass diff --git a/pydra/tasks/mrtrix3/v3_1/fixelreorient.py b/pydra/tasks/mrtrix3/v3_1/fixelreorient.py new file mode 100644 index 0000000..d08961c --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/fixelreorient.py @@ -0,0 +1,103 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class FixelReorient(shell.Task["FixelReorient.Outputs"]): + """Reorientation is performed by transforming the vector representing the fixel direction with the Jacobian (local affine transform) computed at each voxel in the warp, then re-normalising the vector. + + Fixel data are stored utilising the fixel directory format described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/fixel_based_analysis/fixel_directory_format.html + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "fixelreorient" + + # Arguments + fixel_in: Directory = shell.arg( + argstr="", + position=1, + help="""the input fixel directory""", + ) + warp: ImageIn = shell.arg( + argstr="", + position=2, + help="""a 4D deformation field used to perform reorientation.""", + ) + + # Options + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + fixel_out: Directory = shell.outarg( + argstr="", + position=3, + path_template="fixel_out", + help="""the output fixel directory. If the the input and output directories are the same, the existing directions file will be replaced (providing the -force option is supplied). If a new directory is supplied, then the fixel directions and all other fixel data will be copied to the new directory.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/fod2dec.py b/pydra/tasks/mrtrix3/v3_1/fod2dec.py new file mode 100644 index 0000000..4462905 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/fod2dec.py @@ -0,0 +1,123 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Fod2Dec(shell.Task["Fod2Dec.Outputs"]): + """By default, the FOD-based DEC is weighted by the integral of the FOD. To weight by another scalar map, use the -contrast option. This option can also be used for panchromatic sharpening, e.g., by supplying a T1 (or other sensible) anatomical volume with a higher spatial resolution. + + + References + ---------- + + Dhollander T, Smith RE, Tournier JD, Jeurissen B, Connelly A. Time to move on: an FOD-based DEC map to replace DTI's trademark DEC FA. Proc Intl Soc Mag Reson Med, 2015, 23, 1027 + + Dhollander T, Raffelt D, Smith RE, Connelly A. Panchromatic sharpening of FOD-based DEC maps by structural T1 information. Proc Intl Soc Mag Reson Med, 2015, 23, 566 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Thijs Dhollander (thijs.dhollander@gmail.com) + + Copyright: Copyright (C) 2014 The Florey Institute of Neuroscience and Mental Health, Melbourne, Australia. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + """ + + executable = "fod2dec" + + # Arguments + in_file: ImageIn = shell.arg( + argstr="", + position=1, + help="""The input FOD image (spherical harmonic coefficients).""", + ) + + # Options + mask: ImageIn | None = shell.arg( + default=None, + argstr="-mask", + help="""Only perform DEC computation within the specified mask image.""", + ) + contrast: ImageIn | None = shell.arg( + default=None, + argstr="-contrast", + help="""Weight the computed DEC map by the provided image contrast. If the contrast has a different image grid, the DEC map is first resliced and renormalised. To achieve panchromatic sharpening, provide an image with a higher spatial resolution than the input FOD image; e.g., a T1 anatomical volume. Only the DEC is subject to the mask, so as to allow for partial colouring of the contrast image. +Default when this option is *not* provided: integral of input FOD, subject to the same mask/threshold as used for DEC computation.""", + ) + lum: bool = shell.arg( + default=False, + argstr="-lum", + help="""Correct for luminance/perception, using default values Cr,Cg,Cb = 0.3,0.5,0.2 and gamma = 2.2 (*not* correcting is the theoretical equivalent of Cr,Cg,Cb = 1,1,1 and gamma = 2).""", + ) + lum_coefs: list[float] | None = shell.arg( + default=None, + argstr="-lum_coefs", + help="""The coefficients Cr,Cg,Cb to correct for luminance/perception. Note: this implicitly switches on luminance/perception correction, using a default gamma = 2.2 unless specified otherwise.""", + sep=",", + ) + lum_gamma: float | None = shell.arg( + default=None, + argstr="-lum_gamma", + help="""The gamma value to correct for luminance/perception. Note: this implicitly switches on luminance/perception correction, using a default Cr,Cg,Cb = 0.3,0.5,0.2 unless specified otherwise.""", + ) + threshold: float | None = shell.arg( + default=None, + argstr="-threshold", + help="""FOD amplitudes below the threshold value are considered zero.""", + ) + no_weight: bool = shell.arg( + default=False, + argstr="-no_weight", + help="""Do not weight the DEC map; just output the unweighted colours. Reslicing and renormalising of colours will still happen when providing the -contrast option as a template.""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="out_file.mif", + help="""The output DEC image (weighted RGB triplets).""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/fod2fixel.py b/pydra/tasks/mrtrix3/v3_1/fod2fixel.py new file mode 100644 index 0000000..eab5f8e --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/fod2fixel.py @@ -0,0 +1,163 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Fod2Fixel(shell.Task["Fod2Fixel.Outputs"]): + """ + References + ---------- + + * Reference for the FOD segmentation method: + Smith, R. E.; Tournier, J.-D.; Calamante, F. & Connelly, A. SIFT: Spherical-deconvolution informed filtering of tractograms. NeuroImage, 2013, 67, 298-312 (Appendix 2) + + * Reference for Apparent Fibre Density (AFD): + Raffelt, D.; Tournier, J.-D.; Rose, S.; Ridgway, G.R.; Henderson, R.; Crozier, S.; Salvado, O.; Connelly, A. Apparent Fibre Density: a novel measure for the analysis of diffusion-weighted magnetic resonance images.Neuroimage, 2012, 15;59(4), 3976-94 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "fod2fixel" + + # Arguments + fod: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input fod image.""", + ) + + # Options + + # Metric values for fixel-based sparse output images: + + # FOD FMLS segmenter options: + fmls_integral: float | None = shell.arg( + default=None, + argstr="-fmls_integral", + help="""threshold absolute numerical integral of positive FOD lobes. Any lobe for which the integral is smaller than this threshold will be discarded. Default: 0.""", + ) + fmls_peak_value: float | None = shell.arg( + default=None, + argstr="-fmls_peak_value", + help="""threshold peak amplitude of positive FOD lobes. Any lobe for which the maximal peak amplitude is smaller than this threshold will be discarded. Default: 0.1.""", + ) + fmls_no_thresholds: bool = shell.arg( + default=False, + argstr="-fmls_no_thresholds", + help="""disable all FOD lobe thresholding; every lobe where the FOD is positive will be retained.""", + ) + fmls_lobe_merge_ratio: float | None = shell.arg( + default=None, + argstr="-fmls_lobe_merge_ratio", + help="""Specify the ratio between a given FOD amplitude sample between two lobes, and the smallest peak amplitude of the adjacent lobes, above which those lobes will be merged. This is the amplitude of the FOD at the 'bridge' point between the two lobes, divided by the peak amplitude of the smaller of the two adjoining lobes. A value of 1.0 will never merge two lobes into one; a value of 0.0 will always merge lobes unless they are bisected by a zero-valued crossing. Default: 1.""", + ) + + # Other options for fod2fixel: + mask: ImageIn | None = shell.arg( + default=None, + argstr="-mask", + help="""only perform computation within the specified binary brain mask image.""", + ) + maxnum: int | None = shell.arg( + default=None, + argstr="-maxnum", + help="""maximum number of fixels to output for any particular voxel (default: no limit)""", + ) + nii: bool = shell.arg( + default=False, + argstr="-nii", + help="""output the directions and index file in nii format (instead of the default mif)""", + ) + dirpeak: bool = shell.arg( + default=False, + argstr="-dirpeak", + help="""define the fixel direction as that of the lobe's maximal peak as opposed to its weighted mean direction (the default)""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + fixel_directory: Directory = shell.outarg( + argstr="", + position=2, + path_template="fixel_directory", + help="""the output fixel directory""", + ) + afd: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-afd", + path_template="afd.mif", + help="""output the total Apparent Fibre Density per fixel (integral of FOD lobe)""", + ) + peak_amp: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-peak_amp", + path_template="peak_amp.mif", + help="""output the amplitude of the FOD at the maximal peak per fixel""", + ) + disp: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-disp", + path_template="disp.mif", + help="""output a measure of dispersion per fixel as the ratio between FOD lobe integral and maximal peak amplitude""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/label2colour.py b/pydra/tasks/mrtrix3/v3_1/label2colour.py new file mode 100644 index 0000000..2f8317d --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/label2colour.py @@ -0,0 +1,100 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Label2Colour(shell.Task["Label2Colour.Outputs"]): + """Many software packages handle this colouring internally within their viewer program; this binary explicitly converts a parcellation image into a colour image that should be viewable in any software. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "label2colour" + + # Arguments + nodes_in: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input node parcellation image""", + ) + + # Options + lut: File | None = shell.arg( + default=None, + argstr="-lut", + help="""Provide the relevant colour lookup table (if not provided, nodes will be coloured randomly)""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + colour_out: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="colour_out.mif", + help="""the output colour image""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/label2mesh.py b/pydra/tasks/mrtrix3/v3_1/label2mesh.py new file mode 100644 index 0000000..b599a5c --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/label2mesh.py @@ -0,0 +1,98 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Label2Mesh(shell.Task["Label2Mesh.Outputs"]): + """ + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "label2mesh" + + # Arguments + nodes_in: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input node parcellation image""", + ) + + # Options + blocky: bool = shell.arg( + default=False, + argstr="-blocky", + help="""generate 'blocky' meshes with precise delineation of voxel edges, rather than the default Marching Cubes approach""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + mesh_out: File = shell.outarg( + argstr="", + position=2, + path_template="mesh_out.txt", + help="""the output mesh file""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/labelconvert.py b/pydra/tasks/mrtrix3/v3_1/labelconvert.py new file mode 100644 index 0000000..423f970 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/labelconvert.py @@ -0,0 +1,124 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class LabelConvert(shell.Task["LabelConvert.Outputs"]): + """Typical usage is to convert a parcellation image provided by some other software, based on the lookup table provided by that software, to conform to a new lookup table, particularly one where the node indices increment from 1, in preparation for connectome construction; examples of such target lookup table files are provided in share//mrtrix3//labelconvert//, but can be created by the user to provide the desired node set // ordering // colours. + + A more thorough description of the operation and purpose of the labelconvert command can be found in the online documentation: + https://mrtrix.readthedocs.io/en/3.0.4/quantitative_structural_connectivity/labelconvert_tutorial.html + + + Example usages + -------------- + + + Convert a Desikan-Killiany parcellation image as provided by FreeSurfer to have nodes incrementing from 1: + + `$ labelconvert aparc+aseg.mgz FreeSurferColorLUT.txt mrtrix3//share//mrtrix3//labelconvert//fs_default.txt nodes.mif` + + Paths to the files in the example above would need to be revised according to their locations on the user's system. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "labelconvert" + + # Arguments + path_in: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input image""", + ) + lut_in: File = shell.arg( + argstr="", + position=2, + help="""the connectome lookup table corresponding to the input image""", + ) + lut_out: File = shell.arg( + argstr="", + position=3, + help="""the target connectome lookup table for the output image""", + ) + + # Options + spine: ImageIn | None = shell.arg( + default=None, + argstr="-spine", + help="""provide a manually-defined segmentation of the base of the spine where the streamlines terminate, so that this can become a node in the connection matrix.""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + image_out: ImageOut = shell.outarg( + argstr="", + position=4, + path_template="image_out.mif", + help="""the output image""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/labelsgmfirst.py b/pydra/tasks/mrtrix3/v3_1/labelsgmfirst.py new file mode 100644 index 0000000..babf203 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/labelsgmfirst.py @@ -0,0 +1,138 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define(xor=[["info", "quiet", "debug", None]]) +class LabelSgmfirst(shell.Task["LabelSgmfirst.Outputs"]): + """ + + References + ---------- + + * 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 + + * 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 + + * 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 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = "labelsgmfirst" + + parc: ImageIn = shell.arg( + position=1, + argstr="", + help="The input FreeSurfer parcellation image", + ) + t1: ImageIn = shell.arg( + position=2, + argstr="", + help="The T1 image to be provided to FIRST", + ) + lut: File = shell.arg( + position=3, + argstr="", + help="The lookup table file that the parcellated image is based on", + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + premasked: bool = shell.arg( + help="Indicate that brain masking has been applied to the T1 input image", + argstr="-premasked", + default=False, + ) + sgm_amyg_hipp: bool = shell.arg( + help="Consider the amygdalae and hippocampi as sub-cortical grey matter structures, and also replace their estimates with those from FIRST", + argstr="-sgm_amyg_hipp", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=4, + argstr="", + help="The output parcellation image", + path_template="out_file.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/labelstats.py b/pydra/tasks/mrtrix3/v3_1/labelstats.py new file mode 100644 index 0000000..f507d49 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/labelstats.py @@ -0,0 +1,99 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class LabelStats(shell.Task["LabelStats.Outputs"]): + """ + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "labelstats" + + # Arguments + in_file: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input label image""", + ) + + # Options + output: str | None = shell.arg( + default=None, + argstr="-output", + help="""output only the field specified; options are: mass,centre""", + allowed_values=["mass", "centre"], + ) + voxelspace: bool = shell.arg( + default=False, + argstr="-voxelspace", + help="""report parcel centres of mass in voxel space rather than scanner space""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + pass diff --git a/pydra/tasks/mrtrix3/v3_1/mask2glass.py b/pydra/tasks/mrtrix3/v3_1/mask2glass.py new file mode 100644 index 0000000..b8f5399 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mask2glass.py @@ -0,0 +1,127 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define(xor=[["info", "quiet", "debug", None]]) +class Mask2Glass(shell.Task["Mask2Glass.Outputs"]): + """ + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Remika Mito (remika.mito@florey.edu.au) and Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = "mask2glass" + + in_file: ImageIn = shell.arg( + position=1, + argstr="", + help="The input mask image", + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + dilate: int | None = shell.arg( + help="Provide number of iterations for dilation step; default = 2", + argstr="-dilate", + default=None, + ) + scale: float | None = shell.arg( + help="Provide resolution upscaling value; default = 2.0", + argstr="-scale", + default=None, + ) + smooth: float | None = shell.arg( + help="Provide standard deviation of smoothing (in mm); default = 1.0", + argstr="-smooth", + default=None, + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + position=2, + argstr="", + help="The output glass brain image", + path_template="out_file.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/maskdump.py b/pydra/tasks/mrtrix3/v3_1/maskdump.py new file mode 100644 index 0000000..25f70b1 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/maskdump.py @@ -0,0 +1,96 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MaskDump(shell.Task["MaskDump.Outputs"]): + """If no destination file is specified, the voxel locations will be printed to stdout. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "maskdump" + + # Arguments + in_file: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input image.""", + ) + + # Options + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: File | None = shell.outarg( + argstr="", + position=2, + default=None, + path_template="out_file.txt", + help="""the (optional) output text file.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/maskfilter.py b/pydra/tasks/mrtrix3/v3_1/maskfilter.py new file mode 100644 index 0000000..adcb20b --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/maskfilter.py @@ -0,0 +1,166 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MaskFilter(shell.Task["MaskFilter.Outputs"]): + """Many filters have their own unique set of optional parameters; see the option groups dedicated to each filter type. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) and David Raffelt (david.raffelt@florey.edu.au) and Thijs Dhollander (thijs.dhollander@gmail.com) and J-Donald Tournier (jdtournier@gmail.com) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "maskfilter" + + # Arguments + in_file: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input mask.""", + ) + filter: str = shell.arg( + argstr="", + position=2, + help="""the name of the filter to be applied; options are: clean, connect, dilate, erode, fill, median""", + allowed_values=["clean", "connect", "dilate", "erode", "fill", "median"], + ) + + # Options + + # Options for mask cleaning filter: + scale: int | None = shell.arg( + default=None, + argstr="-scale", + help="""the maximum scale used to cut bridges. A certain maximum scale cuts bridges up to a width (in voxels) of 2x the provided scale. (Default: 2)""", + ) + + # Options for connected-component filter: + axes: list[int] | None = shell.arg( + default=None, + argstr="-axes", + help="""specify which axes should be included in the connected components. By default only the first 3 axes are included. The axes should be provided as a comma-separated list of values.""", + sep=",", + ) + largest: bool = shell.arg( + default=False, + argstr="-largest", + help="""only retain the largest connected component""", + ) + connectivity: bool = shell.arg( + default=False, + argstr="-connectivity", + help="""use 26-voxel-neighbourhood connectivity (Default is 6-voxel-neighbourhood)""", + ) + minsize: int | None = shell.arg( + default=None, + argstr="-minsize", + help="""impose minimum size of segmented components (Default: select all components)""", + ) + + # Options for dilate / erode filters: + npass: int | None = shell.arg( + default=None, + argstr="-npass", + help="""the number of times to repeatedly apply the filter""", + ) + + # Options for interior-filling filter: + axes: list[int] | None = shell.arg( + default=None, + argstr="-axes", + help="""specify which axes should be included in the connected components. By default only the first 3 axes are included. The axes should be provided as a comma-separated list of values.""", + sep=",", + ) + connectivity: bool = shell.arg( + default=False, + argstr="-connectivity", + help="""use 26-voxel-neighbourhood connectivity (Default is 6-voxel-neighbourhood)""", + ) + + # Options for median filter: + extent: list[int] | None = shell.arg( + default=None, + argstr="-extent", + help="""specify the extent (width) of kernel size in voxels. This can be specified either as a single value to be used for all axes, or as a comma-separated list of the extent for each axis. The default is 3x3x3.""", + sep=",", + ) + + # Stride options: + strides: ty.Any = shell.arg( + default=None, + argstr="-strides", + help="""specify the strides of the output data in memory; either as a comma-separated list of (signed) integers, or as a template image from which the strides shall be extracted and used. The actual strides produced will depend on whether the output image format can support it.""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + argstr="", + position=3, + path_template="out_file.mif", + help="""the output mask.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/mesh2voxel.py b/pydra/tasks/mrtrix3/v3_1/mesh2voxel.py new file mode 100644 index 0000000..a3e7776 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mesh2voxel.py @@ -0,0 +1,100 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Mesh2Voxel(shell.Task["Mesh2Voxel.Outputs"]): + """ + References + ---------- + + 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 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mesh2voxel" + + # Arguments + source: File = shell.arg( + argstr="", + position=1, + help="""the mesh file; note vertices must be defined in realspace coordinates""", + ) + template: ImageIn = shell.arg( + argstr="", + position=2, + help="""the template image""", + ) + + # Options + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + argstr="", + position=3, + path_template="out_file.mif", + help="""the output image""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/meshconvert.py b/pydra/tasks/mrtrix3/v3_1/meshconvert.py new file mode 100644 index 0000000..2f4620e --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/meshconvert.py @@ -0,0 +1,104 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MeshConvert(shell.Task["MeshConvert.Outputs"]): + """ + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "meshconvert" + + # Arguments + in_file: File = shell.arg( + argstr="", + position=1, + help="""the input mesh file""", + ) + + # Options + binary: bool = shell.arg( + default=False, + argstr="-binary", + help="""write the output mesh file in binary format (if supported)""", + ) + transform: tuple[str, str] | None = shell.arg( + default=None, + argstr="-transform", + help="""transform vertices from one coordinate space to another, based on a template image; options are: first2real, real2first, voxel2real, real2voxel, fs2real""", + sep=" ", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: File = shell.outarg( + argstr="", + position=2, + path_template="out_file.txt", + help="""the output mesh file""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/meshfilter.py b/pydra/tasks/mrtrix3/v3_1/meshfilter.py new file mode 100644 index 0000000..c1fa8ae --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/meshfilter.py @@ -0,0 +1,124 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MeshFilter(shell.Task["MeshFilter.Outputs"]): + """While this command has only one filter operation currently available, it nevertheless presents with a comparable interface to the MRtrix3 commands maskfilter and mrfilter + + + Example usages + -------------- + + + Apply a mesh smoothing filter (currently the only filter available): + + `$ meshfilter input.vtk smooth output.vtk` + + The usage of this command may cause confusion due to the generic interface despite only one filtering operation being currently available. This simple example usage is therefore provided for clarity. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "meshfilter" + + # Arguments + in_file: File = shell.arg( + argstr="", + position=1, + help="""the input mesh file""", + ) + filter: str = shell.arg( + argstr="", + position=2, + help="""the filter to apply; options are: smooth""", + allowed_values=["smooth"], + ) + + # Options + + # Options for mesh smoothing filter: + smooth_spatial: float | None = shell.arg( + default=None, + argstr="-smooth_spatial", + help="""spatial extent of smoothing (default: 10mm)""", + ) + smooth_influence: float | None = shell.arg( + default=None, + argstr="-smooth_influence", + help="""influence factor for smoothing (default: 10)""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: File = shell.outarg( + argstr="", + position=3, + path_template="out_file.txt", + help="""the output mesh file""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/mraverageheader.py b/pydra/tasks/mrtrix3/v3_1/mraverageheader.py new file mode 100644 index 0000000..5e6da6e --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mraverageheader.py @@ -0,0 +1,164 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MrAverageheader(shell.Task["MrAverageheader.Outputs"]): + """The voxel spacings of the calculated average header can be determined from the set of input images in one of four different ways, which may be more or less appropriate in different use cases. These options vary in two key ways: 1. Projected voxel spacing of the input image in the direction of the average header axes versus the voxel spacing of the input image axis that is closest to the average header axis; 2. Selecting the minimum of these spacings across input images to maintain maximal spatial resolution versus the mean across images to produce an unbiased average. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Maximilian Pietsch (maximilian.pietsch@kcl.ac.uk) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mraverageheader" + + # Arguments + in_file: MultiInputObj[ImageIn] = shell.arg( + argstr="", + position=1, + help="""the input image(s).""", + ) + + # Options + padding: float | None = shell.arg( + default=None, + argstr="-padding", + help="""boundary box padding in voxels. Default: 0""", + ) + spacing: str | None = shell.arg( + default=None, + argstr="-spacing", + help="""Method for determination of voxel spacings based on the set of input images and the average header axes (see Description). Valid options are: min_projection,mean_projection,min_nearest,mean_nearest; default = mean_projection""", + allowed_values=[ + "min_projection", + "mean_projection", + "min_nearest", + "mean_nearest", + ], + ) + fill: bool = shell.arg( + default=False, + argstr="-fill", + help="""set the intensity in the first volume of the average space to 1""", + ) + + # Data type options: + datatype: str | None = shell.arg( + default=None, + argstr="-datatype", + help="""specify output image data type. Valid choices are: float16, float16le, float16be, float32, float32le, float32be, float64, float64le, float64be, int64, uint64, int64le, uint64le, int64be, uint64be, int32, uint32, int32le, uint32le, int32be, uint32be, int16, uint16, int16le, uint16le, int16be, uint16be, cfloat16, cfloat16le, cfloat16be, cfloat32, cfloat32le, cfloat32be, cfloat64, cfloat64le, cfloat64be, int8, uint8, bit.""", + allowed_values=[ + "float16", + "float16le", + "float16be", + "float32", + "float32le", + "float32be", + "float64", + "float64le", + "float64be", + "int64", + "uint64", + "int64le", + "uint64le", + "int64be", + "uint64be", + "int32", + "uint32", + "int32le", + "uint32le", + "int32be", + "uint32be", + "int16", + "uint16", + "int16le", + "uint16le", + "int16be", + "uint16be", + "cfloat16", + "cfloat16le", + "cfloat16be", + "cfloat32", + "cfloat32le", + "cfloat32be", + "cfloat64", + "cfloat64le", + "cfloat64be", + "int8", + "uint8", + "bit", + ], + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="out_file.mif", + help="""the output image""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/mrcat.py b/pydra/tasks/mrtrix3/v3_1/mrcat.py new file mode 100644 index 0000000..0acfd4b --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mrcat.py @@ -0,0 +1,157 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MrCat(shell.Task["MrCat.Outputs"]): + """ + Example usages + -------------- + + + Concatenate individual 3D volumes into a single 4D image series: + + `$ mrcat volume*.mif series.mif` + + The wildcard characters will find all images in the current working directory with names that begin with "volume" and end with ".mif"; the mrcat command will receive these as a list of input file names, from which it will produce a 4D image where the input volumes have been concatenated along axis 3 (the fourth axis; the spatial axes are 0, 1 & 2). + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: J-Donald Tournier (jdtournier@gmail.com) and Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mrcat" + + # Arguments + inputs: MultiInputObj[ImageIn] = shell.arg( + argstr="", + position=1, + help="""the input images.""", + ) + + # Options + axis: int | None = shell.arg( + default=None, + argstr="-axis", + help="""specify axis along which concatenation should be performed. By default, the program will use the last non-singleton, non-spatial axis of any of the input images; in other words, axis 3, or whichever axis (greater than 3) of the input images has size greater than one.""", + ) + + # Data type options: + datatype: str | None = shell.arg( + default=None, + argstr="-datatype", + help="""specify output image data type. Valid choices are: float16, float16le, float16be, float32, float32le, float32be, float64, float64le, float64be, int64, uint64, int64le, uint64le, int64be, uint64be, int32, uint32, int32le, uint32le, int32be, uint32be, int16, uint16, int16le, uint16le, int16be, uint16be, cfloat16, cfloat16le, cfloat16be, cfloat32, cfloat32le, cfloat32be, cfloat64, cfloat64le, cfloat64be, int8, uint8, bit.""", + allowed_values=[ + "float16", + "float16le", + "float16be", + "float32", + "float32le", + "float32be", + "float64", + "float64le", + "float64be", + "int64", + "uint64", + "int64le", + "uint64le", + "int64be", + "uint64be", + "int32", + "uint32", + "int32le", + "uint32le", + "int32be", + "uint32be", + "int16", + "uint16", + "int16le", + "uint16le", + "int16be", + "uint16be", + "cfloat16", + "cfloat16le", + "cfloat16be", + "cfloat32", + "cfloat32le", + "cfloat32be", + "cfloat64", + "cfloat64le", + "cfloat64be", + "int8", + "uint8", + "bit", + ], + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="out_file.mif", + help="""the output image.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/mrcentroid.py b/pydra/tasks/mrtrix3/v3_1/mrcentroid.py new file mode 100644 index 0000000..1ede880 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mrcentroid.py @@ -0,0 +1,98 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MrCentroid(shell.Task["MrCentroid.Outputs"]): + """ + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mrcentroid" + + # Arguments + in_file: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input image""", + ) + + # Options + mask: ImageIn | None = shell.arg( + default=None, + argstr="-mask", + help="""only include voxels within a mask in the calculation""", + ) + voxelspace: bool = shell.arg( + default=False, + argstr="-voxelspace", + help="""report image centre of mass in voxel space rather than scanner space""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + pass diff --git a/pydra/tasks/mrtrix3/v3_1/mrcheckerboardmask.py b/pydra/tasks/mrtrix3/v3_1/mrcheckerboardmask.py new file mode 100644 index 0000000..bd17325 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mrcheckerboardmask.py @@ -0,0 +1,108 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MrCheckerboardmask(shell.Task["MrCheckerboardmask.Outputs"]): + """ + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Max Pietsch (maximilian.pietsch@kcl.ac.uk) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mrcheckerboardmask" + + # Arguments + in_file: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input image to be used as a template.""", + ) + + # Options + tiles: int | None = shell.arg( + default=None, + argstr="-tiles", + help="""specify the number of tiles in any direction""", + ) + invert: bool = shell.arg( + default=False, + argstr="-invert", + help="""invert output binary mask.""", + ) + nan: bool = shell.arg( + default=False, + argstr="-nan", + help="""use NaN as the output zero value.""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="out_file.mif", + help="""the output binary image mask.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/mrclusterstats.py b/pydra/tasks/mrtrix3/v3_1/mrclusterstats.py new file mode 100644 index 0000000..65d8361 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mrclusterstats.py @@ -0,0 +1,225 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MrClusterstats(shell.Task["MrClusterstats.Outputs"]): + """In some software packages, a column of ones is automatically added to the GLM design matrix; the purpose of this column is to estimate the "global intercept", which is the predicted value of the observed variable if all explanatory variables were to be zero. However there are rare situations where including such a column would not be appropriate for a particular experimental design. Hence, in MRtrix3 statistical inference commands, it is up to the user to determine whether or not this column of ones should be included in their design matrix, and add it explicitly if necessary. The contrast matrix must also reflect the presence of this additional column. + + + References + ---------- + + * If not using the -threshold command-line option: + Smith, S. M. & Nichols, T. E. Threshold-free cluster enhancement: Addressing problems of smoothing, threshold dependence and localisation in cluster inference. NeuroImage, 2009, 44, 83-98 + + * If using the -nonstationary option: + Salimi-Khorshidi, G. Smith, S.M. Nichols, T.E. Adjusting the effect of nonstationarity in cluster-based and TFCE inference. Neuroimage, 2011, 54(3), 2006-19 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mrclusterstats" + + # Arguments + in_file: File = shell.arg( + argstr="", + position=1, + help="""a text file containing the file names of the input images, one file per line""", + ) + design: File = shell.arg( + argstr="", + position=2, + help="""the design matrix""", + ) + contrast: File = shell.arg( + argstr="", + position=3, + help="""the contrast matrix""", + ) + mask: ImageIn = shell.arg( + argstr="", + position=4, + help="""a mask used to define voxels included in the analysis.""", + ) + output: str = shell.arg( + argstr="", + position=5, + help="""the filename prefix for all output.""", + ) + + # Options + + # Options relating to shuffling of data for nonparametric statistical inference: + notest: bool = shell.arg( + default=False, + argstr="-notest", + help="""don't perform statistical inference; only output population statistics (effect size, stdev etc)""", + ) + errors: str | None = shell.arg( + default=None, + argstr="-errors", + help="""specify nature of errors for shuffling; options are: ee,ise,both (default: ee)""", + allowed_values=["ee", "ise", "both"], + ) + exchange_within: File | None = shell.arg( + default=None, + argstr="-exchange_within", + help="""specify blocks of observations within each of which data may undergo restricted exchange""", + ) + exchange_whole: File | None = shell.arg( + default=None, + argstr="-exchange_whole", + help="""specify blocks of observations that may be exchanged with one another (for independent and symmetric errors, sign-flipping will occur block-wise)""", + ) + strong: bool = shell.arg( + default=False, + argstr="-strong", + help="""use strong familywise error control across multiple hypotheses""", + ) + nshuffles: int | None = shell.arg( + default=None, + argstr="-nshuffles", + help="""the number of shuffles (default: 5000)""", + ) + permutations: File | None = shell.arg( + default=None, + argstr="-permutations", + help="""manually define the permutations (relabelling). The input should be a text file defining a m x n matrix, where each relabelling is defined as a column vector of size m, and the number of columns n defines the number of permutations. Can be generated with the palm_quickperms function in PALM (http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/PALM). Overrides the -nshuffles option.""", + ) + nonstationarity: bool = shell.arg( + default=False, + argstr="-nonstationarity", + help="""perform non-stationarity correction""", + ) + skew_nonstationarity: float | None = shell.arg( + default=None, + argstr="-skew_nonstationarity", + help="""specify the skew parameter for empirical statistic calculation (default for this command is 1)""", + ) + nshuffles_nonstationarity: int | None = shell.arg( + default=None, + argstr="-nshuffles_nonstationarity", + help="""the number of shuffles to use when precomputing the empirical statistic image for non-stationarity correction (default: 5000)""", + ) + permutations_nonstationarity: File | None = shell.arg( + default=None, + argstr="-permutations_nonstationarity", + help="""manually define the permutations (relabelling) for computing the emprical statistics for non-stationarity correction. The input should be a text file defining a m x n matrix, where each relabelling is defined as a column vector of size m, and the number of columns n defines the number of permutations. Can be generated with the palm_quickperms function in PALM (http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/PALM). Overrides the -nshuffles_nonstationarity option.""", + ) + + # Options for controlling TFCE behaviour: + tfce_dh: float | None = shell.arg( + default=None, + argstr="-tfce_dh", + help="""the height increment used in the tfce integration (default: 0.1)""", + ) + tfce_e: float | None = shell.arg( + default=None, + argstr="-tfce_e", + help="""tfce extent exponent (default: 0.5)""", + ) + tfce_h: float | None = shell.arg( + default=None, + argstr="-tfce_h", + help="""tfce height exponent (default: 2)""", + ) + + # Options related to the General Linear Model (GLM): + variance: File | None = shell.arg( + default=None, + argstr="-variance", + help="""define variance groups for the G-statistic; measurements for which the expected variance is equivalent should contain the same index""", + ) + ftests: File | None = shell.arg( + default=None, + argstr="-ftests", + help="""perform F-tests; input text file should contain, for each F-test, a row containing ones and zeros, where ones indicate the rows of the contrast matrix to be included in the F-test.""", + ) + fonly: bool = shell.arg( + default=False, + argstr="-fonly", + help="""only assess F-tests; do not perform statistical inference on entries in the contrast matrix""", + ) + column: MultiInputObj[File] | None = shell.arg( + default=None, + argstr="-column", + help="""add a column to the design matrix corresponding to subject voxel-wise values (note that the contrast matrix must include an additional column for each use of this option); the text file provided via this option should contain a file name for each subject""", + ) + + # Additional options for mrclusterstats: + threshold: float | None = shell.arg( + default=None, + argstr="-threshold", + help="""the cluster-forming threshold to use for a standard cluster-based analysis. This disables TFCE, which is the default otherwise.""", + ) + connectivity: bool = shell.arg( + default=False, + argstr="-connectivity", + help="""use 26-voxel-neighbourhood connectivity (Default: 6)""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + pass diff --git a/pydra/tasks/mrtrix3/v3_1/mrcolour.py b/pydra/tasks/mrtrix3/v3_1/mrcolour.py new file mode 100644 index 0000000..c36588b --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mrcolour.py @@ -0,0 +1,129 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MrColour(shell.Task["MrColour.Outputs"]): + """Under typical usage, this command will receive as input ad 3D greyscale image, and output a 4D image with 3 volumes corresponding to red-green-blue components; other use cases are possible, and are described in more detail below. + + By default, the command will automatically determine the maximum and minimum intensities of the input image, and use that information to set the upper and lower bounds of the applied colourmap. This behaviour can be overridden by manually specifying these bounds using the -upper and -lower options respectively. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mrcolour" + + # Arguments + in_file: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input image""", + ) + map: str = shell.arg( + argstr="", + position=2, + help="""the colourmap to apply; choices are: gray,hot,cool,jet,inferno,viridis,pet,colour,rgb""", + allowed_values=[ + "gray", + "hot", + "cool", + "jet", + "inferno", + "viridis", + "pet", + "colour", + "rgb", + ], + ) + + # Options + upper: float | None = shell.arg( + default=None, + argstr="-upper", + help="""manually set the upper intensity of the colour mapping""", + ) + lower: float | None = shell.arg( + default=None, + argstr="-lower", + help="""manually set the lower intensity of the colour mapping""", + ) + colour: list[float] | None = shell.arg( + default=None, + argstr="-colour", + help="""set the target colour for use of the 'colour' map (three comma-separated floating-point values)""", + sep=",", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + argstr="", + position=3, + path_template="out_file.mif", + help="""the output image""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/mrconvert.py b/pydra/tasks/mrtrix3/v3_1/mrconvert.py new file mode 100644 index 0000000..a8736bc --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mrconvert.py @@ -0,0 +1,352 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MrConvert(shell.Task["MrConvert.Outputs"]): + """If used correctly, this program can be a very useful workhorse. In addition to converting images between different formats, it can be used to extract specific studies from a data set, extract a specific region of interest, or flip the images. Some of the possible operations are described in more detail below. + + Note that for both the -coord and -axes options, indexing starts from 0 rather than 1. E.g. -coord 3 <#> selects volumes (the fourth dimension) from the series; -axes 0,1,2 includes only the three spatial axes in the output image. + + Additionally, for the second input to the -coord option and the -axes option, you can use any valid number sequence in the selection, as well as the 'end' keyword (see the main documentation for details); this can be particularly useful to select multiple coordinates. + + The -vox option is used to change the size of the voxels in the output image as reported in the image header; note however that this does not re-sample the image based on a new voxel size (that is done using the mrgrid command). + + By default, the intensity scaling parameters in the input image header are passed through to the output image header when writing to an integer image, and reset to 0,1 (i.e. no scaling) for floating-point and binary images. Note that the -scaling option will therefore have no effect for floating-point or binary output images. + + The -axes option specifies which axes from the input image will be used to form the output image. This allows the permutation, omission, or addition of axes into the output image. The axes should be supplied as a comma-separated list of axis indices. If an axis from the input image is to be omitted from the output image, it must either already have a size of 1, or a single coordinate along that axis must be selected by the user by using the -coord option. Examples are provided further below. + + The -bvalue_scaling option controls an aspect of the import of diffusion gradient tables. When the input diffusion-weighting direction vectors have norms that differ substantially from unity, the b-values will be scaled by the square of their corresponding vector norm (this is how multi-shell acquisitions are frequently achieved on scanner platforms). However in some rare instances, the b-values may be correct, despite the vectors not being of unit norm (or conversely, the b-values may need to be rescaled even though the vectors are close to unit norm). This option allows the user to control this operation and override MRrtix3's automatic detection. + + + Example usages + -------------- + + + Extract the first volume from a 4D image, and make the output a 3D image: + + `$ mrconvert in.mif -coord 3 0 -axes 0,1,2 out.mif` + + The -coord 3 0 option extracts, from axis number 3 (which is the fourth axis since counting begins from 0; this is the axis that steps across image volumes), only coordinate number 0 (i.e. the first volume). The -axes 0,1,2 ensures that only the first three axes (i.e. the spatial axes) are retained; if this option were not used in this example, then image out.mif would be a 4D image, but it would only consist of a single volume, and mrinfo would report its size along the fourth axis as 1. + + + Extract slice number 24 along the AP direction: + + `$ mrconvert volume.mif slice.mif -coord 1 24` + + MRtrix3 uses a RAS (Right-Anterior-Superior) axis convention, and internally reorients images upon loading in order to conform to this as far as possible. So for non-exotic data, axis 1 should correspond (approximately) to the anterior-posterior direction. + + + Extract only every other volume from a 4D image: + + `$ mrconvert all.mif every_other.mif -coord 3 1:2:end` + + This example demonstrates two features: Use of the colon syntax to conveniently specify a number sequence (in the format 'start:step:stop'); and use of the 'end' keyword to generate this sequence up to the size of the input image along that axis (i.e. the number of volumes). + + + Alter the image header to report a new isotropic voxel size: + + `$ mrconvert in.mif isotropic.mif -vox 1.25` + + By providing a single value to the -vox option only, the specified value is used to set the voxel size in mm for all three spatial axes in the output image. + + + Alter the image header to report a new anisotropic voxel size: + + `$ mrconvert in.mif anisotropic.mif -vox 1,,3.5` + + This example will change the reported voxel size along the first and third axes (ideally left-right and inferior-superior) to 1.0mm and 3.5mm respectively, and leave the voxel size along the second axis (ideally anterior-posterior) unchanged. + + + Turn a single-volume 4D image into a 3D image: + + `$ mrconvert 4D.mif 3D.mif -axes 0,1,2` + + Sometimes in the process of extracting or calculating a single 3D volume from a 4D image series, the size of the image reported by mrinfo will be "X x Y x Z x 1", indicating that the resulting image is in fact also 4D, it just happens to contain only one volume. This example demonstrates how to convert this into a genuine 3D image (i.e. mrinfo will report the size as "X x Y x Z". + + + Insert an axis of size 1 into the image: + + `$ mrconvert XYZD.mif XYZ1D.mif -axes 0,1,2,-1,3` + + This example uses the value -1 as a flag to indicate to mrconvert where a new axis of unity size is to be inserted. In this particular example, the input image has four axes: the spatial axes X, Y and Z, and some form of data D is stored across the fourth axis (i.e. volumes). Due to insertion of a new axis, the output image is 5D: the three spatial axes (XYZ), a single volume (the size of the output image along the fourth axis will be 1), and data D will be stored as volume groups along the fifth axis of the image. + + + Manually reset the data scaling parameters stored within the image header to defaults: + + `$ mrconvert with_scaling.mif without_scaling.mif -scaling 0.0,1.0` + + This command-line option alters the parameters stored within the image header that provide a linear mapping from raw intensity values stored in the image data to some other scale. Where the raw data stored in a particular voxel is I, the value within that voxel is interpreted as: value = offset + (scale x I). To adjust this scaling, the relevant parameters must be provided as a comma-separated 2-vector of floating-point values, in the format "offset,scale" (no quotation marks). This particular example sets the offset to zero and the scale to one, which equates to no rescaling of the raw intensity data. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: J-Donald Tournier (jdtournier@gmail.com) and Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mrconvert" + + # Arguments + in_file: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input image.""", + ) + + # Options + + # Options for manipulating fundamental image properties: + coord: MultiInputObj[tuple[int, int]] | None = shell.arg( + default=None, + argstr="-coord", + help="""retain data from the input image only at the coordinates specified in the selection along the specified axis. The selection argument expects a number sequence, which can also include the 'end' keyword.""", + sep=" ", + ) + vox: list[float] | None = shell.arg( + default=None, + argstr="-vox", + help="""change the voxel dimensions reported in the output image header""", + sep=",", + ) + axes: list[int] | None = shell.arg( + default=None, + argstr="-axes", + help="""specify the axes from the input image that will be used to form the output image""", + sep=",", + ) + scaling: list[float] | None = shell.arg( + default=None, + argstr="-scaling", + help="""specify the data scaling parameters used to rescale the intensity values""", + sep=",", + ) + + # Options for handling JSON (JavaScript Object Notation) files: + json_import: File | None = shell.arg( + default=None, + argstr="-json_import", + help="""import data from a JSON file into header key-value pairs""", + ) + + # Options to modify generic header entries: + clear_property: MultiInputObj[str] | None = shell.arg( + default=None, + argstr="-clear_property", + help="""remove the specified key from the image header altogether.""", + ) + set_property: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-set_property", + help="""set the value of the specified key in the image header.""", + sep=" ", + ) + append_property: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-append_property", + help="""append the given value to the specified key in the image header (this adds the value specified as a new line in the header value).""", + sep=" ", + ) + copy_properties: ty.Any = shell.arg( + default=None, + argstr="-copy_properties", + help="""clear all generic properties and replace with the properties from the image / file specified.""", + ) + + # Stride options: + strides: ty.Any = shell.arg( + default=None, + argstr="-strides", + help="""specify the strides of the output data in memory; either as a comma-separated list of (signed) integers, or as a template image from which the strides shall be extracted and used. The actual strides produced will depend on whether the output image format can support it.""", + ) + + # Data type options: + datatype: str | None = shell.arg( + default=None, + argstr="-datatype", + help="""specify output image data type. Valid choices are: float16, float16le, float16be, float32, float32le, float32be, float64, float64le, float64be, int64, uint64, int64le, uint64le, int64be, uint64be, int32, uint32, int32le, uint32le, int32be, uint32be, int16, uint16, int16le, uint16le, int16be, uint16be, cfloat16, cfloat16le, cfloat16be, cfloat32, cfloat32le, cfloat32be, cfloat64, cfloat64le, cfloat64be, int8, uint8, bit.""", + allowed_values=[ + "float16", + "float16le", + "float16be", + "float32", + "float32le", + "float32be", + "float64", + "float64le", + "float64be", + "int64", + "uint64", + "int64le", + "uint64le", + "int64be", + "uint64be", + "int32", + "uint32", + "int32le", + "uint32le", + "int32be", + "uint32be", + "int16", + "uint16", + "int16le", + "uint16le", + "int16be", + "uint16be", + "cfloat16", + "cfloat16le", + "cfloat16be", + "cfloat32", + "cfloat32le", + "cfloat32be", + "cfloat64", + "cfloat64le", + "cfloat64be", + "int8", + "uint8", + "bit", + ], + ) + + # DW gradient table import options: + grad: File | None = shell.arg( + default=None, + argstr="-grad", + help="""Provide the diffusion-weighted gradient scheme used in the acquisition in a text file. This should be supplied as a 4xN text file with each line in the format [ X Y Z b ], where [ X Y Z ] describe the direction of the applied gradient, and b gives the b-value in units of s/mm^2. If a diffusion gradient scheme is present in the input image header, the data provided with this option will be instead used.""", + ) + fslgrad: tuple[File, File] | None = shell.arg( + default=None, + argstr="-fslgrad", + help="""Provide the diffusion-weighted gradient scheme used in the acquisition in FSL bvecs/bvals format files. If a diffusion gradient scheme is present in the input image header, the data provided with this option will be instead used.""", + sep=" ", + ) + bvalue_scaling: bool = shell.arg( + default=False, + argstr="-bvalue_scaling", + help="""enable or disable scaling of diffusion b-values by the square of the corresponding DW gradient norm (see Desciption). Valid choices are: yes/no, true/false, 0/1 (default: automatic).""", + ) + + # DW gradient table export options: + + # Options for importing phase-encode tables: + import_pe_table: File | None = shell.arg( + default=None, + argstr="-import_pe_table", + help="""import a phase-encoding table from file""", + ) + import_pe_eddy: tuple[File, File] | None = shell.arg( + default=None, + argstr="-import_pe_eddy", + help="""import phase-encoding information from an EDDY-style config / index file pair""", + sep=" ", + ) + + # Options for exporting phase-encode tables: + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="out_file.mif", + help="""the output image.""", + ) + json_export: File | bool | None = shell.outarg( + default=None, + argstr="-json_export", + path_template="json_export.txt", + help="""export data from an image header key-value pairs into a JSON file""", + ) + export_grad_mrtrix: File | bool | None = shell.outarg( + default=None, + argstr="-export_grad_mrtrix", + path_template="export_grad_mrtrix.txt", + help="""export the diffusion-weighted gradient table to file in MRtrix format""", + ) + export_grad_fsl: tuple[File, File] | bool | None = shell.outarg( + default=None, + argstr="-export_grad_fsl", + path_template=( + "export_grad_fsl0.txt", + "export_grad_fsl1.txt", + ), + help="""export the diffusion-weighted gradient table to files in FSL (bvecs / bvals) format""", + sep=" ", + ) + export_pe_table: File | bool | None = shell.outarg( + default=None, + argstr="-export_pe_table", + path_template="export_pe_table.txt", + help="""export phase-encoding table to file""", + ) + export_pe_eddy: tuple[File, File] | bool | None = shell.outarg( + default=None, + argstr="-export_pe_eddy", + path_template=( + "export_pe_eddy0.txt", + "export_pe_eddy1.txt", + ), + help="""export phase-encoding information to an EDDY-style config / index file pair""", + sep=" ", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/mrdegibbs.py b/pydra/tasks/mrtrix3/v3_1/mrdegibbs.py new file mode 100644 index 0000000..86be0d3 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mrdegibbs.py @@ -0,0 +1,184 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MrDegibbs(shell.Task["MrDegibbs.Outputs"]): + """This application attempts to remove Gibbs ringing artefacts from MRI images using the method of local subvoxel-shifts proposed by Kellner et al. (see reference below for details). + + By default, the original 2D slice-wise version is used. If the -mode 3d option is provided, the program will run the 3D version as proposed by Bautista et al. (also in the reference list below). + + 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). If however you intend to run a thermal denoising step (eg. dwidenoise), you should do so before this command to not alter the noise structure, which would impact on denoising 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. 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. + + As this method is based on utilisation of the Fourier shift theorem, it operates best if it can be provided with complex-valued image data; in this use case the output image will also be complex-valued. + + + References + ---------- + + Kellner, E; Dhital, B; Kiselev, V.G & Reisert, M. Gibbs-ringing artifact removal based on local subvoxel-shifts. Magnetic Resonance in Medicine, 2016, 76, 1574-1581. + + Bautista, T; O'Muircheartaigh, J; Hajnal, JV; & Tournier, J-D. Removal of Gibbs ringing artefacts for 3D acquisitions using subvoxel shifts. Proc. ISMRM, 2021, 29, 3535. + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Ben Jeurissen (ben.jeurissen@uantwerpen.be) and J-Donald Tournier (jdtournier@gmail.com) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mrdegibbs" + + # Arguments + in_: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input image.""", + ) + + # Options + mode: str | None = shell.arg( + default=None, + argstr="-mode", + help="""specify the mode of operation. Valid choices are: 2d, 3d (default: 2d). The 2d mode corresponds to the original slice-wise approach as propoosed by Kellner et al., appropriate for images acquired using 2D stack-of-slices approaches. The 3d mode corresponds to the 3D volume-wise extension proposed by Bautista et al., which is appropriate for images acquired using 3D Fourier encoding.""", + allowed_values=["2d", "3d"], + ) + axes: list[int] | None = shell.arg( + default=None, + argstr="-axes", + help="""select the slice axes (default: 0,1 - i.e. x-y).""", + sep=",", + ) + nshifts: int | None = shell.arg( + default=None, + argstr="-nshifts", + help="""discretization of subpixel spacing (default: 20).""", + ) + minW: int | None = shell.arg( + default=None, + argstr="-minW", + help="""left border of window used for TV computation (default: 1).""", + ) + maxW: int | None = shell.arg( + default=None, + argstr="-maxW", + help="""right border of window used for TV computation (default: 3).""", + ) + + # Data type options: + datatype: str | None = shell.arg( + default=None, + argstr="-datatype", + help="""specify output image data type. Valid choices are: float16, float16le, float16be, float32, float32le, float32be, float64, float64le, float64be, int64, uint64, int64le, uint64le, int64be, uint64be, int32, uint32, int32le, uint32le, int32be, uint32be, int16, uint16, int16le, uint16le, int16be, uint16be, cfloat16, cfloat16le, cfloat16be, cfloat32, cfloat32le, cfloat32be, cfloat64, cfloat64le, cfloat64be, int8, uint8, bit.""", + allowed_values=[ + "float16", + "float16le", + "float16be", + "float32", + "float32le", + "float32be", + "float64", + "float64le", + "float64be", + "int64", + "uint64", + "int64le", + "uint64le", + "int64be", + "uint64be", + "int32", + "uint32", + "int32le", + "uint32le", + "int32be", + "uint32be", + "int16", + "uint16", + "int16le", + "uint16le", + "int16be", + "uint16be", + "cfloat16", + "cfloat16le", + "cfloat16be", + "cfloat32", + "cfloat32le", + "cfloat32be", + "cfloat64", + "cfloat64le", + "cfloat64be", + "int8", + "uint8", + "bit", + ], + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="out.mif", + help="""the output image.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/mrdump.py b/pydra/tasks/mrtrix3/v3_1/mrdump.py new file mode 100644 index 0000000..05295f0 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mrdump.py @@ -0,0 +1,101 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MrDump(shell.Task["MrDump.Outputs"]): + """If no destination file is specified, the voxel locations will be printed to stdout. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mrdump" + + # Arguments + in_file: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input image.""", + ) + + # Options + mask: ImageIn | None = shell.arg( + default=None, + argstr="-mask", + help="""only write the image values within voxels specified by a mask image""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: File | None = shell.outarg( + argstr="", + position=2, + default=None, + path_template="out_file.txt", + help="""the (optional) output text file.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/mredit.py b/pydra/tasks/mrtrix3/v3_1/mredit.py new file mode 100644 index 0000000..d1b3cb3 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mredit.py @@ -0,0 +1,121 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MrEdit(shell.Task["MrEdit.Outputs"]): + """A range of options are provided to enable direct editing of voxel intensities based on voxel / real-space coordinates. If only one image path is provided, the image will be edited in-place (use at own risk); if input and output image paths are provided, the output will contain the edited image, and the original image will not be modified in any way. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mredit" + + # Arguments + in_file: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input image""", + ) + + # Options + plane: MultiInputObj[tuple[int, int, int]] | None = shell.arg( + default=None, + argstr="-plane", + help="""fill one or more planes on a particular image axis""", + sep=" ", + ) + sphere: MultiInputObj[ + tuple[list[float], list[float], list[float]] + ] | None = shell.arg( + default=None, + argstr="-sphere", + help="""draw a sphere with radius in mm""", + sep=" ", + ) + voxel: MultiInputObj[tuple[list[float], list[float]]] | None = shell.arg( + default=None, + argstr="-voxel", + help="""change the image value within a single voxel""", + sep=" ", + ) + scanner: bool = shell.arg( + default=False, + argstr="-scanner", + help="""indicate that coordinates are specified in scanner space, rather than as voxel coordinates""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut | None = shell.outarg( + argstr="", + position=2, + default=None, + path_template="out_file.mif", + help="""the (optional) output image""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/mrfilter.py b/pydra/tasks/mrtrix3/v3_1/mrfilter.py new file mode 100644 index 0000000..bf831ec --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mrfilter.py @@ -0,0 +1,222 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MrFilter(shell.Task["MrFilter.Outputs"]): + """The available filters are: fft, gradient, median, smooth, normalise, zclean. + + Each filter has its own unique set of optional parameters. + + For 4D images, each 3D volume is processed independently. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) and David Raffelt (david.raffelt@florey.edu.au) and J-Donald Tournier (jdtournier@gmail.com) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mrfilter" + + # Arguments + in_file: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input image.""", + ) + filter: str = shell.arg( + argstr="", + position=2, + help="""the type of filter to be applied""", + allowed_values=["fft", "gradient", "median", "smooth", "normalise", "zclean"], + ) + + # Options + + # Options for FFT filter: + axes: list[int] | None = shell.arg( + default=None, + argstr="-axes", + help="""the axes along which to apply the Fourier Transform. By default, the transform is applied along the three spatial axes. Provide as a comma-separate list of axis indices.""", + sep=",", + ) + inverse: bool = shell.arg( + default=False, + argstr="-inverse", + help="""apply the inverse FFT""", + ) + magnitude: bool = shell.arg( + default=False, + argstr="-magnitude", + help="""output a magnitude image rather than a complex-valued image""", + ) + rescale: bool = shell.arg( + default=False, + argstr="-rescale", + help="""rescale values so that inverse FFT recovers original values""", + ) + centre_zero: bool = shell.arg( + default=False, + argstr="-centre_zero", + help="""re-arrange the FFT results so that the zero-frequency component appears in the centre of the image, rather than at the edges""", + ) + + # Options for gradient filter: + stdev: list[float] | None = shell.arg( + default=None, + argstr="-stdev", + help="""the standard deviation of the Gaussian kernel used to smooth the input image (in mm). The image is smoothed to reduced large spurious gradients caused by noise. Use this option to override the default stdev of 1 voxel. This can be specified either as a single value to be used for all 3 axes, or as a comma-separated list of 3 values (one for each axis).""", + sep=",", + ) + magnitude: bool = shell.arg( + default=False, + argstr="-magnitude", + help="""output the gradient magnitude, rather than the default x,y,z components""", + ) + scanner: bool = shell.arg( + default=False, + argstr="-scanner", + help="""define the gradient with respect to the scanner coordinate frame of reference.""", + ) + + # Options for median filter: + extent: list[int] | None = shell.arg( + default=None, + argstr="-extent", + help="""specify extent of median filtering neighbourhood in voxels. This can be specified either as a single value to be used for all 3 axes, or as a comma-separated list of 3 values (one for each axis) (default: 3x3x3).""", + sep=",", + ) + + # Options for normalisation filter: + extent: list[int] | None = shell.arg( + default=None, + argstr="-extent", + help="""specify extent of normalisation filtering neighbourhood in voxels.This can be specified either as a single value to be used for all 3 axes,or as a comma-separated list of 3 values (one for each axis) (default: 3x3x3).""", + sep=",", + ) + + # Options for smooth filter: + stdev: list[float] | None = shell.arg( + default=None, + argstr="-stdev", + help="""apply Gaussian smoothing with the specified standard deviation. The standard deviation is defined in mm (Default 1 voxel). This can be specified either as a single value to be used for all axes, or as a comma-separated list of the stdev for each axis.""", + sep=",", + ) + fwhm: list[float] | None = shell.arg( + default=None, + argstr="-fwhm", + help="""apply Gaussian smoothing with the specified full-width half maximum. The FWHM is defined in mm (Default 1 voxel * 2.3548). This can be specified either as a single value to be used for all axes, or as a comma-separated list of the FWHM for each axis.""", + sep=",", + ) + extent: list[int] | None = shell.arg( + default=None, + argstr="-extent", + help="""specify the extent (width) of kernel size in voxels. This can be specified either as a single value to be used for all axes, or as a comma-separated list of the extent for each axis. The default extent is 2 * ceil(2.5 * stdev / voxel_size) - 1.""", + sep=",", + ) + + # Options for zclean filter: + zupper: float | None = shell.arg( + default=None, + argstr="-zupper", + help="""define high intensity outliers; default: 2.5""", + ) + zlower: float | None = shell.arg( + default=None, + argstr="-zlower", + help="""define low intensity outliers; default: 2.5""", + ) + bridge: int | None = shell.arg( + default=None, + argstr="-bridge", + help="""number of voxels to gap to fill holes in mask; default: 4""", + ) + maskin: ImageIn | None = shell.arg( + default=None, + argstr="-maskin", + help="""initial mask that defines the maximum spatial extent and the region from which to smaple the intensity range.""", + ) + + # Stride options: + strides: ty.Any = shell.arg( + default=None, + argstr="-strides", + help="""specify the strides of the output data in memory; either as a comma-separated list of (signed) integers, or as a template image from which the strides shall be extracted and used. The actual strides produced will depend on whether the output image format can support it.""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + argstr="", + position=3, + path_template="out_file.mif", + help="""the output image.""", + ) + maskout: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-maskout", + path_template="maskout.mif", + help="""Output a refined mask based on a spatially coherent region with normal intensity range.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/mrgrid.py b/pydra/tasks/mrtrix3/v3_1/mrgrid.py new file mode 100644 index 0000000..f0a04c8 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mrgrid.py @@ -0,0 +1,264 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MrGrid(shell.Task["MrGrid.Outputs"]): + """- regrid: This operation performs changes of the voxel grid that require interpolation of the image such as changing the resolution or location and orientation of the voxel grid. If the image is down-sampled, the appropriate smoothing is automatically applied using Gaussian smoothing unless nearest neighbour interpolation is selected or oversample is changed explicitly. The resolution can only be changed for spatial dimensions. + + - crop: The image extent after cropping can be specified either manually for each axis dimensions, or via a mask or reference image. The image can be cropped to the extent of a mask. This is useful for axially-acquired brain images, where the image size can be reduced by a factor of 2 by removing the empty space on either side of the brain. Note that cropping does not extend the image beyond the original FOV unless explicitly specified (via -crop_unbound or negative -axis extent). + + - pad: Analogously to cropping, padding increases the FOV of an image without image interpolation. Pad and crop can be performed simultaneously by specifying signed specifier argument values to the -axis option. + + This command encapsulates and extends the functionality of the superseded commands 'mrpad', 'mrcrop' and 'mrresize'. Note the difference in -axis convention used for 'mrcrop' and 'mrpad' (see -axis option description). + + + Example usages + -------------- + + + Crop and pad the first axis: + + `$ mrgrid in.mif crop -axis 0 10,-5 out.mif` + + This removes 10 voxels on the lower and pads with 5 on the upper bound, which is equivalent to padding with the negated specifier (mrgrid in.mif pad -axis 0 -10,5 out.mif). + + + Right-pad the image to the number of voxels of a reference image: + + `$ mrgrid in.mif pad -as ref.mif -all_axes -axis 3 0,0 out.mif -fill nan` + + This pads the image on the upper bound of all axes except for the volume dimension. The headers of in.mif and ref.mif are ignored and the output image uses NAN values to fill in voxels outside the original range of in.mif. + + + Regrid and interpolate to match the voxel grid of a reference image: + + `$ mrgrid in.mif regrid -template ref.mif -scale 1,1,0.5 out.mif -fill nan` + + The -template instructs to regrid in.mif to match the voxel grid of ref.mif (voxel size, grid orientation and voxel centres). The -scale option overwrites the voxel scaling factor yielding voxel sizes in the third dimension that are twice as coarse as those of the template image. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Max Pietsch (maximilian.pietsch@kcl.ac.uk) and David Raffelt (david.raffelt@florey.edu.au) and Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mrgrid" + + # Arguments + in_file: ImageIn = shell.arg( + argstr="", + position=1, + help="""input image to be regridded.""", + ) + operation: str = shell.arg( + argstr="", + position=2, + help="""the operation to be performed; one of: regrid, crop, pad.""", + allowed_values=["regrid", "crop", "pad"], + ) + + # Options + + # Regridding options (involves image interpolation, applied to spatial axes only): + template: ImageIn | None = shell.arg( + default=None, + argstr="-template", + help="""match the input image grid (voxel spacing, image size, header transformation) to that of a reference image. The image resolution relative to the template image can be changed with one of -size, -voxel, -scale.""", + ) + size: list[int] | None = shell.arg( + default=None, + argstr="-size", + help="""define the size (number of voxels) in each spatial dimension for the output image. This should be specified as a comma-separated list.""", + sep=",", + ) + voxel: list[float] | None = shell.arg( + default=None, + argstr="-voxel", + help="""define the new voxel size for the output image. This can be specified either as a single value to be used for all spatial dimensions, or as a comma-separated list of the size for each voxel dimension.""", + sep=",", + ) + scale: list[float] | None = shell.arg( + default=None, + argstr="-scale", + help="""scale the image resolution by the supplied factor. This can be specified either as a single value to be used for all dimensions, or as a comma-separated list of scale factors for each dimension.""", + sep=",", + ) + interp: str | None = shell.arg( + default=None, + argstr="-interp", + help="""set the interpolation method to use when reslicing (choices: nearest, linear, cubic, sinc; default: cubic).""", + allowed_values=["nearest", "linear", "cubic", "sinc"], + ) + oversample: list[int] | None = shell.arg( + default=None, + argstr="-oversample", + help="""set the amount of over-sampling (in the target space) to perform when regridding. This is particularly relevant when downsamping a high-resolution image to a low-resolution image, to avoid aliasing artefacts. This can consist of a single integer, or a comma-separated list of 3 integers if different oversampling factors are desired along the different axes. Default is determined from ratio of voxel dimensions (disabled for nearest-neighbour interpolation).""", + sep=",", + ) + + # Pad and crop options (no image interpolation is performed, header transformation is adjusted): + as_: ImageIn | None = shell.arg( + default=None, + argstr="-as", + help="""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: int | None = shell.arg( + default=None, + argstr="-uniform", + help="""pad or crop the input image by a uniform number of voxels on all sides""", + ) + mask: ImageIn | None = shell.arg( + default=None, + argstr="-mask", + help="""crop the input image according to the spatial extent of a mask image. The mask must share a common voxel grid with the input image but differences in image transformations are ignored. Note that even though only 3 dimensions are cropped when using a mask, the bounds are computed by checking the extent for all dimensions. Note that by default a gap of 1 voxel is left at all edges of the image to allow valid trilinear interpolation. This gap can be modified with the -uniform option but by default it does not extend beyond the FOV unless -crop_unbound is used.""", + ) + crop_unbound: bool = shell.arg( + default=False, + argstr="-crop_unbound", + help="""Allow padding beyond the original FOV when cropping.""", + ) + axis: MultiInputObj[tuple[int, int]] | None = shell.arg( + default=None, + argstr="-axis", + help="""pad or crop the input image along the provided axis (defined by index). The specifier argument defines the number of voxels added or removed on the lower or upper end of the axis (-axis index delta_lower,delta_upper)or acts as a voxel selection range (-axis index start:stop). In both modes, values are relative to the input image (overriding all other extent-specifying options). Negative delta specifier values trigger the inverse operation (pad instead of crop and vice versa) and negative range specifier trigger padding. Note that the deprecated commands 'mrcrop' and 'mrpad' used range-based and delta-based -axis indices, respectively.""", + sep=" ", + ) + all_axes: bool = shell.arg( + default=False, + argstr="-all_axes", + help="""Crop or pad all, not just spatial axes.""", + ) + + # General options: + fill: float | None = shell.arg( + default=None, + argstr="-fill", + help="""Use number as the out of bounds value. nan, inf and -inf are valid arguments. (Default: 0.0)""", + ) + + # Stride options: + strides: ty.Any = shell.arg( + default=None, + argstr="-strides", + help="""specify the strides of the output data in memory; either as a comma-separated list of (signed) integers, or as a template image from which the strides shall be extracted and used. The actual strides produced will depend on whether the output image format can support it.""", + ) + + # Data type options: + datatype: str | None = shell.arg( + default=None, + argstr="-datatype", + help="""specify output image data type. Valid choices are: float16, float16le, float16be, float32, float32le, float32be, float64, float64le, float64be, int64, uint64, int64le, uint64le, int64be, uint64be, int32, uint32, int32le, uint32le, int32be, uint32be, int16, uint16, int16le, uint16le, int16be, uint16be, cfloat16, cfloat16le, cfloat16be, cfloat32, cfloat32le, cfloat32be, cfloat64, cfloat64le, cfloat64be, int8, uint8, bit.""", + allowed_values=[ + "float16", + "float16le", + "float16be", + "float32", + "float32le", + "float32be", + "float64", + "float64le", + "float64be", + "int64", + "uint64", + "int64le", + "uint64le", + "int64be", + "uint64be", + "int32", + "uint32", + "int32le", + "uint32le", + "int32be", + "uint32be", + "int16", + "uint16", + "int16le", + "uint16le", + "int16be", + "uint16be", + "cfloat16", + "cfloat16le", + "cfloat16be", + "cfloat32", + "cfloat32le", + "cfloat32be", + "cfloat64", + "cfloat64le", + "cfloat64be", + "int8", + "uint8", + "bit", + ], + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + argstr="", + position=3, + path_template="out_file.mif", + help="""the output image.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/mrhistmatch.py b/pydra/tasks/mrtrix3/v3_1/mrhistmatch.py new file mode 100644 index 0000000..bb63901 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mrhistmatch.py @@ -0,0 +1,126 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MrHistmatch(shell.Task["MrHistmatch.Outputs"]): + """ + References + ---------- + + * If using inverse contrast normalization for inter-modal (DWI - T1) registration: + Bhushan, C.; Haldar, J. P.; Choi, S.; Joshi, A. A.; Shattuck, D. W. & Leahy, R. M. Co-registration and distortion correction of diffusion and anatomical images based on inverse contrast normalization. NeuroImage, 2015, 115, 269-280 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mrhistmatch" + + # Arguments + type: str = shell.arg( + argstr="", + position=1, + help="""type of histogram matching to perform; options are: scale,linear,nonlinear""", + allowed_values=["scale", "linear", "nonlinear"], + ) + in_file: ImageIn = shell.arg( + argstr="", + position=2, + help="""the input image to be modified""", + ) + target: ImageIn = shell.arg( + argstr="", + position=3, + help="""the input image from which to derive the target histogram""", + ) + + # Options + + # Image masking options: + mask_input: ImageIn | None = shell.arg( + default=None, + argstr="-mask_input", + help="""only generate input histogram based on a specified binary mask image""", + ) + mask_target: ImageIn | None = shell.arg( + default=None, + argstr="-mask_target", + help="""only generate target histogram based on a specified binary mask image""", + ) + + # Non-linear histogram matching options: + bins: int | None = shell.arg( + default=None, + argstr="-bins", + help="""the number of bins to use to generate the histograms""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + argstr="", + position=4, + path_template="out_file.mif", + help="""the output image""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/mrhistogram.py b/pydra/tasks/mrtrix3/v3_1/mrhistogram.py new file mode 100644 index 0000000..b112b44 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mrhistogram.py @@ -0,0 +1,122 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MrHistogram(shell.Task["MrHistogram.Outputs"]): + """ + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mrhistogram" + + # Arguments + image_: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input image from which the histogram will be computed""", + ) + + # Options + + # Histogram generation options: + bins: int | None = shell.arg( + default=None, + argstr="-bins", + help="""Manually set the number of bins to use to generate the histogram.""", + ) + template: File | None = shell.arg( + default=None, + argstr="-template", + help="""Use an existing histogram file as the template for histogram formation""", + ) + mask: ImageIn | None = shell.arg( + default=None, + argstr="-mask", + help="""Calculate the histogram only within a mask image.""", + ) + ignorezero: bool = shell.arg( + default=False, + argstr="-ignorezero", + help="""ignore zero-valued data during histogram construction.""", + ) + + # Additional options for mrhistogram: + allvolumes: bool = shell.arg( + default=False, + argstr="-allvolumes", + help="""generate one histogram across all image volumes, rather than one per image volume""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + hist: File = shell.outarg( + argstr="", + position=2, + path_template="hist.txt", + help="""the output histogram file""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/mrinfo.py b/pydra/tasks/mrtrix3/v3_1/mrinfo.py new file mode 100644 index 0000000..6bb7abe --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mrinfo.py @@ -0,0 +1,257 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MrInfo(shell.Task["MrInfo.Outputs"]): + """By default, all information contained in each image header will be printed to the console in a reader-friendly format. + + Alternatively, command-line options may be used to extract specific details from the header(s); these are printed to the console in a format more appropriate for scripting purposes or piping to file. If multiple options and/or images are provided, the requested header fields will be printed in the order in which they appear in the help page, with all requested details from each input image in sequence printed before the next image is processed. + + The command can also write the diffusion gradient table from a single input image to file; either in the MRtrix or FSL format (bvecs/bvals file pair; includes appropriate diffusion gradient vector reorientation) + + The -dwgrad, -export_* and -shell_* options provide (information about) the diffusion weighting gradient table after it has been processed by the MRtrix3 back-end (vectors normalised, b-values scaled by the square of the vector norm, depending on the -bvalue_scaling option). To see the raw gradient table information as stored in the image header, i.e. without MRtrix3 back-end processing, use "-property dw_scheme". + + The -bvalue_scaling option controls an aspect of the import of diffusion gradient tables. When the input diffusion-weighting direction vectors have norms that differ substantially from unity, the b-values will be scaled by the square of their corresponding vector norm (this is how multi-shell acquisitions are frequently achieved on scanner platforms). However in some rare instances, the b-values may be correct, despite the vectors not being of unit norm (or conversely, the b-values may need to be rescaled even though the vectors are close to unit norm). This option allows the user to control this operation and override MRrtix3's automatic detection. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: J-Donald Tournier (jdtournier@gmail.com) and Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mrinfo" + + # Arguments + image_: MultiInputObj[ImageIn] = shell.arg( + argstr="", + position=1, + help="""the input image(s).""", + ) + + # Options + all: bool = shell.arg( + default=False, + argstr="-all", + help="""print all properties, rather than the first and last 2 of each.""", + ) + name: bool = shell.arg( + default=False, + argstr="-name", + help="""print the file system path of the image""", + ) + format: bool = shell.arg( + default=False, + argstr="-format", + help="""image file format""", + ) + ndim: bool = shell.arg( + default=False, + argstr="-ndim", + help="""number of image dimensions""", + ) + size: bool = shell.arg( + default=False, + argstr="-size", + help="""image size along each axis""", + ) + spacing: bool = shell.arg( + default=False, + argstr="-spacing", + help="""voxel spacing along each image dimension""", + ) + datatype: bool = shell.arg( + default=False, + argstr="-datatype", + help="""data type used for image data storage""", + ) + strides: bool = shell.arg( + default=False, + argstr="-strides", + help="""data strides i.e. order and direction of axes data layout""", + ) + offset: bool = shell.arg( + default=False, + argstr="-offset", + help="""image intensity offset""", + ) + multiplier: bool = shell.arg( + default=False, + argstr="-multiplier", + help="""image intensity multiplier""", + ) + transform: bool = shell.arg( + default=False, + argstr="-transform", + help="""the transformation from image coordinates [mm] to scanner / real world coordinates [mm]""", + ) + + # Options for exporting image header fields: + property: MultiInputObj[str] | None = shell.arg( + default=None, + argstr="-property", + help="""any text properties embedded in the image header under the specified key (use 'all' to list all keys found)""", + ) + + # DW gradient table import options: + grad: File | None = shell.arg( + default=None, + argstr="-grad", + help="""Provide the diffusion-weighted gradient scheme used in the acquisition in a text file. This should be supplied as a 4xN text file with each line in the format [ X Y Z b ], where [ X Y Z ] describe the direction of the applied gradient, and b gives the b-value in units of s/mm^2. If a diffusion gradient scheme is present in the input image header, the data provided with this option will be instead used.""", + ) + fslgrad: tuple[File, File] | None = shell.arg( + default=None, + argstr="-fslgrad", + help="""Provide the diffusion-weighted gradient scheme used in the acquisition in FSL bvecs/bvals format files. If a diffusion gradient scheme is present in the input image header, the data provided with this option will be instead used.""", + sep=" ", + ) + bvalue_scaling: bool = shell.arg( + default=False, + argstr="-bvalue_scaling", + help="""enable or disable scaling of diffusion b-values by the square of the corresponding DW gradient norm (see Desciption). Valid choices are: yes/no, true/false, 0/1 (default: automatic).""", + ) + + # DW gradient table export options: + dwgrad: bool = shell.arg( + default=False, + argstr="-dwgrad", + help="""the diffusion-weighting gradient table, as interpreted by MRtrix3""", + ) + shell_bvalues: bool = shell.arg( + default=False, + argstr="-shell_bvalues", + help="""list the average b-value of each shell""", + ) + shell_sizes: bool = shell.arg( + default=False, + argstr="-shell_sizes", + help="""list the number of volumes in each shell""", + ) + shell_indices: bool = shell.arg( + default=False, + argstr="-shell_indices", + help="""list the image volumes attributed to each b-value shell""", + ) + + # Options for exporting phase-encode tables: + petable: bool = shell.arg( + default=False, + argstr="-petable", + help="""print the phase encoding table""", + ) + + # Handling of piped images: + nodelete: bool = shell.arg( + default=False, + argstr="-nodelete", + help="""don't delete temporary images or images passed to mrinfo via Unix pipes""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + json_keyval: File | bool | None = shell.outarg( + default=None, + argstr="-json_keyval", + path_template="json_keyval.txt", + help="""export header key/value entries to a JSON file""", + ) + json_all: File | bool | None = shell.outarg( + default=None, + argstr="-json_all", + path_template="json_all.txt", + help="""export all header contents to a JSON file""", + ) + export_grad_mrtrix: File | bool | None = shell.outarg( + default=None, + argstr="-export_grad_mrtrix", + path_template="export_grad_mrtrix.txt", + help="""export the diffusion-weighted gradient table to file in MRtrix format""", + ) + export_grad_fsl: tuple[File, File] | bool | None = shell.outarg( + default=None, + argstr="-export_grad_fsl", + path_template=( + "export_grad_fsl0.txt", + "export_grad_fsl1.txt", + ), + help="""export the diffusion-weighted gradient table to files in FSL (bvecs / bvals) format""", + sep=" ", + ) + export_pe_table: File | bool | None = shell.outarg( + default=None, + argstr="-export_pe_table", + path_template="export_pe_table.txt", + help="""export phase-encoding table to file""", + ) + export_pe_eddy: tuple[File, File] | bool | None = shell.outarg( + default=None, + argstr="-export_pe_eddy", + path_template=( + "export_pe_eddy0.txt", + "export_pe_eddy1.txt", + ), + help="""export phase-encoding information to an EDDY-style config / index file pair""", + sep=" ", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/mrmath.py b/pydra/tasks/mrtrix3/v3_1/mrmath.py new file mode 100644 index 0000000..4b6e3df --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mrmath.py @@ -0,0 +1,194 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MrMath(shell.Task["MrMath.Outputs"]): + """Supported operations are: + + mean, median, sum, product, rms (root-mean-square value), norm (vector 2-norm), var (unbiased variance), std (unbiased standard deviation), min, max, absmax (maximum absolute value), magmax (value with maximum absolute value, preserving its sign). + + This command is used to traverse either along an image axis, or across a set of input images, calculating some statistic from the values along each traversal. If you are seeking to instead perform mathematical calculations that are done independently for each voxel, pleaase see the 'mrcalc' command. + + + Example usages + -------------- + + + Calculate a 3D volume representing the mean intensity across a 4D image series: + + `$ mrmath 4D.mif mean 3D_mean.mif -axis 3` + + This is a common operation for calculating e.g. the mean value within a specific DWI b-value. Note that axis indices start from 0; thus, axes 0, 1 & 2 are the three spatial axes, and axis 3 operates across volumes. + + + Generate a Maximum Intensity Projection (MIP) along the inferior-superior direction: + + `$ mrmath input.mif max MIP.mif -axis 2` + + Since a MIP is literally the maximal value along a specific projection direction, axis-aligned MIPs can be generated easily using mrmath with the 'max' operation. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: J-Donald Tournier (jdtournier@gmail.com) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mrmath" + + # Arguments + in_file: MultiInputObj[ImageIn] = shell.arg( + argstr="", + position=1, + help="""the input image(s).""", + ) + operation: str = shell.arg( + argstr="", + position=2, + help="""the operation to apply; one of: mean, median, sum, product, rms, norm, var, std, min, max, absmax, magmax.""", + allowed_values=[ + "mean", + "median", + "sum", + "product", + "rms", + "norm", + "var", + "std", + "min", + "max", + "absmax", + "magmax", + ], + ) + + # Options + axis: int | None = shell.arg( + default=None, + argstr="-axis", + help="""perform operation along a specified axis of a single input image""", + ) + keep_unary_axes: bool = shell.arg( + default=False, + argstr="-keep_unary_axes", + help="""Keep unary axes in input images prior to calculating the stats. The default is to wipe axes with single elements.""", + ) + + # Data type options: + datatype: str | None = shell.arg( + default=None, + argstr="-datatype", + help="""specify output image data type. Valid choices are: float16, float16le, float16be, float32, float32le, float32be, float64, float64le, float64be, int64, uint64, int64le, uint64le, int64be, uint64be, int32, uint32, int32le, uint32le, int32be, uint32be, int16, uint16, int16le, uint16le, int16be, uint16be, cfloat16, cfloat16le, cfloat16be, cfloat32, cfloat32le, cfloat32be, cfloat64, cfloat64le, cfloat64be, int8, uint8, bit.""", + allowed_values=[ + "float16", + "float16le", + "float16be", + "float32", + "float32le", + "float32be", + "float64", + "float64le", + "float64be", + "int64", + "uint64", + "int64le", + "uint64le", + "int64be", + "uint64be", + "int32", + "uint32", + "int32le", + "uint32le", + "int32be", + "uint32be", + "int16", + "uint16", + "int16le", + "uint16le", + "int16be", + "uint16be", + "cfloat16", + "cfloat16le", + "cfloat16be", + "cfloat32", + "cfloat32le", + "cfloat32be", + "cfloat64", + "cfloat64le", + "cfloat64be", + "int8", + "uint8", + "bit", + ], + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + argstr="", + position=3, + path_template="out_file.mif", + help="""the output image.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/mrmetric.py b/pydra/tasks/mrtrix3/v3_1/mrmetric.py new file mode 100644 index 0000000..4919834 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mrmetric.py @@ -0,0 +1,133 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MrMetric(shell.Task["MrMetric.Outputs"]): + """Currently only the mean squared difference is fully implemented. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) and Max Pietsch (maximilian.pietsch@kcl.ac.uk) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mrmetric" + + # Arguments + image1: ImageIn = shell.arg( + argstr="", + position=1, + help="""the first input image.""", + ) + image2: ImageIn = shell.arg( + argstr="", + position=2, + help="""the second input image.""", + ) + + # Options + space: str | None = shell.arg( + default=None, + argstr="-space", + help="""Image "space" in which the metric will be computed. Options are: voxel: per voxel; image1: scanner space of image 1; image2: scanner space of image 2; average: scanner space of the average affine transformation of image 1 and 2; default: voxel.""", + allowed_values=["voxel", "image1", "image2", "average"], + ) + interp: str | None = shell.arg( + default=None, + argstr="-interp", + help="""set the interpolation method to use when reslicing (choices: nearest, linear, cubic, sinc. Default: linear).""", + allowed_values=["nearest", "linear", "cubic", "sinc"], + ) + metric: str | None = shell.arg( + default=None, + argstr="-metric", + help="""define the dissimilarity metric used to calculate the cost. Choices: diff (squared differences); cc (non-normalised negative cross correlation aka negative cross covariance). Default: diff). cc is only implemented for -space average and -interp linear and cubic.""", + allowed_values=["diff", "cc"], + ) + mask1: ImageIn | None = shell.arg( + default=None, + argstr="-mask1", + help="""mask for image 1""", + ) + mask2: ImageIn | None = shell.arg( + default=None, + argstr="-mask2", + help="""mask for image 2""", + ) + nonormalisation: bool = shell.arg( + default=False, + argstr="-nonormalisation", + help="""do not normalise the dissimilarity metric to the number of voxels.""", + ) + overlap: bool = shell.arg( + default=False, + argstr="-overlap", + help="""output number of voxels that were used.""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + pass diff --git a/pydra/tasks/mrtrix3/v3_1/mrregister.py b/pydra/tasks/mrtrix3/v3_1/mrregister.py new file mode 100644 index 0000000..8028064 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mrregister.py @@ -0,0 +1,505 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MrRegister(shell.Task["MrRegister.Outputs"]): + """By default this application will perform an affine, followed by non-linear registration. + + FOD registration (with apodised point spread reorientation) will be performed by default if the number of volumes in the 4th dimension equals the number of coefficients in an antipodally symmetric spherical harmonic series (e.g. 6, 15, 28 etc). The -no_reorientation option can be used to force reorientation off if required. + + Non-linear registration computes warps to map from both image1->image2 and image2->image1. Similar to Avants (2008) Med Image Anal. 12(1): 26-41, registration is performed by matching both the image1 and image2 in a 'midway space'. Warps can be saved as two deformation fields that map directly between image1->image2 and image2->image1, or if using -nl_warp_full as a single 5D file that stores all 4 warps image1->mid->image2, and image2->mid->image1. The 5D warp format stores x,y,z deformations in the 4th dimension, and uses the 5th dimension to index the 4 warps. The affine transforms estimated (to midway space) are also stored as comments in the image header. The 5D warp file can be used to reinitialise subsequent registrations, in addition to transforming images to midway space (e.g. for intra-subject alignment in a 2-time-point longitudinal analysis). + + + References + ---------- + + * If FOD registration is being performed: + Raffelt, D.; Tournier, J.-D.; Fripp, J; Crozier, S.; Connelly, A. & Salvado, O. Symmetric diffeomorphic registration of fibre orientation distributions. NeuroImage, 2011, 56(3), 1171-1180 + + Raffelt, D.; Tournier, J.-D.; Crozier, S.; Connelly, A. & Salvado, O. Reorientation of fiber orientation distributions using apodized point spread functions. Magnetic Resonance in Medicine, 2012, 67, 844-855 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) and Max Pietsch (maximilian.pietsch@kcl.ac.uk) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mrregister" + + # Arguments + image1_image2: ImageIn = shell.arg( + argstr="", + position=1, + help="""input image 1 ('moving') and input image 2 ('template')""", + ) + contrast1_contrast2: MultiInputObj[ImageIn] | None = shell.arg( + argstr="", + position=2, + default=None, + help="""optional list of additional input images used as additional contrasts. Can be used multiple times. contrastX and imageX must share the same coordinate system.""", + ) + + # Options + type: str | None = shell.arg( + default=None, + argstr="-type", + help="""the registration type. Valid choices are: rigid, affine, nonlinear, rigid_affine, rigid_nonlinear, affine_nonlinear, rigid_affine_nonlinear (Default: affine_nonlinear)""", + allowed_values=[ + "rigid", + "affine", + "nonlinear", + "rigid_affine", + "rigid_nonlinear", + "affine_nonlinear", + "rigid_affine_nonlinear", + ], + ) + mask1: ImageIn | None = shell.arg( + default=None, + argstr="-mask1", + help="""a mask to define the region of image1 to use for optimisation.""", + ) + mask2: ImageIn | None = shell.arg( + default=None, + argstr="-mask2", + help="""a mask to define the region of image2 to use for optimisation.""", + ) + nan: bool = shell.arg( + default=False, + argstr="-nan", + help="""use NaN as out of bounds value. (Default: 0.0)""", + ) + + # Rigid registration options: + rigid_init_translation: str | None = shell.arg( + default=None, + argstr="-rigid_init_translation", + help="""initialise the translation and centre of rotation; Valid choices are: mass (aligns the centers of mass of both images, default); geometric (aligns geometric image centres); none.""", + allowed_values=["mass", "geometric", "none"], + ) + rigid_init_rotation: str | None = shell.arg( + default=None, + argstr="-rigid_init_rotation", + help="""Method to use to initialise the rotation. Valid choices are: search (search for the best rotation using mean squared residuals); moments (rotation based on directions of intensity variance with respect to centre of mass); none (default).""", + allowed_values=["search", "moments", "none"], + ) + rigid_init_matrix: File | None = shell.arg( + default=None, + argstr="-rigid_init_matrix", + help="""initialise either the rigid, affine, or syn registration with the supplied rigid transformation (as a 4x4 matrix in scanner coordinates).Note that this overrides rigid_init_translation and rigid_init_rotation initialisation""", + ) + rigid_scale: list[float] | None = shell.arg( + default=None, + argstr="-rigid_scale", + help="""use a multi-resolution scheme by defining a scale factor for each level using comma-separated values (Default: 0.25,0.5,1.0)""", + sep=",", + ) + rigid_niter: list[int] | None = shell.arg( + default=None, + argstr="-rigid_niter", + help="""the maximum number of gradient descent iterations per stage. This can be specified either as a single number for all multi-resolution levels, or a single value for each level. (Default: 1000)""", + sep=",", + ) + rigid_metric: str | None = shell.arg( + default=None, + argstr="-rigid_metric", + help="""valid choices are: diff (intensity differences); Default: diff""", + allowed_values=["diff", "ncc"], + ) + rigid_metric_diff_estimator: str | None = shell.arg( + default=None, + argstr="-rigid_metric.diff.estimator", + help="""Robust estimator to use during rigid-body registration. Valid choices are: l1 (least absolute: |x|); l2 (ordinary least squares); lp (least powers: |x|^1.2); none. Default: none.""", + allowed_values=["l1", "l2", "lp", "none"], + ) + rigid_lmax: list[int] | None = shell.arg( + default=None, + argstr="-rigid_lmax", + help="""explicitly set the lmax to be used per scale factor in rigid FOD registration. By default, FOD registration will use lmax 0,2,4 with default scale factors 0.25,0.5,1.0 respectively. Note that no reorientation will be performed with lmax = 0.""", + sep=",", + ) + + # Affine registration options: + affine_init_translation: str | None = shell.arg( + default=None, + argstr="-affine_init_translation", + help="""initialise the translation and centre of rotation. Valid choices are: mass (aligns the centers of mass of both images); geometric (aligns geometric image centres); none. (Default: mass)""", + allowed_values=["mass", "geometric", "none"], + ) + affine_init_rotation: str | None = shell.arg( + default=None, + argstr="-affine_init_rotation", + help="""initialise the rotation. Valid choices are: search (search for the best rotation using mean squared residuals); moments (rotation based on directions of intensity variance with respect to centre of mass); none (Default: none).""", + allowed_values=["search", "moments", "none"], + ) + affine_init_matrix: File | None = shell.arg( + default=None, + argstr="-affine_init_matrix", + help="""initialise either the affine or syn registration with the supplied affine transformation (as a 4x4 matrix in scanner coordinates). Note that this overrides affine_init_translation and affine_init_rotation initialisation""", + ) + affine_scale: list[float] | None = shell.arg( + default=None, + argstr="-affine_scale", + help="""use a multi-resolution scheme by defining a scale factor for each level using comma separated values (Default: 0.25,0.5,1.0)""", + sep=",", + ) + affine_niter: list[int] | None = shell.arg( + default=None, + argstr="-affine_niter", + help="""the maximum number of gradient descent iterations per stage. This can be specified either as a single number for all multi-resolution levels, or a single value for each level. (Default: 1000)""", + sep=",", + ) + affine_metric: str | None = shell.arg( + default=None, + argstr="-affine_metric", + help="""valid choices are: diff (intensity differences); Default: diff""", + allowed_values=["diff", "ncc"], + ) + affine_metric_diff_estimator: str | None = shell.arg( + default=None, + argstr="-affine_metric.diff.estimator", + help="""Robust estimator to use durring affine registration. Valid choices are: l1 (least absolute: |x|); l2 (ordinary least squares); lp (least powers: |x|^1.2); none. Default: none.""", + allowed_values=["l1", "l2", "lp", "none"], + ) + affine_lmax: list[int] | None = shell.arg( + default=None, + argstr="-affine_lmax", + help="""explicitly set the lmax to be used per scale factor in affine FOD registration. By default FOD registration will use lmax 0,2,4 with default scale factors 0.25,0.5,1.0 respectively. Note that no reorientation will be performed with lmax = 0.""", + sep=",", + ) + + # Advanced linear transformation initialisation options: + init_translation_unmasked1: bool = shell.arg( + default=False, + argstr="-init_translation.unmasked1", + help="""disregard mask1 for the translation initialisation (affects 'mass')""", + ) + init_translation_unmasked2: bool = shell.arg( + default=False, + argstr="-init_translation.unmasked2", + help="""disregard mask2 for the translation initialisation (affects 'mass')""", + ) + init_rotation_unmasked1: bool = shell.arg( + default=False, + argstr="-init_rotation.unmasked1", + help="""disregard mask1 for the rotation initialisation (affects 'search' and 'moments')""", + ) + init_rotation_unmasked2: bool = shell.arg( + default=False, + argstr="-init_rotation.unmasked2", + help="""disregard mask2 for the rotation initialisation (affects 'search' and 'moments')""", + ) + init_rotation_search_angles: list[float] | None = shell.arg( + default=None, + argstr="-init_rotation.search.angles", + help="""rotation angles for the local search in degrees between 0 and 180. (Default: 2,5,10,15,20)""", + sep=",", + ) + init_rotation_search_scale: float | None = shell.arg( + default=None, + argstr="-init_rotation.search.scale", + help="""relative size of the images used for the rotation search. (Default: 0.15)""", + ) + init_rotation_search_directions: int | None = shell.arg( + default=None, + argstr="-init_rotation.search.directions", + help="""number of rotation axis for local search. (Default: 250)""", + ) + init_rotation_search_run_global: bool = shell.arg( + default=False, + argstr="-init_rotation.search.run_global", + help="""perform a global rather than local initial rotation search.""", + ) + init_rotation_search_global_iterations: int | None = shell.arg( + default=None, + argstr="-init_rotation.search.global.iterations", + help="""number of rotations to investigate (Default: 10000)""", + ) + + # Advanced linear registration stage options: + linstage_iterations: list[int] | None = shell.arg( + default=None, + argstr="-linstage.iterations", + help="""number of iterations for each registration stage. Not to be confused with -rigid_niter or -affine_niter. This can be used to generate intermediate diagnostics images (-linstage.diagnostics.prefix) or to change the cost function optimiser during registration (without the need to repeatedly resize the images). (Default: 1 == no repetition)""", + sep=",", + ) + linstage_optimiser_first: str | None = shell.arg( + default=None, + argstr="-linstage.optimiser.first", + help="""Cost function optimisation algorithm to use at first iteration of all stages. Valid choices: bbgd (Barzilai-Borwein gradient descent); gd (simple gradient descent). (Default: bbgd)""", + allowed_values=["bbgd", "gd"], + ) + linstage_optimiser_last: str | None = shell.arg( + default=None, + argstr="-linstage.optimiser.last", + help="""Cost function optimisation algorithm to use at last iteration of all stages (if there are more than one). Valid choices: bbgd (Barzilai-Borwein gradient descent); gd (simple gradient descent). (Default: bbgd)""", + allowed_values=["bbgd", "gd"], + ) + linstage_optimiser_default: str | None = shell.arg( + default=None, + argstr="-linstage.optimiser.default", + help="""Cost function optimisation algorithm to use at any stage iteration other than first or last iteration. Valid choices: bbgd (Barzilai-Borwein gradient descent); gd (simple gradient descent). (Default: bbgd)""", + allowed_values=["bbgd", "gd"], + ) + linstage_diagnostics_prefix: str | None = shell.arg( + default=None, + argstr="-linstage.diagnostics.prefix", + help="""generate diagnostics images after every registration stage""", + ) + + # Non-linear registration options: + nl_init: ImageIn | None = shell.arg( + default=None, + argstr="-nl_init", + help="""initialise the non-linear registration with the supplied warp image. The supplied warp must be in the same format as output using the -nl_warp_full option (i.e. have 4 deformation fields with the linear transforms in the image header)""", + ) + nl_scale: list[float] | None = shell.arg( + default=None, + argstr="-nl_scale", + help="""use a multi-resolution scheme by defining a scale factor for each level using comma separated values (Default: 0.25,0.5,1.0)""", + sep=",", + ) + nl_niter: list[int] | None = shell.arg( + default=None, + argstr="-nl_niter", + help="""the maximum number of iterations. This can be specified either as a single number for all multi-resolution levels, or a single value for each level. (Default: 50)""", + sep=",", + ) + nl_update_smooth: float | None = shell.arg( + default=None, + argstr="-nl_update_smooth", + help="""regularise the gradient update field with Gaussian smoothing (standard deviation in voxel units; Default 2.0)""", + ) + nl_disp_smooth: float | None = shell.arg( + default=None, + argstr="-nl_disp_smooth", + help="""regularise the displacement field with Gaussian smoothing (standard deviation in voxel units; Default 1.0)""", + ) + nl_grad_step: float | None = shell.arg( + default=None, + argstr="-nl_grad_step", + help="""the gradient step size for non-linear registration (Default: 0.5)""", + ) + nl_lmax: list[int] | None = shell.arg( + default=None, + argstr="-nl_lmax", + help="""explicitly set the lmax to be used per scale factor in non-linear FOD registration. By default, FOD registration will use lmax 0,2,4 with default scale factors 0.25,0.5,1.0 respectively. Note that no reorientation will be performed with lmax = 0.""", + sep=",", + ) + diagnostics_image: ty.Any = shell.arg( + default=None, + argstr="-diagnostics_image", + help="""write intermediate images for diagnostics purposes""", + ) + + # FOD registration options: + directions: File | None = shell.arg( + default=None, + argstr="-directions", + help="""file containing the directions used for FOD reorientation using apodised point spread functions (Default: built-in 60-direction set)""", + ) + noreorientation: bool = shell.arg( + default=False, + argstr="-noreorientation", + help="""turn off FOD reorientation. Reorientation is on by default if the number of volumes in the 4th dimension corresponds to the number of coefficients in an antipodally symmetric spherical harmonic series (i.e. 6, 15, 28, 45, 66 etc)""", + ) + + # Multi-contrast options: + mc_weights: list[float] | None = shell.arg( + default=None, + argstr="-mc_weights", + help="""relative weight of images used for multi-contrast registration. Default: 1.0 (equal weighting)""", + sep=",", + ) + + # Data type options: + datatype: str | None = shell.arg( + default=None, + argstr="-datatype", + help="""specify output image data type. Valid choices are: float16, float16le, float16be, float32, float32le, float32be, float64, float64le, float64be, int64, uint64, int64le, uint64le, int64be, uint64be, int32, uint32, int32le, uint32le, int32be, uint32be, int16, uint16, int16le, uint16le, int16be, uint16be, cfloat16, cfloat16le, cfloat16be, cfloat32, cfloat32le, cfloat32be, cfloat64, cfloat64le, cfloat64be, int8, uint8, bit.""", + allowed_values=[ + "float16", + "float16le", + "float16be", + "float32", + "float32le", + "float32be", + "float64", + "float64le", + "float64be", + "int64", + "uint64", + "int64le", + "uint64le", + "int64be", + "uint64be", + "int32", + "uint32", + "int32le", + "uint32le", + "int32be", + "uint32be", + "int16", + "uint16", + "int16le", + "uint16le", + "int16be", + "uint16be", + "cfloat16", + "cfloat16le", + "cfloat16be", + "cfloat32", + "cfloat32le", + "cfloat32be", + "cfloat64", + "cfloat64le", + "cfloat64be", + "int8", + "uint8", + "bit", + ], + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + transformed: MultiInputObj[ImageOut] | bool | None = shell.outarg( + default=None, + argstr="-transformed", + path_template="transformed.mif", + help="""image1 after registration transformed and regridded to the space of image2. Note that -transformed needs to be repeated for each contrast if multi-contrast registration is used.""", + ) + transformed_midway: MultiInputObj[ + tuple[ImageOut, ImageOut] + ] | bool | None = shell.outarg( + default=None, + argstr="-transformed_midway", + path_template=( + "transformed_midway0.mif", + "transformed_midway1.mif", + ), + help="""image1 and image2 after registration transformed and regridded to the midway space. Note that -transformed_midway needs to be repeated for each contrast if multi-contrast registration is used.""", + sep=" ", + ) + rigid: File | bool | None = shell.outarg( + default=None, + argstr="-rigid", + path_template="rigid.txt", + help="""the output text file containing the rigid transformation as a 4x4 matrix""", + ) + rigid_1tomidway: File | bool | None = shell.outarg( + default=None, + argstr="-rigid_1tomidway", + path_template="rigid_1tomidway.txt", + help="""the output text file containing the rigid transformation that aligns image1 to image2 in their common midway space as a 4x4 matrix""", + ) + rigid_2tomidway: File | bool | None = shell.outarg( + default=None, + argstr="-rigid_2tomidway", + path_template="rigid_2tomidway.txt", + help="""the output text file containing the rigid transformation that aligns image2 to image1 in their common midway space as a 4x4 matrix""", + ) + rigid_log: File | bool | None = shell.outarg( + default=None, + argstr="-rigid_log", + path_template="rigid_log.txt", + help="""write gradient descent parameter evolution to log file""", + ) + affine: File | bool | None = shell.outarg( + default=None, + argstr="-affine", + path_template="affine.txt", + help="""the output text file containing the affine transformation as a 4x4 matrix""", + ) + affine_1tomidway: File | bool | None = shell.outarg( + default=None, + argstr="-affine_1tomidway", + path_template="affine_1tomidway.txt", + help="""the output text file containing the affine transformation that aligns image1 to image2 in their common midway space as a 4x4 matrix""", + ) + affine_2tomidway: File | bool | None = shell.outarg( + default=None, + argstr="-affine_2tomidway", + path_template="affine_2tomidway.txt", + help="""the output text file containing the affine transformation that aligns image2 to image1 in their common midway space as a 4x4 matrix""", + ) + affine_log: File | bool | None = shell.outarg( + default=None, + argstr="-affine_log", + path_template="affine_log.txt", + help="""write gradient descent parameter evolution to log file""", + ) + nl_warp: tuple[ImageOut, ImageOut] | bool | None = shell.outarg( + default=None, + argstr="-nl_warp", + path_template=( + "nl_warp0.mif", + "nl_warp1.mif", + ), + help="""the non-linear warp output defined as two deformation fields, where warp1 can be used to transform image1->image2 and warp2 to transform image2->image1. The deformation fields also encapsulate any linear transformation estimated prior to non-linear registration.""", + sep=" ", + ) + nl_warp_full: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-nl_warp_full", + path_template="nl_warp_full.mif", + help="""output all warps used during registration. This saves four different warps that map each image to a midway space and their inverses in a single 5D image file. The 4th image dimension indexes the x,y,z component of the deformation vector and the 5th dimension indexes the field in this order: image1->midway, midway->image1, image2->midway, midway->image2. Where image1->midway defines the field that maps image1 onto the midway space using the reverse convention. When linear registration is performed first, the estimated linear transform will be included in the comments of the image header, and therefore the entire linear and non-linear transform can be applied (in either direction) using this output warp file with mrtransform""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/mrstats.py b/pydra/tasks/mrtrix3/v3_1/mrstats.py new file mode 100644 index 0000000..6ca9f91 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mrstats.py @@ -0,0 +1,113 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MrStats(shell.Task["MrStats.Outputs"]): + """ + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: J-Donald Tournier (jdtournier@gmail.com) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mrstats" + + # Arguments + image_: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input image from which statistics will be computed.""", + ) + + # Options + + # Statistics options: + output: MultiInputObj[str] | None = shell.arg( + default=None, + argstr="-output", + help="""output only the field specified. Multiple such options can be supplied if required. Choices are: mean, median, std, std_rv, min, max, count. Useful for use in scripts. Both std options refer to the unbiased (sample) standard deviation. For complex data, min, max and std are calculated separately for real and imaginary parts, std_rv is based on the real valued variance (equals sqrt of sum of variances of imaginary and real parts).""", + allowed_values=["mean", "median", "std", "std_rv", "min", "max", "count"], + ) + mask: ImageIn | None = shell.arg( + default=None, + argstr="-mask", + help="""only perform computation within the specified binary mask image.""", + ) + ignorezero: bool = shell.arg( + default=False, + argstr="-ignorezero", + help="""ignore zero values during statistics calculation""", + ) + + # Additional options for mrstats: + allvolumes: bool = shell.arg( + default=False, + argstr="-allvolumes", + help="""generate statistics across all image volumes, rather than one set of statistics per image volume""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + pass diff --git a/pydra/tasks/mrtrix3/v3_1/mrthreshold.py b/pydra/tasks/mrtrix3/v3_1/mrthreshold.py new file mode 100644 index 0000000..87fd5fc --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mrthreshold.py @@ -0,0 +1,167 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MrThreshold(shell.Task["MrThreshold.Outputs"]): + """The threshold value to be applied can be determined in one of a number of ways: if no relevant command-line option is used, the command will automatically determine an optimal threshold; the -abs option provides the threshold value explicitly; the -percentile, -top and -bottom options enable more fine-grained control over how the threshold value is determined. + + The -mask option only influences those image values that contribute toward the determination of the threshold value; once the threshold is determined, it is applied to the entire image, irrespective of use of the -mask option. If you wish for the voxels outside of the specified mask to additionally be excluded from the output mask, this can be achieved by providing the -out_masked option. + + The four operators available through the "-comparison" option ("lt", "le", "ge" and "gt") correspond to: "less-than" (<), "less-than-or-equal" (<=), "greater-than-or-equal" (>=), and "greater-than" (>). This offers fine-grained control over how the thresholding operation will behave in the presence of values equivalent to the threshold. By default, the command will select voxels with values greater than or equal to the determined threshold ("ge"); unless the -bottom option is used, in which case after a threshold is determined from the relevant lowest-valued image voxels, those voxels with values less than or equal to that threshold ("le") are selected. This provides more fine-grained control than the -invert option; the latter is provided for backwards compatibility, but is equivalent to selection of the opposite comparison within this selection. + + If no output image path is specified, the command will instead write to standard output the determined threshold value. + + + References + ---------- + + * If not using any explicit thresholding mechanism: + Ridgway, G. R.; Omar, R.; Ourselin, S.; Hill, D. L.; Warren, J. D. & Fox, N. C. Issues with threshold masking in voxel-based morphometry of atrophied brains. NeuroImage, 2009, 44, 99-111 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) and J-Donald Tournier (jdtournier@gmail.com) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mrthreshold" + + # Arguments + in_file: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input image to be thresholded""", + ) + + # Options + + # Threshold determination mechanisms: + abs: float | None = shell.arg( + default=None, + argstr="-abs", + help="""specify threshold value as absolute intensity""", + ) + percentile: float | None = shell.arg( + default=None, + argstr="-percentile", + help="""determine threshold based on some percentile of the image intensity distribution""", + ) + top: int | None = shell.arg( + default=None, + argstr="-top", + help="""determine threshold that will result in selection of some number of top-valued voxels""", + ) + bottom: int | None = shell.arg( + default=None, + argstr="-bottom", + help="""determine & apply threshold resulting in selection of some number of bottom-valued voxels (note: implies threshold application operator of "le" unless otherwise specified)""", + ) + + # Threshold determination modifiers: + allvolumes: bool = shell.arg( + default=False, + argstr="-allvolumes", + help="""compute a single threshold for all image volumes, rather than an individual threshold per volume""", + ) + ignorezero: bool = shell.arg( + default=False, + argstr="-ignorezero", + help="""ignore zero-valued input values during threshold determination""", + ) + mask: ImageIn | None = shell.arg( + default=None, + argstr="-mask", + help="""compute the threshold based only on values within an input mask image""", + ) + + # Threshold application modifiers: + comparison: str | None = shell.arg( + default=None, + argstr="-comparison", + help="""comparison operator to use when applying the threshold; options are: lt,le,ge,gt (default = "le" for -bottom; "ge" otherwise)""", + allowed_values=["lt", "le", "ge", "gt"], + ) + invert: bool = shell.arg( + default=False, + argstr="-invert", + help="""invert the output binary mask (equivalent to flipping the operator; provided for backwards compatibility)""", + ) + out_masked: bool = shell.arg( + default=False, + argstr="-out_masked", + help="""mask the output image based on the provided input mask image""", + ) + nan: bool = shell.arg( + default=False, + argstr="-nan", + help="""set voxels that fail the threshold to NaN rather than zero (output image will be floating-point rather than binary)""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut | None = shell.outarg( + argstr="", + position=2, + default=None, + path_template="out_file.mif", + help="""the (optional) output binary image mask""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/mrtransform.py b/pydra/tasks/mrtrix3/v3_1/mrtransform.py new file mode 100644 index 0000000..ac04568 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mrtransform.py @@ -0,0 +1,299 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MrTransform(shell.Task["MrTransform.Outputs"]): + """If a linear transform is applied without a template image, the command will modify the image header transform matrix + + FOD reorientation (with apodised point spread functions) can be performed if the number of volumes in the 4th dimension equals the number of coefficients in an antipodally symmetric spherical harmonic series (e.g. 6, 15, 28 etc). For such data, the -reorient_fod yes/no option must be used to specify if reorientation is required. + + The output image intensity can be modulated using the (local or global) volume change if a linear or nonlinear transformation is applied. 'FOD' modulation preserves the apparent fibre density across the fibre bundle width and can only be applied if FOD reorientation is used. Alternatively, non-directional scaling by the Jacobian determinant can be applied to any image type. + + If a DW scheme is contained in the header (or specified separately), and the number of directions matches the number of volumes in the images, any transformation applied using the -linear option will also be applied to the directions. + + When the -template option is used to specify the target image grid, the image provided via this option will not influence the axis data strides of the output image; these are determined based on the input image, or the input to the -strides option. + + + References + ---------- + + * If FOD reorientation is being performed: + Raffelt, D.; Tournier, J.-D.; Crozier, S.; Connelly, A. & Salvado, O. Reorientation of fiber orientation distributions using apodized point spread functions. Magnetic Resonance in Medicine, 2012, 67, 844-855 + + * If FOD modulation is being performed: + Raffelt, D.; Tournier, J.-D.; Rose, S.; Ridgway, G.R.; Henderson, R.; Crozier, S.; Salvado, O.; Connelly, A.; Apparent Fibre Density: a novel measure for the analysis of diffusion-weighted magnetic resonance images. NeuroImage, 2012, 15;59(4), 3976-94 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: J-Donald Tournier (jdtournier@gmail.com) and David Raffelt (david.raffelt@florey.edu.au) and Max Pietsch (maximilian.pietsch@kcl.ac.uk) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mrtransform" + + # Arguments + in_file: ImageIn = shell.arg( + argstr="", + position=1, + help="""input image to be transformed.""", + ) + + # Options + + # Affine transformation options: + linear: File | None = shell.arg( + default=None, + argstr="-linear", + help="""specify a linear transform to apply, in the form of a 3x4 or 4x4 ascii file. Note the standard 'reverse' convention is used, where the transform maps points in the template image to the moving image. Note that the reverse convention is still assumed even if no -template image is supplied""", + ) + flip: list[int] | None = shell.arg( + default=None, + argstr="-flip", + help="""flip the specified axes, provided as a comma-separated list of indices (0:x, 1:y, 2:z).""", + sep=",", + ) + inverse: bool = shell.arg( + default=False, + argstr="-inverse", + help="""apply the inverse transformation""", + ) + half: bool = shell.arg( + default=False, + argstr="-half", + help="""apply the matrix square root of the transformation. This can be combined with the inverse option.""", + ) + replace: File | None = shell.arg( + default=None, + argstr="-replace", + help="""replace the linear transform of the original image by that specified, rather than applying it to the original image. The specified transform can be either a template image, or a 3x4 or 4x4 ascii file.""", + ) + identity: bool = shell.arg( + default=False, + argstr="-identity", + help="""set the header transform of the image to the identity matrix""", + ) + + # Regridding options: + template: ImageIn | None = shell.arg( + default=None, + argstr="-template", + help="""reslice the input image to match the specified template image grid.""", + ) + midway_space: bool = shell.arg( + default=False, + argstr="-midway_space", + help="""reslice the input image to the midway space. Requires either the -template or -warp option. If used with -template and -linear option, the input image will be resliced onto the grid halfway between the input and template. If used with the -warp option, the input will be warped to the midway space defined by the grid of the input warp (i.e. half way between image1 and image2)""", + ) + interp: str | None = shell.arg( + default=None, + argstr="-interp", + help="""set the interpolation method to use when reslicing (choices: nearest, linear, cubic, sinc. Default: cubic).""", + allowed_values=["nearest", "linear", "cubic", "sinc"], + ) + oversample: list[int] | None = shell.arg( + default=None, + argstr="-oversample", + help="""set the amount of over-sampling (in the target space) to perform when regridding. This is particularly relevant when downsamping a high-resolution image to a low-resolution image, to avoid aliasing artefacts. This can consist of a single integer, or a comma-separated list of 3 integers if different oversampling factors are desired along the different axes. Default is determined from ratio of voxel dimensions (disabled for nearest-neighbour interpolation).""", + sep=",", + ) + + # Non-linear transformation options: + warp: ImageIn | None = shell.arg( + default=None, + argstr="-warp", + help="""apply a non-linear 4D deformation field to warp the input image. Each voxel in the deformation field must define the scanner space position that will be used to interpolate the input image during warping (i.e. pull-back/reverse warp convention). If the -template image is also supplied, the deformation field will be resliced first to the template image grid. If no -template option is supplied, then the output image will have the same image grid as the deformation field. This option can be used in combination with the -affine option, in which case the affine will be applied first)""", + ) + warp_full: ImageIn | None = shell.arg( + default=None, + argstr="-warp_full", + help="""warp the input image using a 5D warp file output from mrregister. Any linear transforms in the warp image header will also be applied. The -warp_full option must be used in combination with either the -template option or the -midway_space option. If a -template image is supplied then the full warp will be used. By default the image1->image2 transform will be applied, however the -from 2 option can be used to apply the image2->image1 transform. Use the -midway_space option to warp the input image to the midway space. The -from option can also be used to define which warp to use when transforming to midway space""", + ) + from_: int | None = shell.arg( + default=None, + argstr="-from", + help="""used to define which space the input image is when using the -warp_mid option. Use -from 1 to warp from image1 or -from 2 to warp from image2""", + ) + + # Fibre orientation distribution handling options: + modulate: str | None = shell.arg( + default=None, + argstr="-modulate", + help="""Valid choices are: fod: modulate FODs during reorientation to preserve the apparent fibre density across fibre bundle widths before and after the transformation; jac: modulate the image intensity with the determinant of the Jacobian of the warp of linear transformation to preserve the total intensity before and after the transformation.""", + allowed_values=["fod", "jac"], + ) + directions: File | None = shell.arg( + default=None, + argstr="-directions", + help="""directions defining the number and orientation of the apodised point spread functions used in FOD reorientation (Default: 300 directions)""", + ) + reorient_fod: bool = shell.arg( + default=False, + argstr="-reorient_fod", + help="""specify whether to perform FOD reorientation. This is required if the number of volumes in the 4th dimension corresponds to the number of coefficients in an antipodally symmetric spherical harmonic series with lmax >= 2 (i.e. 6, 15, 28, 45, 66 volumes).""", + ) + + # DW gradient table import options: + grad: File | None = shell.arg( + default=None, + argstr="-grad", + help="""Provide the diffusion-weighted gradient scheme used in the acquisition in a text file. This should be supplied as a 4xN text file with each line in the format [ X Y Z b ], where [ X Y Z ] describe the direction of the applied gradient, and b gives the b-value in units of s/mm^2. If a diffusion gradient scheme is present in the input image header, the data provided with this option will be instead used.""", + ) + fslgrad: tuple[File, File] | None = shell.arg( + default=None, + argstr="-fslgrad", + help="""Provide the diffusion-weighted gradient scheme used in the acquisition in FSL bvecs/bvals format files. If a diffusion gradient scheme is present in the input image header, the data provided with this option will be instead used.""", + sep=" ", + ) + + # DW gradient table export options: + + # Data type options: + datatype: str | None = shell.arg( + default=None, + argstr="-datatype", + help="""specify output image data type. Valid choices are: float16, float16le, float16be, float32, float32le, float32be, float64, float64le, float64be, int64, uint64, int64le, uint64le, int64be, uint64be, int32, uint32, int32le, uint32le, int32be, uint32be, int16, uint16, int16le, uint16le, int16be, uint16be, cfloat16, cfloat16le, cfloat16be, cfloat32, cfloat32le, cfloat32be, cfloat64, cfloat64le, cfloat64be, int8, uint8, bit.""", + allowed_values=[ + "float16", + "float16le", + "float16be", + "float32", + "float32le", + "float32be", + "float64", + "float64le", + "float64be", + "int64", + "uint64", + "int64le", + "uint64le", + "int64be", + "uint64be", + "int32", + "uint32", + "int32le", + "uint32le", + "int32be", + "uint32be", + "int16", + "uint16", + "int16le", + "uint16le", + "int16be", + "uint16be", + "cfloat16", + "cfloat16le", + "cfloat16be", + "cfloat32", + "cfloat32le", + "cfloat32be", + "cfloat64", + "cfloat64le", + "cfloat64be", + "int8", + "uint8", + "bit", + ], + ) + + # Stride options: + strides: ty.Any = shell.arg( + default=None, + argstr="-strides", + help="""specify the strides of the output data in memory; either as a comma-separated list of (signed) integers, or as a template image from which the strides shall be extracted and used. The actual strides produced will depend on whether the output image format can support it.""", + ) + + # Additional generic options for mrtransform: + nan: bool = shell.arg( + default=False, + argstr="-nan", + help="""Use NaN as the out of bounds value (0.0 will be used otherwise)""", + ) + no_reorientation: bool = shell.arg( + default=False, + argstr="-no_reorientation", + help="""deprecated; use -reorient_fod instead""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="out_file.mif", + help="""the output image.""", + ) + export_grad_mrtrix: File | bool | None = shell.outarg( + default=None, + argstr="-export_grad_mrtrix", + path_template="export_grad_mrtrix.txt", + help="""export the diffusion-weighted gradient table to file in MRtrix format""", + ) + export_grad_fsl: tuple[File, File] | bool | None = shell.outarg( + default=None, + argstr="-export_grad_fsl", + path_template=( + "export_grad_fsl0.txt", + "export_grad_fsl1.txt", + ), + help="""export the diffusion-weighted gradient table to files in FSL (bvecs / bvals) format""", + sep=" ", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/mrtrix_cleanup.py b/pydra/tasks/mrtrix3/v3_1/mrtrix_cleanup.py new file mode 100644 index 0000000..4f09eed --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mrtrix_cleanup.py @@ -0,0 +1,117 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define(xor=[["info", "quiet", "debug", None], ["test", "failed", None]]) +class MrTrix_Cleanup(shell.Task["MrTrix_Cleanup.Outputs"]): + """ + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = "mrtrix_cleanup" + + path: Directory = shell.arg( + position=1, + argstr="", + help="Directory from which to commence filesystem search", + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + test: bool = shell.arg( + help="Run script in test mode: will list identified files / directories, but not attempt to delete them", + argstr="-test", + default=False, + ) + + class Outputs(shell.Outputs): + failed: File | None = shell.outarg( + help="Write list of items that the script failed to delete to a text file", + argstr="-failed", + default=None, + path_template="failed.txt", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/mtnormalise.py b/pydra/tasks/mrtrix3/v3_1/mtnormalise.py new file mode 100644 index 0000000..809bda9 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/mtnormalise.py @@ -0,0 +1,152 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class MtNormalise(shell.Task["MtNormalise.Outputs"]): + """This command takes as input any number of tissue components (e.g. from multi-tissue CSD) and outputs corresponding normalised tissue components corrected for the effects of (residual) intensity inhomogeneities. Intensity normalisation is performed by optimising the voxel-wise sum of all tissue compartments towards a constant value, under constraints of spatial smoothness (polynomial basis of a given order). Different to the Raffelt et al. 2017 abstract, this algorithm performs this task in the log-domain instead, with added gradual outlier rejection, different handling of the balancing factors between tissue compartments, and a different iteration structure. + + The -mask option is mandatory and is optimally provided with a brain mask (such as the one obtained from dwi2mask earlier in the processing pipeline). Outlier areas with exceptionally low or high combined tissue contributions are accounted for and reoptimised as the intensity inhomogeneity estimation becomes more accurate. + + + Example usages + -------------- + + + Default usage (for 3-tissue CSD compartments): + + `$ mtnormalise wmfod.mif wmfod_norm.mif gm.mif gm_norm.mif csf.mif csf_norm.mif -mask mask.mif` + + Note how for each tissue compartment, the input and output images are provided as a consecutive pair. + + + References + ---------- + + Raffelt, D.; Dhollander, T.; Tournier, J.-D.; Tabbara, R.; Smith, R. E.; Pierre, E. & Connelly, A. Bias Field Correction and Intensity Normalisation for Quantitative Analysis of Apparent Fibre Density. In Proc. ISMRM, 2017, 26, 3541 + + Dhollander, T.; Tabbara, R.; Rosnarho-Tornstrand, J.; Tournier, J.-D.; Raffelt, D. & Connelly, A. Multi-tissue log-domain intensity and inhomogeneity normalisation for quantitative apparent fibre density. In Proc. ISMRM, 2021, 29, 2472 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Thijs Dhollander (thijs.dhollander@gmail.com) and Rami Tabbara (rami.tabbara@florey.edu.au) and David Raffelt (david.raffelt@florey.edu.au) and Jonas Rosnarho-Tornstrand (jonas.rosnarho-tornstrand@kcl.ac.uk) and J-Donald Tournier (jdtournier@gmail.com) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "mtnormalise" + + # Arguments + input_output: MultiInputObj[ty.Any] = shell.arg( + argstr="", + position=1, + help="""list of all input and output tissue compartment files (see example usage).""", + ) + + # Options + mask: ImageIn = shell.arg( + argstr="-mask", + help="""the mask defines the data used to compute the intensity normalisation. This option is mandatory.""", + ) + order: str | None = shell.arg( + default=None, + argstr="-order", + help="""the maximum order of the polynomial basis used to fit the normalisation field in the log-domain. An order of 0 is equivalent to not allowing spatial variance of the intensity normalisation factor. (default: 3)""", + allowed_values=["0", "1", "2", "3"], + ) + niter: list[int] | None = shell.arg( + default=None, + argstr="-niter", + help="""set the number of iterations. The first (and potentially only) entry applies to the main loop. If supplied as a comma-separated list of integers, the second entry applies to the inner loop to update the balance factors. (default: 15,7).""", + sep=",", + ) + reference: float | None = shell.arg( + default=None, + argstr="-reference", + help="""specify the (positive) reference value to which the summed tissue compartments will be normalised. (default: 0.282095, SH DC term for unit angular integral)""", + ) + balanced: bool = shell.arg( + default=False, + argstr="-balanced", + help="""incorporate the per-tissue balancing factors into scaling of the output images. (NOTE: use of this option has critical consequences for AFD intensity normalisation; should not be used unless these consequences are fully understood)""", + ) + + # Debugging options: + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + check_norm: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-check_norm", + path_template="check_norm.mif", + help="""output the final estimated spatially varying intensity level that is used for normalisation.""", + ) + check_mask: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-check_mask", + path_template="check_mask.mif", + help="""output the final mask used to compute the normalisation. This mask excludes regions identified as outliers by the optimisation process.""", + ) + check_factors: File | bool | None = shell.outarg( + default=None, + argstr="-check_factors", + path_template="check_factors.txt", + help="""output the tissue balance factors computed during normalisation.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/peaks2amp.py b/pydra/tasks/mrtrix3/v3_1/peaks2amp.py new file mode 100644 index 0000000..59070d5 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/peaks2amp.py @@ -0,0 +1,93 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Peaks2Amp(shell.Task["Peaks2Amp.Outputs"]): + """ + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: J-Donald Tournier (jdtournier@gmail.com) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "peaks2amp" + + # Arguments + directions: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input directions image. Each volume corresponds to the x, y & z component of each direction vector in turn.""", + ) + + # Options + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + amplitudes: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="amplitudes.mif", + help="""the output amplitudes image.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/peaks2fixel.py b/pydra/tasks/mrtrix3/v3_1/peaks2fixel.py new file mode 100644 index 0000000..bf55801 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/peaks2fixel.py @@ -0,0 +1,101 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Peaks2Fixel(shell.Task["Peaks2Fixel.Outputs"]): + """Fixel data are stored utilising the fixel directory format described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/fixel_based_analysis/fixel_directory_format.html + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "peaks2fixel" + + # Arguments + directions: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input directions image; each volume corresponds to the x, y & z component of each direction vector in turn.""", + ) + + # Options + dataname: str | None = shell.arg( + default=None, + argstr="-dataname", + help="""the name of the output fixel data file encoding peak amplitudes""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + fixels: Directory = shell.outarg( + argstr="", + position=2, + path_template="fixels", + help="""the output fixel directory.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/population_template.py b/pydra/tasks/mrtrix3/v3_1/population_template.py new file mode 100644 index 0000000..b573c5a --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/population_template.py @@ -0,0 +1,299 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define(xor=[["info", "quiet", "debug", None]]) +class PopulationTemplate(shell.Task["PopulationTemplate.Outputs"]): + """ + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** David Raffelt (david.raffelt@florey.edu.au) and Max Pietsch (maximilian.pietsch@kcl.ac.uk) and Thijs Dhollander (thijs.dhollander@gmail.com) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = "population_template" + + input_dir: typing.Any = shell.arg( + position=1, + argstr="", + help="Input directory containing all images of a given contrast", + ) + type: str | None = shell.arg( + help='Specify the types of registration stages to perform. Options are: "rigid" (perform rigid registration only, which might be useful for intra-subject registration in longitudinal analysis); "affine" (perform affine registration); "nonlinear"; as well as combinations of registration types: "rigid_affine", "rigid_nonlinear", "affine_nonlinear", "rigid_affine_nonlinear". Default: rigid_affine_nonlinear', + allowed_values=[ + "rigid", + "affine", + "nonlinear", + "rigid_affine", + "rigid_nonlinear", + "affine_nonlinear", + "rigid_affine_nonlinear", + ], + argstr="-type", + default=None, + ) + voxel_size: typing.List[float] | None = shell.arg( + help="Define the template voxel size in mm. Use either a single value for isotropic voxels or 3 comma-separated values.", + argstr="-voxel_size", + default=None, + ) + initial_alignment: str | None = shell.arg( + help='Method of alignment to form the initial template. Options are: "mass" (default); "robust_mass" (requires masks); "geometric"; "none".', + allowed_values=["mass", "robust_mass", "geometric", "none"], + argstr="-initial_alignment", + default=None, + ) + mask_dir: Directory | None = shell.arg( + help="Optionally input a set of masks inside a single directory, one per input image (with the same file name prefix). Using masks will speed up registration significantly. Note that masks are used for registration, not for aggregation. To exclude areas from aggregation, NaN-mask your input images.", + argstr="-mask_dir", + default=None, + ) + noreorientation: bool = shell.arg( + help="Turn off FOD reorientation in mrregister. Reorientation is on by default if the number of volumes in the 4th dimension corresponds to the number of coefficients in an antipodally symmetric spherical harmonic series (i.e. 6, 15, 28, 45, 66 etc)", + argstr="-noreorientation", + default=False, + ) + leave_one_out: str | None = shell.arg( + help="Register each input image to a template that does not contain that image. Valid choices: 0, 1, auto. (Default: auto (true if n_subjects larger than 2 and smaller than 15))", + allowed_values=["0", "1", "auto"], + argstr="-leave_one_out", + default=None, + ) + aggregate: str | None = shell.arg( + help="Measure used to aggregate information from transformed images to the template image. Valid choices: mean, median. Default: mean", + allowed_values=["mean", "median"], + argstr="-aggregate", + default=None, + ) + aggregation_weights: File | None = shell.arg( + help="Comma-separated file containing weights used for weighted image aggregation. Each row must contain the identifiers of the input image and its weight. Note that this weighs intensity values not transformations (shape).", + argstr="-aggregation_weights", + default=None, + ) + nanmask: bool = shell.arg( + help="Optionally apply masks to (transformed) input images using NaN values to specify include areas for registration and aggregation. Only works if -mask_dir has been input.", + argstr="-nanmask", + default=False, + ) + copy_input: bool = shell.arg( + help="Copy input images and masks into local scratch directory.", + argstr="-copy_input", + default=False, + ) + delete_temporary_files: bool = shell.arg( + help="Delete temporary files from scratch directory during template creation.", + argstr="-delete_temporary_files", + default=False, + ) + nl_scale: typing.List[float] | None = shell.arg( + help="Specify the multi-resolution pyramid used to build the non-linear template, in the form of a list of scale factors (default: 0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0). This implicitly defines the number of template levels", + argstr="-nl_scale", + default=None, + ) + nl_lmax: typing.List[int] | None = shell.arg( + help="Specify the lmax used for non-linear registration for each scale factor, in the form of a list of integers (default: 2,2,2,2,2,2,2,2,4,4,4,4,4,4,4,4). The list must be the same length as the nl_scale factor list", + argstr="-nl_lmax", + default=None, + ) + nl_niter: typing.List[int] | None = shell.arg( + help="Specify the number of registration iterations used within each level before updating the template, in the form of a list of integers (default: 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5). The list must be the same length as the nl_scale factor list", + argstr="-nl_niter", + default=None, + ) + nl_update_smooth: float | None = shell.arg( + help="Regularise the gradient update field with Gaussian smoothing (standard deviation in voxel units, Default 2.0 x voxel_size)", + argstr="-nl_update_smooth", + default=None, + ) + nl_disp_smooth: float | None = shell.arg( + help="Regularise the displacement field with Gaussian smoothing (standard deviation in voxel units, Default 1.0 x voxel_size)", + argstr="-nl_disp_smooth", + default=None, + ) + nl_grad_step: float | None = shell.arg( + help="The gradient step size for non-linear registration (Default: 0.5)", + argstr="-nl_grad_step", + default=None, + ) + linear_no_pause: bool = shell.arg( + help="Do not pause the script if a linear registration seems implausible", + argstr="-linear_no_pause", + default=False, + ) + linear_no_drift_correction: bool = shell.arg( + help="Deactivate correction of template appearance (scale and shear) over iterations", + argstr="-linear_no_drift_correction", + default=False, + ) + linear_estimator: str | None = shell.arg( + help="Specify estimator for intensity difference metric. Valid choices are: l1 (least absolute: |x|), l2 (ordinary least squares), lp (least powers: |x|^1.2), none (no robust estimator). Default: none.", + allowed_values=["l1", "l2", "lp", "none"], + argstr="-linear_estimator", + default=None, + ) + rigid_scale: typing.List[float] | None = shell.arg( + help="Specify the multi-resolution pyramid used to build the rigid template, in the form of a list of scale factors (default: 0.3,0.4,0.6,0.8,1.0,1.0). This and affine_scale implicitly define the number of template levels", + argstr="-rigid_scale", + default=None, + ) + rigid_lmax: typing.List[int] | None = shell.arg( + help="Specify the lmax used for rigid registration for each scale factor, in the form of a list of integers (default: 2,2,2,4,4,4). The list must be the same length as the linear_scale factor list", + argstr="-rigid_lmax", + default=None, + ) + rigid_niter: typing.List[int] | None = shell.arg( + help="Specify the number of registration iterations used within each level before updating the template, in the form of a list of integers (default: 50 for each scale). This must be a single number or a list of same length as the linear_scale factor list", + argstr="-rigid_niter", + default=None, + ) + affine_scale: typing.List[float] | None = shell.arg( + help="Specify the multi-resolution pyramid used to build the affine template, in the form of a list of scale factors (default: 0.3,0.4,0.6,0.8,1.0,1.0). This and rigid_scale implicitly define the number of template levels", + argstr="-affine_scale", + default=None, + ) + affine_lmax: typing.List[int] | None = shell.arg( + help="Specify the lmax used for affine registration for each scale factor, in the form of a list of integers (default: 2,2,2,4,4,4). The list must be the same length as the linear_scale factor list", + argstr="-affine_lmax", + default=None, + ) + affine_niter: typing.List[int] | None = shell.arg( + help="Specify the number of registration iterations used within each level before updating the template, in the form of a list of integers (default: 500 for each scale). This must be a single number or a list of same length as the linear_scale factor list", + argstr="-affine_niter", + default=None, + ) + mc_weight_initial_alignment: typing.List[float] | None = shell.arg( + help="Weight contribution of each contrast to the initial alignment. Comma separated, default: 1.0 for each contrast (ie. equal weighting).", + argstr="-mc_weight_initial_alignment", + default=None, + ) + mc_weight_rigid: typing.List[float] | None = shell.arg( + help="Weight contribution of each contrast to the objective of rigid registration. Comma separated, default: 1.0 for each contrast (ie. equal weighting)", + argstr="-mc_weight_rigid", + default=None, + ) + mc_weight_affine: typing.List[float] | None = shell.arg( + help="Weight contribution of each contrast to the objective of affine registration. Comma separated, default: 1.0 for each contrast (ie. equal weighting)", + argstr="-mc_weight_affine", + default=None, + ) + mc_weight_nl: typing.List[float] | None = shell.arg( + help="Weight contribution of each contrast to the objective of nonlinear registration. Comma separated, default: 1.0 for each contrast (ie. equal weighting)", + argstr="-mc_weight_nl", + default=None, + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + + class Outputs(shell.Outputs): + template: ImageOut = shell.outarg( + position=2, + argstr="", + help="Output template image", + path_template="template.mif", + ) + warp_dir: Directory | None = shell.outarg( + help="Output a directory containing warps from each input to the template. If the folder does not exist it will be created", + argstr="-warp_dir", + default=None, + path_template="warp_dir", + ) + transformed_dir: typing.List[Directory] | None = shell.outarg( + help="Output a directory containing the input images transformed to the template. If the folder does not exist it will be created. For multi-contrast registration, provide a comma-separated list of directories.", + argstr="-transformed_dir", + default=None, + path_template="transformed_dir", + ) + linear_transformations_dir: Directory | None = shell.outarg( + help="Output a directory containing the linear transformations used to generate the template. If the folder does not exist it will be created", + argstr="-linear_transformations_dir", + default=None, + path_template="linear_transformations_dir", + ) + template_mask: ImageOut | None = shell.outarg( + help="Output a template mask. Only works if -mask_dir has been input. The template mask is computed as the intersection of all subject masks in template space.", + argstr="-template_mask", + default=None, + path_template="template_mask.mif", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/responsemean.py b/pydra/tasks/mrtrix3/v3_1/responsemean.py new file mode 100644 index 0000000..544f495 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/responsemean.py @@ -0,0 +1,117 @@ +# Auto-generated by mrtrix3/app.py:print_pydra_code() + +import typing +from pathlib import Path # noqa: F401 +from fileformats.generic import FsObject, File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import Tracks, ImageIn, ImageOut # noqa: F401 +from pydra.utils.typing import MultiInputObj +from pydra.compose import shell + + +@shell.define(xor=[["info", "quiet", "debug", None]]) +class ResponseMean(shell.Task["ResponseMean.Outputs"]): + """ + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + -------------- + + + + **Author:** Robert E. Smith (robert.smith@florey.edu.au) and David Raffelt (david.raffelt@florey.edu.au) + + **Copyright:** Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + + """ + + executable = "responsemean" + + inputs: File = shell.arg( + position=1, + argstr="", + help="The input response function files", + ) + nocleanup: bool = shell.arg( + help="do not delete intermediate files during script execution, and do not delete scratch directory at script completion.", + argstr="-nocleanup", + default=False, + ) + scratch: Directory | None = shell.arg( + help="manually specify an existing directory in which to generate the scratch directory.", + argstr="-scratch", + default=None, + ) + cont: typing.Any | None = shell.arg( + help="continue the script from a previous execution; must provide the scratch directory path, and the name of the last successfully-generated file.", + argstr="-cont", + default=None, + ) + info: bool = shell.arg( + help="display information messages.", + argstr="-info", + default=False, + ) + quiet: bool = shell.arg( + help="do not display information messages or progress status. Alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.", + argstr="-quiet", + default=False, + ) + debug: bool = shell.arg( + help="display debugging messages.", + argstr="-debug", + default=False, + ) + force: bool = shell.arg( + help="force overwrite of output files.", + argstr="-force", + default=False, + ) + nthreads: int | None = shell.arg( + help="use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).", + argstr="-nthreads", + default=None, + ) + config: MultiInputObj[MultiInputObj] = shell.arg( + help="temporarily set the value of an MRtrix config file entry.", + argstr="-config", + default=None, + ) + help: bool = shell.arg( + help="display this information page and exit.", + argstr="-help", + default=False, + ) + version: bool = shell.arg( + help="display version information and exit.", + argstr="-version", + default=False, + ) + legacy: bool = shell.arg( + help='Use the legacy behaviour of former command "average_response": average response function coefficients directly, without compensating for global magnitude differences between input files', + argstr="-legacy", + default=False, + ) + + class Outputs(shell.Outputs): + out_file: File = shell.outarg( + position=2, + argstr="", + help="The output mean response function file", + path_template="out_file.txt", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/sh2amp.py b/pydra/tasks/mrtrix3/v3_1/sh2amp.py new file mode 100644 index 0000000..b51f8e2 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/sh2amp.py @@ -0,0 +1,186 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Sh2Amp(shell.Task["Sh2Amp.Outputs"]): + """The input image should consist of a 4D or 5D image, with SH coefficients along the 4th dimension according to the convention below. If 4D (or size 1 along the 5th dimension), the program expects to be provided with a single shell of directions. If 5D, each set of coefficients along the 5th dimension is understood to correspond to a different shell. + + The directions can be provided as: + - a 2-column ASCII text file containing azimuth / elevation pairs (eg. as produced by dirgen) + - a 3-column ASCII text file containing x, y, z Cartesian direction vectors (eg. as produced by dirgen -cart) + - a 4-column ASCII text file containing the x, y, z, b components of a full DW encoding scheme (in MRtrix format, see main documentation for details). + - an image file whose header contains a valid DW encoding scheme + + If a full DW encoding is provided, the number of shells needs to match those found in the input image of coefficients (i.e. its size along the 5th dimension). If needed, the -shell option can be used to pick out the specific shell(s) of interest. + + If the input image contains multiple shells (its size along the 5th dimension is greater than one), the program will expect the direction set to contain multiple shells, which can only be provided as a full DW encodings (the last two options in the list above). + + The spherical harmonic coefficients are stored according to the conventions described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/concepts/spherical_harmonics.html + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) and J-Donald Tournier (jdtournier@gmail.com) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "sh2amp" + + # Arguments + in_file: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input spherical harmonic (SH) coefficients image""", + ) + directions: File = shell.arg( + argstr="", + position=2, + help="""the set of directions along which the SH functions will be sampled""", + ) + + # Options + nonnegative: bool = shell.arg( + default=False, + argstr="-nonnegative", + help="""cap all negative amplitudes to zero""", + ) + + # DW gradient table import options: + grad: File | None = shell.arg( + default=None, + argstr="-grad", + help="""Provide the diffusion-weighted gradient scheme used in the acquisition in a text file. This should be supplied as a 4xN text file with each line in the format [ X Y Z b ], where [ X Y Z ] describe the direction of the applied gradient, and b gives the b-value in units of s/mm^2. If a diffusion gradient scheme is present in the input image header, the data provided with this option will be instead used.""", + ) + fslgrad: tuple[File, File] | None = shell.arg( + default=None, + argstr="-fslgrad", + help="""Provide the diffusion-weighted gradient scheme used in the acquisition in FSL bvecs/bvals format files. If a diffusion gradient scheme is present in the input image header, the data provided with this option will be instead used.""", + sep=" ", + ) + + # Stride options: + strides: ty.Any = shell.arg( + default=None, + argstr="-strides", + help="""specify the strides of the output data in memory; either as a comma-separated list of (signed) integers, or as a template image from which the strides shall be extracted and used. The actual strides produced will depend on whether the output image format can support it.""", + ) + + # Data type options: + datatype: str | None = shell.arg( + default=None, + argstr="-datatype", + help="""specify output image data type. Valid choices are: float16, float16le, float16be, float32, float32le, float32be, float64, float64le, float64be, int64, uint64, int64le, uint64le, int64be, uint64be, int32, uint32, int32le, uint32le, int32be, uint32be, int16, uint16, int16le, uint16le, int16be, uint16be, cfloat16, cfloat16le, cfloat16be, cfloat32, cfloat32le, cfloat32be, cfloat64, cfloat64le, cfloat64be, int8, uint8, bit.""", + allowed_values=[ + "float16", + "float16le", + "float16be", + "float32", + "float32le", + "float32be", + "float64", + "float64le", + "float64be", + "int64", + "uint64", + "int64le", + "uint64le", + "int64be", + "uint64be", + "int32", + "uint32", + "int32le", + "uint32le", + "int32be", + "uint32be", + "int16", + "uint16", + "int16le", + "uint16le", + "int16be", + "uint16be", + "cfloat16", + "cfloat16le", + "cfloat16be", + "cfloat32", + "cfloat32le", + "cfloat32be", + "cfloat64", + "cfloat64le", + "cfloat64be", + "int8", + "uint8", + "bit", + ], + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + argstr="", + position=3, + path_template="out_file.mif", + help="""the output amplitudes image""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/sh2peaks.py b/pydra/tasks/mrtrix3/v3_1/sh2peaks.py new file mode 100644 index 0000000..d748cc2 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/sh2peaks.py @@ -0,0 +1,138 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Sh2Peaks(shell.Task["Sh2Peaks.Outputs"]): + """Peaks of the spherical harmonic function in each voxel are located by commencing a Newton search along each of a set of pre-specified directions + + Within the output image, each successive triplet of volumes encodes the x, y & z components of a 3-vector; their directions in 3D space encode the orientation of the identified peaks, while the norm of each vector encodes the magnitude of the peaks. + + The spherical harmonic coefficients are stored according to the conventions described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/concepts/spherical_harmonics.html + + + References + ---------- + + Jeurissen, B.; Leemans, A.; Tournier, J.-D.; Jones, D.K.; Sijbers, J. Investigating the prevalence of complex fiber configurations in white matter tissue with diffusion magnetic resonance imaging. Human Brain Mapping, 2013, 34(11), 2747-2766 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: J-Donald Tournier (jdtournier@gmail.com) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "sh2peaks" + + # Arguments + SH: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input image of SH coefficients.""", + ) + + # Options + num: int | None = shell.arg( + default=None, + argstr="-num", + help="""the number of peaks to extract (default: 3).""", + ) + direction: MultiInputObj[tuple[float, float]] | None = shell.arg( + default=None, + argstr="-direction", + help="""the direction of a peak to estimate. The algorithm will attempt to find the same number of peaks as have been specified using this option.""", + sep=" ", + ) + peaks: ImageIn | None = shell.arg( + default=None, + argstr="-peaks", + help="""the program will try to find the peaks that most closely match those in the image provided.""", + ) + threshold: float | None = shell.arg( + default=None, + argstr="-threshold", + help="""only peak amplitudes greater than the threshold will be considered.""", + ) + seeds: File | None = shell.arg( + default=None, + argstr="-seeds", + help="""specify a set of directions from which to start the multiple restarts of the optimisation (by default, the built-in 60 direction set is used)""", + ) + mask: ImageIn | None = shell.arg( + default=None, + argstr="-mask", + help="""only perform computation within the specified binary brain mask image.""", + ) + fast: bool = shell.arg( + default=False, + argstr="-fast", + help="""use lookup table to compute associated Legendre polynomials (faster, but approximate).""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="out_file.mif", + help="""the output peaks image""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/sh2power.py b/pydra/tasks/mrtrix3/v3_1/sh2power.py new file mode 100644 index 0000000..a7bda38 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/sh2power.py @@ -0,0 +1,103 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Sh2Power(shell.Task["Sh2Power.Outputs"]): + """This command computes the sum of squared SH coefficients, which equals the mean-squared amplitude of the spherical function it represents. + + The spherical harmonic coefficients are stored according to the conventions described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/concepts/spherical_harmonics.html + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: J-Donald Tournier (jdtournier@gmail.com) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "sh2power" + + # Arguments + SH: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input spherical harmonics coefficients image.""", + ) + + # Options + spectrum: bool = shell.arg( + default=False, + argstr="-spectrum", + help="""output the power spectrum, i.e., the power contained within each harmonic degree (l=0, 2, 4, ...) as a 4-D image.""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + power: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="power.mif", + help="""the output power image.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/sh2response.py b/pydra/tasks/mrtrix3/v3_1/sh2response.py new file mode 100644 index 0000000..802a39f --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/sh2response.py @@ -0,0 +1,117 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Sh2Response(shell.Task["Sh2Response.Outputs"]): + """The spherical harmonic coefficients are stored according to the conventions described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/concepts/spherical_harmonics.html + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: J-Donald Tournier (jdtournier@gmail.com) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "sh2response" + + # Arguments + SH: ImageIn = shell.arg( + argstr="", + position=1, + help="""the spherical harmonic decomposition of the diffusion-weighted images""", + ) + mask: ImageIn = shell.arg( + argstr="", + position=2, + help="""the mask containing the voxels from which to estimate the response function""", + ) + directions: ImageIn = shell.arg( + argstr="", + position=3, + help="""a 4D image containing the direction vectors along which to estimate the response function""", + ) + + # Options + lmax: int | None = shell.arg( + default=None, + argstr="-lmax", + help="""specify the maximum harmonic degree of the response function to estimate""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + response: File = shell.outarg( + argstr="", + position=4, + path_template="response.txt", + help="""the output axially-symmetric spherical harmonic coefficients""", + ) + dump: File | bool | None = shell.outarg( + default=None, + argstr="-dump", + path_template="dump.txt", + help="""dump the m=0 SH coefficients from all voxels in the mask to the output file, rather than their mean""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/shbasis.py b/pydra/tasks/mrtrix3/v3_1/shbasis.py new file mode 100644 index 0000000..d298da3 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/shbasis.py @@ -0,0 +1,103 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class ShBasis(shell.Task["ShBasis.Outputs"]): + """In previous versions of MRtrix, the convention used for storing spherical harmonic coefficients was a non-orthonormal basis (the m!=0 coefficients were a factor of sqrt(2) too large). This error has been rectified in newer versions of MRtrix, but will cause issues if processing SH data that was generated using an older version of MRtrix (or vice-versa). + + This command provides a mechanism for testing the basis used in storage of image data representing a spherical harmonic series per voxel, and allows the user to forcibly modify the raw image data to conform to the desired basis. + + Note that the "force_*" conversion choices should only be used in cases where this command has previously been unable to automatically determine the SH basis from the image data, but the user themselves are confident of the SH basis of the data. + + The spherical harmonic coefficients are stored according to the conventions described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/concepts/spherical_harmonics.html + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "shbasis" + + # Arguments + SH: MultiInputObj[ImageIn] = shell.arg( + argstr="", + position=1, + help="""the input image(s) of SH coefficients.""", + ) + + # Options + convert: str | None = shell.arg( + default=None, + argstr="-convert", + help="""convert the image data in-place to the desired basis; options are: old,new,force_oldtonew,force_newtoold.""", + allowed_values=["old", "new", "force_oldtonew", "force_newtoold"], + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + pass diff --git a/pydra/tasks/mrtrix3/v3_1/shconv.py b/pydra/tasks/mrtrix3/v3_1/shconv.py new file mode 100644 index 0000000..eac34d1 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/shconv.py @@ -0,0 +1,160 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class ShConv(shell.Task["ShConv.Outputs"]): + """Provided with matching pairs of response function and ODF images (containing SH coefficients), perform spherical convolution to provide the corresponding SH coefficients of the signal. + + If multiple pairs of inputs are provided, their contributions will be summed into a single output. + + If the responses are multi-shell (with one line of coefficients per shell), the output will be a 5-dimensional image, with the SH coefficients of the signal in each shell stored at different indices along the 5th dimension. + + The spherical harmonic coefficients are stored according to the conventions described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/concepts/spherical_harmonics.html + + The spherical harmonic coefficients are stored according to the conventions described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/concepts/spherical_harmonics.html + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) and J-Donald Tournier (jdtournier@gmail.com) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "shconv" + + # Arguments + odf_response: MultiInputObj[ty.Any] = shell.arg( + argstr="", + position=1, + help="""pairs of input ODF image and corresponding responses""", + ) + + # Options + + # Data type options: + datatype: str | None = shell.arg( + default=None, + argstr="-datatype", + help="""specify output image data type. Valid choices are: float16, float16le, float16be, float32, float32le, float32be, float64, float64le, float64be, int64, uint64, int64le, uint64le, int64be, uint64be, int32, uint32, int32le, uint32le, int32be, uint32be, int16, uint16, int16le, uint16le, int16be, uint16be, cfloat16, cfloat16le, cfloat16be, cfloat32, cfloat32le, cfloat32be, cfloat64, cfloat64le, cfloat64be, int8, uint8, bit.""", + allowed_values=[ + "float16", + "float16le", + "float16be", + "float32", + "float32le", + "float32be", + "float64", + "float64le", + "float64be", + "int64", + "uint64", + "int64le", + "uint64le", + "int64be", + "uint64be", + "int32", + "uint32", + "int32le", + "uint32le", + "int32be", + "uint32be", + "int16", + "uint16", + "int16le", + "uint16le", + "int16be", + "uint16be", + "cfloat16", + "cfloat16le", + "cfloat16be", + "cfloat32", + "cfloat32le", + "cfloat32be", + "cfloat64", + "cfloat64le", + "cfloat64be", + "int8", + "uint8", + "bit", + ], + ) + + # Stride options: + strides: ty.Any = shell.arg( + default=None, + argstr="-strides", + help="""specify the strides of the output data in memory; either as a comma-separated list of (signed) integers, or as a template image from which the strides shall be extracted and used. The actual strides produced will depend on whether the output image format can support it.""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + SH_out: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="SH_out.mif", + help="""the output spherical harmonics coefficients image.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/tck2connectome.py b/pydra/tasks/mrtrix3/v3_1/tck2connectome.py new file mode 100644 index 0000000..10a4834 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tck2connectome.py @@ -0,0 +1,226 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Tck2Connectome(shell.Task["Tck2Connectome.Outputs"]): + """ + Example usages + -------------- + + + Default usage: + + `$ tck2connectome tracks.tck nodes.mif connectome.csv -tck_weights_in weights.csv -out_assignments assignments.txt` + + By default, the metric of connectivity quantified in the connectome matrix is the number of streamlines; or, if tcksift2 is used, the sum of streamline weights via the -tck_weights_in option. Use of the -out_assignments option is recommended as this enables subsequent use of the connectome2tck command. + + + Generate a matrix consisting of the mean streamline length between each node pair: + + `$ tck2connectome tracks.tck nodes.mif distances.csv -scale_length -stat_edge mean` + + By multiplying the contribution of each streamline to the connectome by the length of that streamline, and then, for each edge, computing the mean value across the contributing streamlines, one obtains a matrix where the value in each entry is the mean length across those streamlines belonging to that edge. + + + Generate a connectome matrix where the value of connectivity is the "mean FA": + + `$ tcksample tracks.tck FA.mif mean_FA_per_streamline.csv -stat_tck mean; tck2connectome tracks.tck nodes.mif mean_FA_connectome.csv -scale_file mean_FA_per_streamline.csv -stat_edge mean` + + Here, a connectome matrix that is "weighted by FA" is generated in multiple steps: firstly, for each streamline, the value of the underlying FA image is sampled at each vertex, and the mean of these values is calculated to produce a single scalar value of "mean FA" per streamline; then, as each streamline is assigned to nodes within the connectome, the magnitude of the contribution of that streamline to the matrix is multiplied by the mean FA value calculated prior for that streamline; finally, for each connectome edge, across the values of "mean FA" that were contributed by all of the streamlines assigned to that particular edge, the mean value is calculated. + + + Generate the connectivity fingerprint for streamlines seeded from a particular region: + + `$ tck2connectome fixed_seed_tracks.tck nodes.mif fingerprint.csv -vector` + + This usage assumes that the streamlines being provided to the command have all been seeded from the (effectively) same location, and as such, only the endpoint of each streamline (not their starting point) is assigned based on the provided parcellation image. Accordingly, the output file contains only a vector of connectivity values rather than a matrix, since each streamline is assigned to only one node rather than two. + + + References + ---------- + + If using the default streamline-parcel assignment mechanism (or -assignment_radial_search option): + 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 + + If using -scale_invlength or -scale_invnodevol options: + Hagmann, P.; Cammoun, L.; Gigandet, X.; Meuli, R.; Honey, C.; Wedeen, V. & Sporns, O. Mapping the Structural Core of Human Cerebral Cortex. PLoS Biology 6(7), e159 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "tck2connectome" + + # Arguments + tracks_in: Tracks = shell.arg( + argstr="", + position=1, + help="""the input track file""", + ) + nodes_in: ImageIn = shell.arg( + argstr="", + position=2, + help="""the input node parcellation image""", + ) + + # Options + + # Structural connectome streamline assignment option: + assignment_end_voxels: bool = shell.arg( + default=False, + argstr="-assignment_end_voxels", + help="""use a simple voxel lookup value at each streamline endpoint""", + ) + assignment_radial_search: float | None = shell.arg( + default=None, + argstr="-assignment_radial_search", + help="""perform a radial search from each streamline endpoint to locate the nearest node. Argument is the maximum radius in mm; if no node is found within this radius, the streamline endpoint is not assigned to any node. Default search distance is 4mm.""", + ) + assignment_reverse_search: float | None = shell.arg( + default=None, + argstr="-assignment_reverse_search", + help="""traverse from each streamline endpoint inwards along the streamline, in search of the last node traversed by the streamline. Argument is the maximum traversal length in mm (set to 0 to allow search to continue to the streamline midpoint).""", + ) + assignment_forward_search: float | None = shell.arg( + default=None, + argstr="-assignment_forward_search", + help="""project the streamline forwards from the endpoint in search of a parcellation node voxel. Argument is the maximum traversal length in mm.""", + ) + assignment_all_voxels: bool = shell.arg( + default=False, + argstr="-assignment_all_voxels", + help="""assign the streamline to all nodes it intersects along its length (note that this means a streamline may be assigned to more than two nodes, or indeed none at all)""", + ) + + # Structural connectome metric options: + scale_length: bool = shell.arg( + default=False, + argstr="-scale_length", + help="""scale each contribution to the connectome edge by the length of the streamline""", + ) + scale_invlength: bool = shell.arg( + default=False, + argstr="-scale_invlength", + help="""scale each contribution to the connectome edge by the inverse of the streamline length""", + ) + scale_invnodevol: bool = shell.arg( + default=False, + argstr="-scale_invnodevol", + help="""scale each contribution to the connectome edge by the inverse of the two node volumes""", + ) + scale_file: ImageIn | None = shell.arg( + default=None, + argstr="-scale_file", + help="""scale each contribution to the connectome edge according to the values in a vector file""", + ) + + # Options for outputting connectome matrices: + symmetric: bool = shell.arg( + default=False, + argstr="-symmetric", + help="""Make matrices symmetric on output""", + ) + zero_diagonal: bool = shell.arg( + default=False, + argstr="-zero_diagonal", + help="""Set matrix diagonal to zero on output""", + ) + + # Other options for tck2connectome: + stat_edge: str | None = shell.arg( + default=None, + argstr="-stat_edge", + help="""statistic for combining the values from all streamlines in an edge into a single scale value for that edge (options are: sum,mean,min,max; default=sum)""", + allowed_values=["sum", "mean", "min", "max"], + ) + tck_weights_in: File | None = shell.arg( + default=None, + argstr="-tck_weights_in", + help="""specify a text scalar file containing the streamline weights""", + ) + keep_unassigned: bool = shell.arg( + default=False, + argstr="-keep_unassigned", + help="""By default, the program discards the information regarding those streamlines that are not successfully assigned to a node pair. Set this option to keep these values (will be the first row/column in the output matrix)""", + ) + vector: bool = shell.arg( + default=False, + argstr="-vector", + help="""output a vector representing connectivities from a given seed point to target nodes, rather than a matrix of node-node connectivities""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + connectome_out: File = shell.outarg( + argstr="", + position=3, + path_template="connectome_out.txt", + help="""the output file containing edge weights""", + ) + out_assignments: File | bool | None = shell.outarg( + default=None, + argstr="-out_assignments", + path_template="out_assignments.txt", + help="""output the node assignments of each streamline to a file; this can be used subsequently e.g. by the command connectome2tck""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/tck2fixel.py b/pydra/tasks/mrtrix3/v3_1/tck2fixel.py new file mode 100644 index 0000000..efb8db1 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tck2fixel.py @@ -0,0 +1,108 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Tck2Fixel(shell.Task["Tck2Fixel.Outputs"]): + """ + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "tck2fixel" + + # Arguments + tracks: Tracks = shell.arg( + argstr="", + position=1, + help="""the input tracks.""", + ) + fixel_folder_in: Directory = shell.arg( + argstr="", + position=2, + help="""the input fixel folder; used to define the fixels and their directions""", + ) + fixel_folder_out: str = shell.arg( + argstr="", + position=3, + help="""the fixel folder to which the output will be written; this can be the same as the input folder if desired""", + ) + fixel_data_out: str = shell.arg( + argstr="", + position=4, + help="""the name of the fixel data image.""", + ) + + # Options + angle: float | None = shell.arg( + default=None, + argstr="-angle", + help="""the max angle threshold for assigning streamline tangents to fixels (default: 45 degrees)""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + pass diff --git a/pydra/tasks/mrtrix3/v3_1/tckconvert.py b/pydra/tasks/mrtrix3/v3_1/tckconvert.py new file mode 100644 index 0000000..a8a8e10 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tckconvert.py @@ -0,0 +1,159 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class TckConvert(shell.Task["TckConvert.Outputs"]): + """The program currently supports MRtrix .tck files (input/output), ascii text files (input/output), VTK polydata files (input/output), and RenderMan RIB (export only). + + + Example usages + -------------- + + + Writing multiple ASCII files, one per streamline: + + `$ tckconvert input.tck output-[].txt` + + By using the multi-file numbering syntax, where square brackets denote the position of the numbering for the files, this example will produce files named output-0000.txt, output-0001.txt, output-0002.txt, ... + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Daan Christiaens (daan.christiaens@kcl.ac.uk) and J-Donald Tournier (jdtournier@gmail.com) and Philip Broser (philip.broser@me.com) and Daniel Blezek (daniel.blezek@gmail.com) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "tckconvert" + + # Arguments + input: ty.Any = shell.arg( + argstr="", + position=1, + help="""the input track file.""", + ) + + # Options + scanner2voxel: ImageIn | None = shell.arg( + default=None, + argstr="-scanner2voxel", + help="""if specified, the properties of this image will be used to convert track point positions from real (scanner) coordinates into voxel coordinates.""", + ) + scanner2image: ImageIn | None = shell.arg( + default=None, + argstr="-scanner2image", + help="""if specified, the properties of this image will be used to convert track point positions from real (scanner) coordinates into image coordinates (in mm).""", + ) + voxel2scanner: ImageIn | None = shell.arg( + default=None, + argstr="-voxel2scanner", + help="""if specified, the properties of this image will be used to convert track point positions from voxel coordinates into real (scanner) coordinates.""", + ) + image2scanner: ImageIn | None = shell.arg( + default=None, + argstr="-image2scanner", + help="""if specified, the properties of this image will be used to convert track point positions from image coordinates (in mm) into real (scanner) coordinates.""", + ) + + # Options specific to PLY writer: + sides: int | None = shell.arg( + default=None, + argstr="-sides", + help="""number of sides for streamlines""", + ) + increment: int | None = shell.arg( + default=None, + argstr="-increment", + help="""generate streamline points at every (increment) points""", + ) + + # Options specific to RIB writer: + dec: bool = shell.arg( + default=False, + argstr="-dec", + help="""add DEC as a primvar""", + ) + + # Options for both PLY and RIB writer: + radius: float | None = shell.arg( + default=None, + argstr="-radius", + help="""radius of the streamlines""", + ) + + # Options specific to VTK writer: + ascii: bool = shell.arg( + default=False, + argstr="-ascii", + help="""write an ASCII VTK file (binary by default)""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: File = shell.outarg( + argstr="", + position=2, + path_template="out_file.txt", + help="""the output track file.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/tckdfc.py b/pydra/tasks/mrtrix3/v3_1/tckdfc.py new file mode 100644 index 0000000..6be274a --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tckdfc.py @@ -0,0 +1,154 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class TckDfc(shell.Task["TckDfc.Outputs"]): + """This command generates a Track-Weighted Image (TWI), where the contribution from each streamline to the image is the Pearson correlation between the fMRI time series at the streamline endpoints. + + The output image can be generated in one of two ways (note that one of these two command-line options MUST be provided): + + - "Static" functional connectivity (-static option): Each streamline contributes to a static 3D output image based on the correlation between the signals at the streamline endpoints using the entirety of the input time series. + + - "Dynamic" functional connectivity (-dynamic option): The output image is a 4D image, with the same number of volumes as the input fMRI time series. For each volume, the contribution from each streamline is calculated based on a finite-width sliding time window, centred at the timepoint corresponding to that volume. + + Note that the -backtrack option in this command is similar, but not precisely equivalent, to back-tracking as can be used with Anatomically-Constrained Tractography (ACT) in the tckgen command. However, here the feature does not change the streamlines trajectories in any way; it simply enables detection of the fact that the input fMRI image may not contain a valid timeseries underneath the streamline endpoint, and where this occurs, searches from the streamline endpoint inwards along the streamline trajectory in search of a valid timeseries to sample from the input image. + + + References + ---------- + + Calamante, F.; Smith, R.E.; Liang, X.; Zalesky, A.; Connelly, A. Track-weighted dynamic functional connectivity (TW-dFC): a new method to study time-resolved functional connectivity. Brain Struct Funct, 2017, doi: 10.1007/s00429-017-1431-1 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "tckdfc" + + # Arguments + tracks: File = shell.arg( + argstr="", + position=1, + help="""the input track file.""", + ) + fmri: ImageIn = shell.arg( + argstr="", + position=2, + help="""the pre-processed fMRI time series""", + ) + + # Options + + # Options for toggling between static and dynamic TW-dFC methods; note that one of these options MUST be provided: + static: bool = shell.arg( + default=False, + argstr="-static", + help="""generate a "static" (3D) output image.""", + ) + dynamic: tuple[str, str] | None = shell.arg( + default=None, + argstr="-dynamic", + help="""generate a "dynamic" (4D) output image; must additionally provide the shape and width (in volumes) of the sliding window.""", + sep=" ", + ) + + # Options for setting the properties of the output image: + template: ImageIn | None = shell.arg( + default=None, + argstr="-template", + help="""an image file to be used as a template for the output (the output image will have the same transform and field of view).""", + ) + vox: list[float] | None = shell.arg( + default=None, + argstr="-vox", + help="""provide either an isotropic voxel size (in mm), or comma-separated list of 3 voxel dimensions.""", + sep=",", + ) + stat_vox: str | None = shell.arg( + default=None, + argstr="-stat_vox", + help="""define the statistic for choosing the final voxel intensities for a given contrast type given the individual values from the tracks passing through each voxel; options are: sum, min, mean, max (default: mean)""", + allowed_values=["sum", "min", "mean", "max"], + ) + + # Other options for affecting the streamline sampling & mapping behaviour: + backtrack: bool = shell.arg( + default=False, + argstr="-backtrack", + help="""if no valid timeseries is found at the streamline endpoint, back-track along the streamline trajectory until a valid timeseries is found""", + ) + upsample: int | None = shell.arg( + default=None, + argstr="-upsample", + help="""upsample the tracks by some ratio using Hermite interpolation before mapping (if omitted, an appropriate ratio will be determined automatically)""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + argstr="", + position=3, + path_template="out_file.mif", + help="""the output TW-dFC image""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/tckedit.py b/pydra/tasks/mrtrix3/v3_1/tckedit.py new file mode 100644 index 0000000..7e8eba0 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tckedit.py @@ -0,0 +1,209 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class TckEdit(shell.Task["TckEdit.Outputs"]): + """This command can be used to perform various types of manipulations on track data. A range of such manipulations are demonstrated in the examples provided below. + + + Example usages + -------------- + + + Concatenate data from multiple track files into one: + + `$ tckedit *.tck all_tracks.tck` + + Here the wildcard operator is used to select all files in the current working directory that have the .tck filetype suffix; but input files can equivalently be specified one at a time explicitly. + + + Extract a reduced number of streamlines: + + `$ tckedit in_many.tck out_few.tck -number 1k -skip 500` + + The number of streamlines requested would typically be less than the number of streamlines in the input track file(s); if it is instead greater, then the command will issue a warning upon completion. By default the streamlines for the output file are extracted from the start of the input file(s); in this example the command is instead instructed to skip the first 500 streamlines, and write to the output file streamlines 501-1500. + + + Extract streamlines based on selection criteria: + + `$ tckedit in.tck out.tck -include ROI1.mif -include ROI2.mif -minlength 25` + + Multiple criteria can be added in a single invocation of tckedit, and a streamline must satisfy all criteria imposed in order to be written to the output file. Note that both -include and -exclude options can be specified multiple times to provide multiple waypoints / exclusion masks. + + + Select only those streamline vertices within a mask: + + `$ tckedit in.tck cropped.tck -mask mask.mif` + + The -mask option is applied to each streamline vertex independently, rather than to each streamline, retaining only those streamline vertices within the mask. As such, use of this option may result in a greater number of output streamlines than input streamlines, as a single input streamline may have the vertices at either endpoint retained but some vertices at its midpoint removed, effectively cutting one long streamline into multiple shorter streamlines. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "tckedit" + + # Arguments + tracks_in: MultiInputObj[Tracks] = shell.arg( + argstr="", + position=1, + help="""the input track file(s)""", + ) + tracks_out: Tracks = shell.arg( + argstr="", + position=2, + help="""the output track file""", + ) + + # Options + + # Region Of Interest processing options: + include: MultiInputObj[ty.Any] | None = shell.arg( + default=None, + argstr="-include", + help="""specify an inclusion region of interest, as either a binary mask image, or as a sphere using 4 comma-separared values (x,y,z,radius). Streamlines must traverse ALL inclusion regions to be accepted.""", + ) + include_ordered: MultiInputObj[str] | None = shell.arg( + default=None, + argstr="-include_ordered", + help="""specify an inclusion region of interest, as either a binary mask image, or as a sphere using 4 comma-separared values (x,y,z,radius). Streamlines must traverse ALL inclusion_ordered regions in the order they are specified in order to be accepted.""", + ) + exclude: MultiInputObj[ty.Any] | None = shell.arg( + default=None, + argstr="-exclude", + help="""specify an exclusion region of interest, as either a binary mask image, or as a sphere using 4 comma-separared values (x,y,z,radius). Streamlines that enter ANY exclude region will be discarded.""", + ) + mask: MultiInputObj[ty.Any] | None = shell.arg( + default=None, + argstr="-mask", + help="""specify a masking region of interest, as either a binary mask image, or as a sphere using 4 comma-separared values (x,y,z,radius). If defined, streamlines exiting the mask will be truncated.""", + ) + + # Streamline length threshold options: + maxlength: float | None = shell.arg( + default=None, + argstr="-maxlength", + help="""set the maximum length of any streamline in mm""", + ) + minlength: float | None = shell.arg( + default=None, + argstr="-minlength", + help="""set the minimum length of any streamline in mm""", + ) + + # Streamline count truncation options: + number: int | None = shell.arg( + default=None, + argstr="-number", + help="""set the desired number of selected streamlines to be propagated to the output file""", + ) + skip: int | None = shell.arg( + default=None, + argstr="-skip", + help="""omit this number of selected streamlines before commencing writing to the output file""", + ) + + # Thresholds pertaining to per-streamline weighting: + maxweight: float | None = shell.arg( + default=None, + argstr="-maxweight", + help="""set the maximum weight of any streamline""", + ) + minweight: float | None = shell.arg( + default=None, + argstr="-minweight", + help="""set the minimum weight of any streamline""", + ) + + # Other options specific to tckedit: + inverse: bool = shell.arg( + default=False, + argstr="-inverse", + help="""output the inverse selection of streamlines based on the criteria provided; i.e. only those streamlines that fail at least one selection criterion, and/or vertices that are outside masks if provided, will be written to file""", + ) + ends_only: bool = shell.arg( + default=False, + argstr="-ends_only", + help="""only test the ends of each streamline against the provided include/exclude ROIs""", + ) + + # Options for handling streamline weights: + tck_weights_in: File | None = shell.arg( + default=None, + argstr="-tck_weights_in", + help="""specify a text scalar file containing the streamline weights""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + tck_weights_out: File | bool | None = shell.outarg( + default=None, + argstr="-tck_weights_out", + path_template="tck_weights_out.txt", + help="""specify the path for an output text scalar file containing streamline weights""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/tckgen.py b/pydra/tasks/mrtrix3/v3_1/tckgen.py new file mode 100644 index 0000000..c41b594 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tckgen.py @@ -0,0 +1,358 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class TckGen(shell.Task["TckGen.Outputs"]): + """By default, tckgen produces a fixed number of streamlines, by attempting to seed from new random locations until the target number of streamlines have been selected (in other words, after all inclusion & exclusion criteria have been applied), or the maximum number of seeds has been exceeded (by default, this is 1000 x the desired number of selected streamlines). Use the -select and/or -seeds options to modify as required. See also the Seeding options section for alternative seeding strategies. + + Below is a list of available tracking algorithms, the input image data that they require, and a brief description of their behaviour: + + - FACT: Fiber Assigned by Continuous Tracking. A deterministic algorithm that takes as input a 4D image, with 3xN volumes, where N is the maximum number of fiber orientations in a voxel. Each triplet of volumes represents a 3D vector corresponding to a fiber orientation; the length of the vector additionally indicates some measure of density or anisotropy. As streamlines move from one voxel to another, the fiber orientation most collinear with the streamline orientation is selected (i.e. there is no intra-voxel interpolation). + + - iFOD1: First-order Integration over Fiber Orientation Distributions. A probabilistic algorithm that takes as input a Fiber Orientation Distribution (FOD) image represented in the Spherical Harmonic (SH) basis. At each streamline step, random samples from the local (trilinear interpolated) FOD are taken. A streamline is more probable to follow orientations where the FOD amplitude is large; but it may also rarely traverse orientations with small FOD amplitude. + + - iFOD2 (default): Second-order Integration over Fiber Orientation Distributions. A probabilistic algorithm that takes as input a Fiber Orientation Distribution (FOD) image represented in the Spherical Harmonic (SH) basis. Candidate streamline paths (based on short curved "arcs") are drawn, and the underlying (trilinear-interpolated) FOD amplitudes along those arcs are sampled. A streamline is more probable to follow a path where the FOD amplitudes along that path are large; but it may also rarely traverse orientations where the FOD amplitudes are small, as long as the amplitude remains above the FOD amplitude threshold along the entire path. + + - NullDist1 / NullDist2: Null Distribution tracking algorithms. These probabilistic algorithms expect as input the same image that was used when invoking the corresponding algorithm for which the null distribution is sought. These algorithms generate streamlines based on random orientation samples; that is, no image information relating to fiber orientations is used, and streamlines trajectories are determined entirely from random sampling. The NullDist2 algorithm is designed to be used in conjunction with iFOD2; NullDist1 should be used in conjunction with any first-order algorithm. + + - SD_STREAM: Streamlines tractography based on Spherical Deconvolution (SD). A deterministic algorithm that takes as input a Fiber Orientation Distribution (FOD) image represented in the Spherical Harmonic (SH) basis. At each streamline step, the local (trilinear-interpolated) FOD is sampled, and from the current streamline tangent orientation, a Newton optimisation on the sphere is performed in order to locate the orientation of the nearest FOD amplitude peak. + + - SeedTest: A dummy streamlines algorithm used for testing streamline seeding mechanisms. Any image can be used as input; the image will not be used in any way. For each seed point generated by the seeding mechanism(s), a streamline containing a single point corresponding to that seed location will be written to the output track file. + + - Tensor_Det: A deterministic algorithm that takes as input a 4D diffusion-weighted image (DWI) series. At each streamline step, the diffusion tensor is fitted to the local (trilinear-interpolated) diffusion data, and the streamline trajectory is determined as the principal eigenvector of that tensor. + + - Tensor_Prob: A probabilistic algorithm that takes as input a 4D diffusion-weighted image (DWI) series. Within each image voxel, a residual bootstrap is performed to obtain a unique realisation of the DWI data in that voxel for each streamline. These data are then sampled via trilinear interpolation at each streamline step, the diffusion tensor model is fitted, and the streamline follows the orientation of the principal eigenvector of that tensor. + + Note that the behaviour of the -angle option varies slightly depending on the order of integration: for any first-order method, this angle corresponds to the deviation in streamline trajectory per step; for higher-order methods, this corresponds to the change in underlying fibre orientation between the start and end points of each step. + + + References + ---------- + + References based on streamlines algorithm used: + + * FACT: + Mori, S.; Crain, B. J.; Chacko, V. P. & van Zijl, P. C. M. Three-dimensional tracking of axonal projections in the brain by magnetic resonance imaging. Annals of Neurology, 1999, 45, 265-269 + + * iFOD1 or SD_STREAM: + Tournier, J.-D.; Calamante, F. & Connelly, A. MRtrix: Diffusion tractography in crossing fiber regions. Int. J. Imaging Syst. Technol., 2012, 22, 53-66 + + * iFOD2: + Tournier, J.-D.; Calamante, F. & Connelly, A. Improved probabilistic streamlines tractography by 2nd order integration over fibre orientation distributions. Proceedings of the International Society for Magnetic Resonance in Medicine, 2010, 1670 + + * Nulldist1 / Nulldist2: + Morris, D. M.; Embleton, K. V. & Parker, G. J. Probabilistic fibre tracking: Differentiation of connections from chance events. NeuroImage, 2008, 42, 1329-1339 + + * Tensor_Det: + Basser, P. J.; Pajevic, S.; Pierpaoli, C.; Duda, J. & Aldroubi, A. In vivo fiber tractography using DT-MRI data. Magnetic Resonance in Medicine, 2000, 44, 625-632 + + * Tensor_Prob: + Jones, D. Tractography Gone Wild: Probabilistic Fibre Tracking Using the Wild Bootstrap With Diffusion Tensor MRI. IEEE Transactions on Medical Imaging, 2008, 27, 1268-1274 + + References based on command-line options: + + * -rk4: + Basser, P. J.; Pajevic, S.; Pierpaoli, C.; Duda, J. & Aldroubi, A. In vivo fiber tractography using DT-MRI data. Magnetic Resonance in Medicine, 2000, 44, 625-632 + + * -act, -backtrack, -seed_gmwmi: + 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 + + * -seed_dynamic: + Smith, R. E.; Tournier, J.-D.; Calamante, F. & Connelly, A. SIFT2: Enabling dense quantitative assessment of brain white matter connectivity using streamlines tractography. NeuroImage, 2015, 119, 338-351 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: J-Donald Tournier (jdtournier@gmail.com) and Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "tckgen" + + # Arguments + source: ImageIn = shell.arg( + argstr="", + position=1, + help="""The image containing the source data. The type of image data required depends on the algorithm used (see Description section).""", + ) + tracks: Tracks = shell.arg( + argstr="", + position=2, + help="""the output file containing the tracks generated.""", + ) + + # Options + algorithm: str | None = shell.arg( + default=None, + argstr="-algorithm", + help="""specify the tractography algorithm to use. Valid choices are: FACT, iFOD1, iFOD2, Nulldist1, Nulldist2, SD_Stream, Seedtest, Tensor_Det, Tensor_Prob (default: iFOD2).""", + allowed_values=[ + "fact", + "ifod1", + "ifod2", + "nulldist1", + "nulldist2", + "sd_stream", + "seedtest", + "tensor_det", + "tensor_prob", + ], + ) + + # Streamlines tractography options: + select: int | None = shell.arg( + default=None, + argstr="-select", + help="""set the desired number of streamlines to be selected by tckgen, after all selection criteria have been applied (i.e. inclusion/exclusion ROIs, min/max length, etc). tckgen will keep seeding streamlines until this number of streamlines have been selected, or the maximum allowed number of seeds has been exceeded (see -seeds option). By default, 5000 streamlines are to be selected. Set to zero to disable, which will result in streamlines being seeded until the number specified by -seeds has been reached.""", + ) + step: float | None = shell.arg( + default=None, + argstr="-step", + help="""set the step size of the algorithm in mm (defaults: for first-order algorithms, 0.1 x voxelsize; if using RK4, 0.25 x voxelsize; for iFOD2: 0.5 x voxelsize).""", + ) + angle: float | None = shell.arg( + default=None, + argstr="-angle", + help="""set the maximum angle in degrees between successive steps (defaults: 60 for deterministic algorithms; 15 for iFOD1 / nulldist1; 45 for iFOD2 / nulldist2)""", + ) + minlength: float | None = shell.arg( + default=None, + argstr="-minlength", + help="""set the minimum length of any track in mm (defaults: without ACT, 5 x voxelsize; with ACT, 2 x voxelsize).""", + ) + maxlength: float | None = shell.arg( + default=None, + argstr="-maxlength", + help="""set the maximum length of any track in mm (default: 100 x voxelsize).""", + ) + cutoff: float | None = shell.arg( + default=None, + argstr="-cutoff", + help="""set the FOD amplitude / fixel size / tensor FA cutoff for terminating tracks (defaults: 0.1 for FOD-based algorithms; 0.1 for fixel-based algorithms; 0.1 for tensor-based algorithms; threshold multiplied by 0.5 when using ACT).""", + ) + trials: int | None = shell.arg( + default=None, + argstr="-trials", + help="""set the maximum number of sampling trials at each point (only used for iFOD1 / iFOD2) (default: 1000).""", + ) + noprecomputed: bool = shell.arg( + default=False, + argstr="-noprecomputed", + help="""do NOT pre-compute legendre polynomial values. Warning: this will slow down the algorithm by a factor of approximately 4.""", + ) + rk4: bool = shell.arg( + default=False, + argstr="-rk4", + help="""use 4th-order Runge-Kutta integration (slower, but eliminates curvature overshoot in 1st-order deterministic methods)""", + ) + stop: bool = shell.arg( + default=False, + argstr="-stop", + help="""stop propagating a streamline once it has traversed all include regions""", + ) + downsample: int | None = shell.arg( + default=None, + argstr="-downsample", + help="""downsample the generated streamlines to reduce output file size (default is (samples-1) for iFOD2, no downsampling for all other algorithms)""", + ) + + # Tractography seeding mechanisms; at least one must be provided: + seed_image: MultiInputObj[ImageIn] | None = shell.arg( + default=None, + argstr="-seed_image", + help="""seed streamlines entirely at random within a mask image""", + ) + seed_sphere: MultiInputObj[list[float]] | None = shell.arg( + default=None, + argstr="-seed_sphere", + help="""spherical seed as four comma-separated values (XYZ position and radius)""", + sep=",", + ) + seed_random_per_voxel: MultiInputObj[tuple[ImageIn, ImageIn]] | None = shell.arg( + default=None, + argstr="-seed_random_per_voxel", + help="""seed a fixed number of streamlines per voxel in a mask image; random placement of seeds in each voxel""", + sep=" ", + ) + seed_grid_per_voxel: MultiInputObj[tuple[ImageIn, ImageIn]] | None = shell.arg( + default=None, + argstr="-seed_grid_per_voxel", + help="""seed a fixed number of streamlines per voxel in a mask image; place seeds on a 3D mesh grid (grid_size argument is per axis, so a grid_size of 3 results in 27 seeds per voxel)""", + sep=" ", + ) + seed_rejection: MultiInputObj[ImageIn] | None = shell.arg( + default=None, + argstr="-seed_rejection", + help="""seed from an image using rejection sampling (higher values = more probable to seed from)""", + ) + seed_gmwmi: MultiInputObj[ImageIn] | None = shell.arg( + default=None, + argstr="-seed_gmwmi", + help="""seed from the grey matter - white matter interface (only valid if using ACT framework). Input image should be a 3D seeding volume; seeds drawn within this image will be optimised to the interface using the 5TT image provided using the -act option.""", + ) + seed_dynamic: ImageIn | None = shell.arg( + default=None, + argstr="-seed_dynamic", + help="""determine seed points dynamically using the SIFT model (must not provide any other seeding mechanism). Note that while this seeding mechanism improves the distribution of reconstructed streamlines density, it should NOT be used as a substitute for the SIFT method itself.""", + ) + + # Tractography seeding options and parameters: + seeds: int | None = shell.arg( + default=None, + argstr="-seeds", + help="""set the number of seeds that tckgen will attempt to track from. If this option is NOT provided, the default number of seeds is set to 1000 x the number of selected streamlines. If -select is NOT also specified, tckgen will continue tracking until this number of seeds has been attempted. However, if -select is also specified, tckgen will stop when the number of seeds attempted reaches the number specified here, OR when the number of streamlines selected reaches the number requested with the -select option. This can be used to prevent the program from running indefinitely when no or very few streamlines can be found that match the selection criteria Setting this to zero will cause tckgen to keep attempting seeds until the number specified by -select has been reached.""", + ) + max_attempts_per_seed: int | None = shell.arg( + default=None, + argstr="-max_attempts_per_seed", + help="""set the maximum number of times that the tracking algorithm should attempt to find an appropriate tracking direction from a given seed point. This should be set high enough to ensure that an actual plausible seed point is not discarded prematurely as being unable to initiate tracking from. Higher settings may affect performance if many seeds are genuinely impossible to track from, as many attempts will still be made in vain for such seeds. (default: 1000)""", + ) + seed_cutoff: float | None = shell.arg( + default=None, + argstr="-seed_cutoff", + help="""set the minimum FA or FOD amplitude for seeding tracks (default is the same as the normal -cutoff).""", + ) + seed_unidirectional: bool = shell.arg( + default=False, + argstr="-seed_unidirectional", + help="""track from the seed point in one direction only (default is to track in both directions).""", + ) + seed_direction: list[float] | None = shell.arg( + default=None, + argstr="-seed_direction", + help="""specify a seeding direction for the tracking (this should be supplied as a vector of 3 comma-separated values.""", + sep=",", + ) + + # Region Of Interest processing options: + include: MultiInputObj[ty.Any] | None = shell.arg( + default=None, + argstr="-include", + help="""specify an inclusion region of interest, as either a binary mask image, or as a sphere using 4 comma-separared values (x,y,z,radius). Streamlines must traverse ALL inclusion regions to be accepted.""", + ) + include_ordered: MultiInputObj[str] | None = shell.arg( + default=None, + argstr="-include_ordered", + help="""specify an inclusion region of interest, as either a binary mask image, or as a sphere using 4 comma-separared values (x,y,z,radius). Streamlines must traverse ALL inclusion_ordered regions in the order they are specified in order to be accepted.""", + ) + exclude: MultiInputObj[ty.Any] | None = shell.arg( + default=None, + argstr="-exclude", + help="""specify an exclusion region of interest, as either a binary mask image, or as a sphere using 4 comma-separared values (x,y,z,radius). Streamlines that enter ANY exclude region will be discarded.""", + ) + mask: MultiInputObj[ty.Any] | None = shell.arg( + default=None, + argstr="-mask", + help="""specify a masking region of interest, as either a binary mask image, or as a sphere using 4 comma-separared values (x,y,z,radius). If defined, streamlines exiting the mask will be truncated.""", + ) + + # Anatomically-Constrained Tractography options: + act: ImageIn | None = shell.arg( + default=None, + argstr="-act", + help="""use the Anatomically-Constrained Tractography framework during tracking; provided image must be in the 5TT (five-tissue-type) format""", + ) + backtrack: bool = shell.arg( + default=False, + argstr="-backtrack", + help="""allow tracks to be truncated and re-tracked if a poor structural termination is encountered""", + ) + crop_at_gmwmi: bool = shell.arg( + default=False, + argstr="-crop_at_gmwmi", + help="""crop streamline endpoints more precisely as they cross the GM-WM interface""", + ) + + # Options specific to the iFOD tracking algorithms: + power: float | None = shell.arg( + default=None, + argstr="-power", + help="""raise the FOD to the power specified (defaults are: 1.0 for iFOD1; 1.0/nsamples for iFOD2).""", + ) + + # Options specific to the iFOD2 tracking algorithm: + samples: int | None = shell.arg( + default=None, + argstr="-samples", + help="""set the number of FOD samples to take per step (Default: 4).""", + ) + + # DW gradient table import options: + grad: File | None = shell.arg( + default=None, + argstr="-grad", + help="""Provide the diffusion-weighted gradient scheme used in the acquisition in a text file. This should be supplied as a 4xN text file with each line in the format [ X Y Z b ], where [ X Y Z ] describe the direction of the applied gradient, and b gives the b-value in units of s/mm^2. If a diffusion gradient scheme is present in the input image header, the data provided with this option will be instead used.""", + ) + fslgrad: tuple[File, File] | None = shell.arg( + default=None, + argstr="-fslgrad", + help="""Provide the diffusion-weighted gradient scheme used in the acquisition in FSL bvecs/bvals format files. If a diffusion gradient scheme is present in the input image header, the data provided with this option will be instead used.""", + sep=" ", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + output_seeds: File | bool | None = shell.outarg( + default=None, + argstr="-output_seeds", + path_template="output_seeds.txt", + help="""output the seed location of all successful streamlines to a file""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/tckglobal.py b/pydra/tasks/mrtrix3/v3_1/tckglobal.py new file mode 100644 index 0000000..52e5ffd --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tckglobal.py @@ -0,0 +1,224 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class TckGlobal(shell.Task["TckGlobal.Outputs"]): + """This command will reconstruct the global white matter fibre tractogram that best explains the input DWI data, using a multi-tissue spherical convolution model. + + A more thorough description of the operation of global tractography in MRtrix3 can be found in the online documentation: + https://mrtrix.readthedocs.io/en/3.0.4/quantitative_structural_connectivity/global_tractography.html + + + Example usages + -------------- + + + Basic example usage: + + `$ tckglobal dwi.mif wmr.txt -riso csfr.txt -riso gmr.txt -mask mask.mif -niter 1e9 -fod fod.mif -fiso fiso.mif tracks.tck` + + dwi.mif is the input image, wmr.txt is an anisotropic1, multi-shell response function for WM, and csfr.txt and gmr.txt are isotropic response functions for CSF and GM. The output tractogram is saved to tracks.tck. Optional output images fod.mif and fiso.mif contain the predicted WM fODF and isotropic tissue fractions of CSF and GM respectively, estimated as part of the global optimization and thus affected by spatial regularization. + + + References + ---------- + + Christiaens, D.; Reisert, M.; Dhollander, T.; Sunaert, S.; Suetens, P. & Maes, F. Global tractography of multi-shell diffusion-weighted imaging data using a multi-tissue model. NeuroImage, 2015, 123, 89-101 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Daan Christiaens (daan.christiaens@kcl.ac.uk) + + Copyright: Copyright (C) 2015 KU Leuven, Dept. Electrical Engineering, ESAT/PSI, + Herestraat 49 box 7003, 3000 Leuven, Belgium + + This is free software; see the source for copying conditions. + There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + """ + + executable = "tckglobal" + + # Arguments + source: ImageIn = shell.arg( + argstr="", + position=1, + help="""the image containing the raw DWI data.""", + ) + response: File = shell.arg( + argstr="", + position=2, + help="""the response of a track segment on the DWI signal.""", + ) + tracks: Tracks = shell.arg( + argstr="", + position=3, + help="""the output file containing the tracks generated.""", + ) + + # Options + + # Input options: + grad: File | None = shell.arg( + default=None, + argstr="-grad", + help="""specify the diffusion encoding scheme (required if not supplied in the header).""", + ) + mask: ImageIn | None = shell.arg( + default=None, + argstr="-mask", + help="""only reconstruct the tractogram within the specified brain mask image.""", + ) + riso: MultiInputObj[File] | None = shell.arg( + default=None, + argstr="-riso", + help="""set one or more isotropic response functions. (multiple allowed)""", + ) + + # Parameters: + lmax: int | None = shell.arg( + default=None, + argstr="-lmax", + help="""set the maximum harmonic order for the output series. (default = 8)""", + ) + length: float | None = shell.arg( + default=None, + argstr="-length", + help="""set the length of the particles (fibre segments). (default = 1mm)""", + ) + weight: float | None = shell.arg( + default=None, + argstr="-weight", + help="""set the weight by which particles contribute to the model. (default = 0.1)""", + ) + ppot: float | None = shell.arg( + default=None, + argstr="-ppot", + help="""set the particle potential, i.e., the cost of adding one segment, relative to the particle weight. (default = 0.05)""", + ) + cpot: float | None = shell.arg( + default=None, + argstr="-cpot", + help="""set the connection potential, i.e., the energy term that drives two segments together. (default = 0.5)""", + ) + t0: float | None = shell.arg( + default=None, + argstr="-t0", + help="""set the initial temperature of the metropolis hastings optimizer. (default = 0.1)""", + ) + t1: float | None = shell.arg( + default=None, + argstr="-t1", + help="""set the final temperature of the metropolis hastings optimizer. (default = 0.001)""", + ) + niter: int | None = shell.arg( + default=None, + argstr="-niter", + help="""set the number of iterations of the metropolis hastings optimizer. (default = 10M)""", + ) + + # Output options: + noapo: bool = shell.arg( + default=False, + argstr="-noapo", + help="""disable spherical convolution of fODF with apodized PSF, to output a sum of delta functions rather than a sum of aPSFs.""", + ) + + # Advanced parameters, if you really know what you're doing: + balance: float | None = shell.arg( + default=None, + argstr="-balance", + help="""balance internal and external energy. (default = 0). Negative values give more weight to the internal energy; positive to the external energy.""", + ) + density: float | None = shell.arg( + default=None, + argstr="-density", + help="""set the desired density of the free Poisson process. (default = 1)""", + ) + prob: list[float] | None = shell.arg( + default=None, + argstr="-prob", + help="""set the probabilities of generating birth, death, randshift, optshift and connect proposals respectively. (default = 0.25,0.05,0.25,0.1,0.35)""", + sep=",", + ) + beta: float | None = shell.arg( + default=None, + argstr="-beta", + help="""set the width of the Hanning interpolation window. (in [0, 1], default = 0). If used, a mask is required, and this mask must keep at least one voxel distance to the image bounding box.""", + ) + lambda_: float | None = shell.arg( + default=None, + argstr="-lambda", + help="""set the weight of the internal energy directly. (default = 1). If provided, any value of -balance will be ignored.""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + fod: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-fod", + path_template="fod.mif", + help="""Predicted fibre orientation distribution function (fODF). This fODF is estimated as part of the global track optimization, and therefore incorporates the spatial regularization that it imposes. Internally, the fODF is represented as a discrete sum of apodized point spread functions (aPSF) oriented along the directions of all particles in the voxel, used to predict the DWI signal from the particle configuration.""", + ) + fiso: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-fiso", + path_template="fiso.mif", + help="""Predicted isotropic fractions of the tissues for which response functions were provided with -riso. Typically, these are CSF and GM.""", + ) + eext: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-eext", + path_template="eext.mif", + help="""Residual external energy in every voxel.""", + ) + etrend: File | bool | None = shell.outarg( + default=None, + argstr="-etrend", + path_template="etrend.txt", + help="""internal and external energy trend and cooling statistics.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/tckinfo.py b/pydra/tasks/mrtrix3/v3_1/tckinfo.py new file mode 100644 index 0000000..003da97 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tckinfo.py @@ -0,0 +1,93 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class TckInfo(shell.Task["TckInfo.Outputs"]): + """ + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: J-Donald Tournier (jdtournier@gmail.com) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "tckinfo" + + # Arguments + tracks: MultiInputObj[Tracks] = shell.arg( + argstr="", + position=1, + help="""the input track file.""", + ) + + # Options + count: bool = shell.arg( + default=False, + argstr="-count", + help="""count number of tracks in file explicitly, ignoring the header""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + pass diff --git a/pydra/tasks/mrtrix3/v3_1/tckmap.py b/pydra/tasks/mrtrix3/v3_1/tckmap.py new file mode 100644 index 0000000..9f215b5 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tckmap.py @@ -0,0 +1,300 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class TckMap(shell.Task["TckMap.Outputs"]): + """The -contrast option controls how a value is derived for each streamline that is subsequently contributed to the image elements intersected by that streamline, and therefore strongly influences the contrast of that image. The permissible values are briefly summarised as follows: + + - tdi: Each streamline effectively contributes a value of unity to the final map (equivalent to the original Track Density Imaging (TDI) method) + + - length: The length of the streamline in mm + + - invlength: The reciprocal of streamline length + + - scalar_map: Values are sampled from a scalar image (which must be provided via -image) + + - scalar_map_count: If a non-zero value is sampled from a scalar image (as provided via -image), the streamline contributes a value of 1, otherwise it contributes 0, such that an image can be produced reflecting the density of streamlines that intersect such an image + + - fod_amp: The amplitudes of a Fibre Orientation Distribution (FOD) image + + - curvature: The curvature of the streamline + + - vector_file: A value for each streamline has been pre-calculated, and these are provided in a text file via the -vector_file option + + A "super-resolution" output image can be generated using the -vox option, whether or not a template image is provided using the -template option. If -template is used in conjunction with -vox, the image axes and FoV will still match that of the template image, but the spatial resolution will differ. + + Note: if you run into limitations with RAM usage, make sure you output the results to a .mif file or .mih / .dat file pair; this will avoid the allocation of an additional buffer to store the output for write-out. + + + References + ---------- + + * For TDI or DEC TDI: + Calamante, F.; Tournier, J.-D.; Jackson, G. D. & Connelly, A. Track-density imaging (TDI): Super-resolution white matter imaging using whole-brain track-density mapping. NeuroImage, 2010, 53, 1233-1243 + + * If using -contrast length and -stat_vox mean: + Pannek, K.; Mathias, J. L.; Bigler, E. D.; Brown, G.; Taylor, J. D. & Rose, S. E. The average pathlength map: A diffusion MRI tractography-derived index for studying brain pathology. NeuroImage, 2011, 55, 133-141 + + * If using -dixel option with TDI contrast only: + Smith, R.E., Tournier, J-D., Calamante, F., Connelly, A. A novel paradigm for automated segmentation of very large whole-brain probabilistic tractography data sets. In proc. ISMRM, 2011, 19, 673 + + * If using -dixel option with any other contrast: + Pannek, K., Raffelt, D., Salvado, O., Rose, S. Incorporating directional information in diffusion tractography derived maps: angular track imaging (ATI). In Proc. ISMRM, 2012, 20, 1912 + + * If using -tod option: + Dhollander, T., Emsell, L., Van Hecke, W., Maes, F., Sunaert, S., Suetens, P. Track Orientation Density Imaging (TODI) and Track Orientation Distribution (TOD) based tractography. NeuroImage, 2014, 94, 312-336 + + * If using other contrasts / statistics: + Calamante, F.; Tournier, J.-D.; Smith, R. E. & Connelly, A. A generalised framework for super-resolution track-weighted imaging. NeuroImage, 2012, 59, 2494-2503 + + * If using -precise mapping option: + Smith, R. E.; Tournier, J.-D.; Calamante, F. & Connelly, A. SIFT: Spherical-deconvolution informed filtering of tractograms. NeuroImage, 2013, 67, 298-312 (Appendix 3) + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) and J-Donald Tournier (jdtournier@gmail.com) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "tckmap" + + # Arguments + tracks: File = shell.arg( + argstr="", + position=1, + help="""the input track file.""", + ) + + # Options + + # Options for the header of the output image: + template: ImageIn | None = shell.arg( + default=None, + argstr="-template", + help="""an image file to be used as a template for the output (the output image will have the same transform and field of view).""", + ) + vox: list[float] | None = shell.arg( + default=None, + argstr="-vox", + help="""provide either an isotropic voxel size (in mm), or comma-separated list of 3 voxel dimensions.""", + sep=",", + ) + datatype: str | None = shell.arg( + default=None, + argstr="-datatype", + help="""specify output image data type.""", + allowed_values=[ + "float16", + "float16le", + "float16be", + "float32", + "float32le", + "float32be", + "float64", + "float64le", + "float64be", + "int64", + "uint64", + "int64le", + "uint64le", + "int64be", + "uint64be", + "int32", + "uint32", + "int32le", + "uint32le", + "int32be", + "uint32be", + "int16", + "uint16", + "int16le", + "uint16le", + "int16be", + "uint16be", + "cfloat16", + "cfloat16le", + "cfloat16be", + "cfloat32", + "cfloat32le", + "cfloat32be", + "cfloat64", + "cfloat64le", + "cfloat64be", + "int8", + "uint8", + "bit", + ], + ) + + # Options for the dimensionality of the output image: + dec: bool = shell.arg( + default=False, + argstr="-dec", + help="""perform track mapping in directionally-encoded colour (DEC) space""", + ) + dixel: ty.Any = shell.arg( + default=None, + argstr="-dixel", + help="""map streamlines to dixels within each voxel; requires either a number of dixels (references an internal direction set), or a path to a text file containing a set of directions stored as azimuth/elevation pairs""", + ) + tod: int | None = shell.arg( + default=None, + argstr="-tod", + help="""generate a Track Orientation Distribution (TOD) in each voxel; need to specify the maximum spherical harmonic degree lmax to use when generating Apodised Point Spread Functions""", + ) + + # Options for the TWI image contrast properties: + contrast: str | None = shell.arg( + default=None, + argstr="-contrast", + help="""define the desired form of contrast for the output image; options are: tdi, length, invlength, scalar_map, scalar_map_count, fod_amp, curvature, vector_file (default: tdi)""", + allowed_values=[ + "tdi", + "length", + "invlength", + "scalar_map", + "scalar_map_count", + "fod_amp", + "curvature", + "vector_file", + ], + ) + image_: ImageIn | None = shell.arg( + default=None, + argstr="-image", + help="""provide the scalar image map for generating images with 'scalar_map' / 'scalar_map_count' contrast, or the spherical harmonics image for 'fod_amp' contrast""", + ) + vector_file: File | None = shell.arg( + default=None, + argstr="-vector_file", + help="""provide the vector data file for generating images with 'vector_file' contrast""", + ) + stat_vox: str | None = shell.arg( + default=None, + argstr="-stat_vox", + help="""define the statistic for choosing the final voxel intensities for a given contrast type given the individual values from the tracks passing through each voxel. Options are: sum, min, mean, max (default: sum)""", + allowed_values=["sum", "min", "mean", "max"], + ) + stat_tck: str | None = shell.arg( + default=None, + argstr="-stat_tck", + help="""define the statistic for choosing the contribution to be made by each streamline as a function of the samples taken along their lengths. Only has an effect for 'scalar_map', 'fod_amp' and 'curvature' contrast types. Options are: sum, min, mean, max, median, mean_nonzero, gaussian, ends_min, ends_mean, ends_max, ends_prod (default: mean)""", + allowed_values=[ + "sum", + "min", + "mean", + "max", + "median", + "mean_nonzero", + "gaussian", + "ends_min", + "ends_mean", + "ends_max", + "ends_prod", + ], + ) + fwhm_tck: float | None = shell.arg( + default=None, + argstr="-fwhm_tck", + help="""when using gaussian-smoothed per-track statistic, specify the desired full-width half-maximum of the Gaussian smoothing kernel (in mm)""", + ) + map_zero: bool = shell.arg( + default=False, + argstr="-map_zero", + help="""if a streamline has zero contribution based on the contrast & statistic, typically it is not mapped; use this option to still contribute to the map even if this is the case (these non-contributing voxels can then influence the mean value in each voxel of the map)""", + ) + backtrack: bool = shell.arg( + default=False, + argstr="-backtrack", + help="""when using -stat_tck ends_*, if the streamline endpoint is outside the FoV, backtrack along the streamline trajectory until an appropriate point is found""", + ) + + # Options for the streamline-to-voxel mapping mechanism: + upsample: int | None = shell.arg( + default=None, + argstr="-upsample", + help="""upsample the tracks by some ratio using Hermite interpolation before mappping (if omitted, an appropriate ratio will be determined automatically)""", + ) + precise: bool = shell.arg( + default=False, + argstr="-precise", + help="""use a more precise streamline mapping strategy, that accurately quantifies the length through each voxel (these lengths are then taken into account during TWI calculation)""", + ) + ends_only: bool = shell.arg( + default=False, + argstr="-ends_only", + help="""only map the streamline endpoints to the image""", + ) + tck_weights_in: File | None = shell.arg( + default=None, + argstr="-tck_weights_in", + help="""specify a text scalar file containing the streamline weights""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="out_file.mif", + help="""the output track-weighted image""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/tckresample.py b/pydra/tasks/mrtrix3/v3_1/tckresample.py new file mode 100644 index 0000000..d4f478b --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tckresample.py @@ -0,0 +1,136 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class TckResample(shell.Task["TckResample.Outputs"]): + """It is necessary to specify precisely ONE of the command-line options for controlling how this resampling takes place; this may be either increasing or decreasing the number of samples along each streamline, or may involve changing the positions of the samples according to some specified trajectory. + + Note that because the length of a streamline is calculated based on the sums of distances between adjacent vertices, resampling a streamline to a new set of vertices will typically change the quantified length of that streamline; the magnitude of the difference will typically depend on the discrepancy in the number of vertices, with less vertices leading to a shorter length (due to taking chordal lengths of curved trajectories). + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) and J-Donald Tournier (jdtournier@gmail.com) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "tckresample" + + # Arguments + in_tracks: Tracks = shell.arg( + argstr="", + position=1, + help="""the input track file""", + ) + out_tracks: Tracks = shell.arg( + argstr="", + position=2, + help="""the output resampled tracks""", + ) + + # Options + + # Streamline resampling options: + upsample: int | None = shell.arg( + default=None, + argstr="-upsample", + help="""increase the density of points along the length of each streamline by some factor (may improve mapping streamlines to ROIs, and/or visualisation)""", + ) + downsample: int | None = shell.arg( + default=None, + argstr="-downsample", + help="""increase the density of points along the length of each streamline by some factor (decreases required storage space)""", + ) + step_size: float | None = shell.arg( + default=None, + argstr="-step_size", + help="""re-sample the streamlines to a desired step size (in mm)""", + ) + num_points: int | None = shell.arg( + default=None, + argstr="-num_points", + help="""re-sample each streamline to a fixed number of points""", + ) + endpoints: bool = shell.arg( + default=False, + argstr="-endpoints", + help="""only output the two endpoints of each streamline""", + ) + line: tuple[int, int, int] | None = shell.arg( + default=None, + argstr="-line", + help="""resample tracks at 'num' equidistant locations along a line between 'start' and 'end' (specified as comma-separated 3-vectors in scanner coordinates)""", + sep=" ", + ) + arc: tuple[int, int, int, int] | None = shell.arg( + default=None, + argstr="-arc", + help="""resample tracks at 'num' equidistant locations along a circular arc specified by points 'start', 'mid' and 'end' (specified as comma-separated 3-vectors in scanner coordinates)""", + sep=" ", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + pass diff --git a/pydra/tasks/mrtrix3/v3_1/tcksample.py b/pydra/tasks/mrtrix3/v3_1/tcksample.py new file mode 100644 index 0000000..18a20fd --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tcksample.py @@ -0,0 +1,123 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class TckSample(shell.Task["TckSample.Outputs"]): + """By default, the value of the underlying image at each point along the track is written to either an ASCII file (with all values for each track on the same line), or a track scalar file (.tsf). Alternatively, some statistic can be taken from the values along each streamline and written to a vector file. + + + References + ---------- + + * If using -precise option: Smith, R. E.; Tournier, J.-D.; Calamante, F. & Connelly, A. SIFT: Spherical-deconvolution informed filtering of tractograms. NeuroImage, 2013, 67, 298-312 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "tcksample" + + # Arguments + tracks: Tracks = shell.arg( + argstr="", + position=1, + help="""the input track file""", + ) + image_: ImageIn = shell.arg( + argstr="", + position=2, + help="""the image to be sampled""", + ) + + # Options + stat_tck: str | None = shell.arg( + default=None, + argstr="-stat_tck", + help="""compute some statistic from the values along each streamline; (options are: mean,median,min,max)""", + allowed_values=["mean", "median", "min", "max"], + ) + nointerp: bool = shell.arg( + default=False, + argstr="-nointerp", + help="""do not use trilinear interpolation when sampling image values""", + ) + precise: bool = shell.arg( + default=False, + argstr="-precise", + help="""use the precise mechanism for mapping streamlines to voxels (obviates the need for trilinear interpolation) (only applicable if some per-streamline statistic is requested)""", + ) + use_tdi_fraction: bool = shell.arg( + default=False, + argstr="-use_tdi_fraction", + help="""each streamline is assigned a fraction of the image intensity in each voxel based on the fraction of the track density contributed by that streamline (this is only appropriate for processing a whole-brain tractogram, and images for which the quantiative parameter is additive)""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + values: File = shell.outarg( + argstr="", + position=3, + path_template="values.txt", + help="""the output sampled values""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/tcksift.py b/pydra/tasks/mrtrix3/v3_1/tcksift.py new file mode 100644 index 0000000..4838cb4 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tcksift.py @@ -0,0 +1,192 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class TckSift(shell.Task["TckSift.Outputs"]): + """ + References + ---------- + + Smith, R. E.; Tournier, J.-D.; Calamante, F. & Connelly, A. SIFT: Spherical-deconvolution informed filtering of tractograms. NeuroImage, 2013, 67, 298-312 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "tcksift" + + # Arguments + in_tracks: Tracks = shell.arg( + argstr="", + position=1, + help="""the input track file""", + ) + in_fod: ImageIn = shell.arg( + argstr="", + position=2, + help="""input image containing the spherical harmonics of the fibre orientation distributions""", + ) + out_tracks: Tracks = shell.arg( + argstr="", + position=3, + help="""the output filtered tracks file""", + ) + + # Options + nofilter: bool = shell.arg( + default=False, + argstr="-nofilter", + help="""do NOT perform track filtering; just construct the model in order to provide output debugging images""", + ) + output_at_counts: list[int] | None = shell.arg( + default=None, + argstr="-output_at_counts", + help="""output filtered track files (and optionally debugging images if -output_debug is specified) at specific numbers of remaining streamlines; provide as comma-separated list of integers""", + sep=",", + ) + + # Options for setting the processing mask for the SIFT fixel-streamlines comparison model: + proc_mask: ImageIn | None = shell.arg( + default=None, + argstr="-proc_mask", + help="""provide an image containing the processing mask weights for the model; image spatial dimensions must match the fixel image""", + ) + act: ImageIn | None = shell.arg( + default=None, + argstr="-act", + help="""use an ACT five-tissue-type segmented anatomical image to derive the processing mask""", + ) + + # Options affecting the SIFT model: + fd_scale_gm: bool = shell.arg( + default=False, + argstr="-fd_scale_gm", + help="""provide this option (in conjunction with -act) to heuristically downsize the fibre density estimates based on the presence of GM in the voxel. This can assist in reducing tissue interface effects when using a single-tissue deconvolution algorithm""", + ) + no_dilate_lut: bool = shell.arg( + default=False, + argstr="-no_dilate_lut", + help="""do NOT dilate FOD lobe lookup tables; only map streamlines to FOD lobes if the precise tangent lies within the angular spread of that lobe""", + ) + make_null_lobes: bool = shell.arg( + default=False, + argstr="-make_null_lobes", + help="""add an additional FOD lobe to each voxel, with zero integral, that covers all directions with zero / negative FOD amplitudes""", + ) + remove_untracked: bool = shell.arg( + default=False, + argstr="-remove_untracked", + help="""remove FOD lobes that do not have any streamline density attributed to them; this improves filtering slightly, at the expense of longer computation time (and you can no longer trivially do quantitative comparisons between reconstructions if this is enabled)""", + ) + fd_thresh: float | None = shell.arg( + default=None, + argstr="-fd_thresh", + help="""fibre density threshold; exclude an FOD lobe from filtering processing if its integral is less than this amount (streamlines will still be mapped to it, but it will not contribute to the cost function or the filtering)""", + ) + + # Options to make SIFT provide additional output files: + + # Options to control when SIFT terminates filtering: + term_number: int | None = shell.arg( + default=None, + argstr="-term_number", + help="""number of streamlines; continue filtering until this number of streamlines remain""", + ) + term_ratio: float | None = shell.arg( + default=None, + argstr="-term_ratio", + help="""termination ratio; defined as the ratio between reduction in cost function, and reduction in density of streamlines. Smaller values result in more streamlines being filtered out.""", + ) + term_mu: float | None = shell.arg( + default=None, + argstr="-term_mu", + help="""terminate filtering once the SIFT proportionality coefficient reaches a given value""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + csv: File | bool | None = shell.outarg( + default=None, + argstr="-csv", + path_template="csv.txt", + help="""output statistics of execution per iteration to a .csv file""", + ) + out_mu: File | bool | None = shell.outarg( + default=None, + argstr="-out_mu", + path_template="out_mu.txt", + help="""output the final value of SIFT proportionality coefficient mu to a text file""", + ) + output_debug: Directory | bool | None = shell.outarg( + default=None, + argstr="-output_debug", + path_template="output_debug", + help="""write to a directory various output images for assessing & debugging performance etc.""", + ) + out_selection: File | bool | None = shell.outarg( + default=None, + argstr="-out_selection", + path_template="out_selection.txt", + help="""output a text file containing the binary selection of streamlines""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/tcksift2.py b/pydra/tasks/mrtrix3/v3_1/tcksift2.py new file mode 100644 index 0000000..011fb9d --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tcksift2.py @@ -0,0 +1,232 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class TckSift2(shell.Task["TckSift2.Outputs"]): + """ + References + ---------- + + Smith, R. E.; Tournier, J.-D.; Calamante, F. & Connelly, A. SIFT2: Enabling dense quantitative assessment of brain white matter connectivity using streamlines tractography. NeuroImage, 2015, 119, 338-351 + + * If using the -linear option: + Smith, RE; Raffelt, D; Tournier, J-D; Connelly, A. Quantitative Streamlines Tractography: Methods and Inter-Subject Normalisation. Open Science Framework, https://doi.org/10.31219/osf.io/c67kn. + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "tcksift2" + + # Arguments + in_tracks: Tracks = shell.arg( + argstr="", + position=1, + help="""the input track file""", + ) + in_fod: ImageIn = shell.arg( + argstr="", + position=2, + help="""input image containing the spherical harmonics of the fibre orientation distributions""", + ) + + # Options + + # Options for setting the processing mask for the SIFT fixel-streamlines comparison model: + proc_mask: ImageIn | None = shell.arg( + default=None, + argstr="-proc_mask", + help="""provide an image containing the processing mask weights for the model; image spatial dimensions must match the fixel image""", + ) + act: ImageIn | None = shell.arg( + default=None, + argstr="-act", + help="""use an ACT five-tissue-type segmented anatomical image to derive the processing mask""", + ) + + # Options affecting the SIFT model: + fd_scale_gm: bool = shell.arg( + default=False, + argstr="-fd_scale_gm", + help="""provide this option (in conjunction with -act) to heuristically downsize the fibre density estimates based on the presence of GM in the voxel. This can assist in reducing tissue interface effects when using a single-tissue deconvolution algorithm""", + ) + no_dilate_lut: bool = shell.arg( + default=False, + argstr="-no_dilate_lut", + help="""do NOT dilate FOD lobe lookup tables; only map streamlines to FOD lobes if the precise tangent lies within the angular spread of that lobe""", + ) + make_null_lobes: bool = shell.arg( + default=False, + argstr="-make_null_lobes", + help="""add an additional FOD lobe to each voxel, with zero integral, that covers all directions with zero / negative FOD amplitudes""", + ) + remove_untracked: bool = shell.arg( + default=False, + argstr="-remove_untracked", + help="""remove FOD lobes that do not have any streamline density attributed to them; this improves filtering slightly, at the expense of longer computation time (and you can no longer trivially do quantitative comparisons between reconstructions if this is enabled)""", + ) + fd_thresh: float | None = shell.arg( + default=None, + argstr="-fd_thresh", + help="""fibre density threshold; exclude an FOD lobe from filtering processing if its integral is less than this amount (streamlines will still be mapped to it, but it will not contribute to the cost function or the filtering)""", + ) + + # Options to make SIFT provide additional output files: + + # Regularisation options for SIFT2: + reg_tikhonov: float | None = shell.arg( + default=None, + argstr="-reg_tikhonov", + help="""provide coefficient for regularising streamline weighting coefficients (Tikhonov regularisation) (default: 0)""", + ) + reg_tv: float | None = shell.arg( + default=None, + argstr="-reg_tv", + help="""provide coefficient for regularising variance of streamline weighting coefficient to fixels along its length (Total Variation regularisation) (default: 0.1)""", + ) + + # Options for controlling the SIFT2 optimisation algorithm: + min_td_frac: float | None = shell.arg( + default=None, + argstr="-min_td_frac", + help="""minimum fraction of the FOD integral reconstructed by streamlines; if the reconstructed streamline density is below this fraction, the fixel is excluded from optimisation (default: 0.1)""", + ) + min_iters: int | None = shell.arg( + default=None, + argstr="-min_iters", + help="""minimum number of iterations to run before testing for convergence; this can prevent premature termination at early iterations if the cost function increases slightly (default: 10)""", + ) + max_iters: int | None = shell.arg( + default=None, + argstr="-max_iters", + help="""maximum number of iterations to run before terminating program""", + ) + min_factor: float | None = shell.arg( + default=None, + argstr="-min_factor", + help="""minimum weighting factor for an individual streamline; if the factor falls below this number, the streamline will be rejected entirely (factor set to zero) (default: 0)""", + ) + min_coeff: float | None = shell.arg( + default=None, + argstr="-min_coeff", + help="""minimum weighting coefficient for an individual streamline; similar to the '-min_factor' option, but using the exponential coefficient basis of the SIFT2 model; these parameters are related as: factor = e^(coeff). Note that the -min_factor and -min_coeff options are mutually exclusive; you can only provide one. (default: -inf)""", + ) + max_factor: float | None = shell.arg( + default=None, + argstr="-max_factor", + help="""maximum weighting factor that can be assigned to any one streamline (default: inf)""", + ) + max_coeff: float | None = shell.arg( + default=None, + argstr="-max_coeff", + help="""maximum weighting coefficient for an individual streamline; similar to the '-max_factor' option, but using the exponential coefficient basis of the SIFT2 model; these parameters are related as: factor = e^(coeff). Note that the -max_factor and -max_coeff options are mutually exclusive; you can only provide one. (default: inf)""", + ) + max_coeff_step: float | None = shell.arg( + default=None, + argstr="-max_coeff_step", + help="""maximum change to a streamline's weighting coefficient in a single iteration (default: 1)""", + ) + min_cf_decrease: float | None = shell.arg( + default=None, + argstr="-min_cf_decrease", + help="""minimum decrease in the cost function (as a fraction of the initial value) that must occur each iteration for the algorithm to continue (default: 2.5e-05)""", + ) + linear: bool = shell.arg( + default=False, + argstr="-linear", + help="""perform a linear estimation of streamline weights, rather than the standard non-linear optimisation (typically does not provide as accurate a model fit; but only requires a single pass)""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_weights: File = shell.outarg( + argstr="", + position=3, + path_template="out_weights.txt", + help="""output text file containing the weighting factor for each streamline""", + ) + csv: File | bool | None = shell.outarg( + default=None, + argstr="-csv", + path_template="csv.txt", + help="""output statistics of execution per iteration to a .csv file""", + ) + out_mu: File | bool | None = shell.outarg( + default=None, + argstr="-out_mu", + path_template="out_mu.txt", + help="""output the final value of SIFT proportionality coefficient mu to a text file""", + ) + output_debug: Directory | bool | None = shell.outarg( + default=None, + argstr="-output_debug", + path_template="output_debug", + help="""write to a directory various output images for assessing & debugging performance etc.""", + ) + out_coeffs: File | bool | None = shell.outarg( + default=None, + argstr="-out_coeffs", + path_template="out_coeffs.txt", + help="""output text file containing the weighting coefficient for each streamline""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/tckstats.py b/pydra/tasks/mrtrix3/v3_1/tckstats.py new file mode 100644 index 0000000..bcf7551 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tckstats.py @@ -0,0 +1,115 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class TckStats(shell.Task["TckStats.Outputs"]): + """ + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "tckstats" + + # Arguments + tracks_in: Tracks = shell.arg( + argstr="", + position=1, + help="""the input track file""", + ) + + # Options + output: MultiInputObj[str] | None = shell.arg( + default=None, + argstr="-output", + help="""output only the field specified. Multiple such options can be supplied if required. Choices are: mean, median, std, min, max, count. Useful for use in scripts.""", + allowed_values=["mean", "median", "std", "min", "max", "count"], + ) + ignorezero: bool = shell.arg( + default=False, + argstr="-ignorezero", + help="""do not generate a warning if the track file contains streamlines with zero length""", + ) + tck_weights_in: File | None = shell.arg( + default=None, + argstr="-tck_weights_in", + help="""specify a text scalar file containing the streamline weights""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + histogram: File | bool | None = shell.outarg( + default=None, + argstr="-histogram", + path_template="histogram.txt", + help="""output a histogram of streamline lengths""", + ) + dump: File | bool | None = shell.outarg( + default=None, + argstr="-dump", + path_template="dump.txt", + help="""dump the streamlines lengths to a text file""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/tcktransform.py b/pydra/tasks/mrtrix3/v3_1/tcktransform.py new file mode 100644 index 0000000..fc869a3 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tcktransform.py @@ -0,0 +1,98 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class TckTransform(shell.Task["TckTransform.Outputs"]): + """ + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: J-Donald Tournier (jdtournier@gmail.com) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "tcktransform" + + # Arguments + tracks: Tracks = shell.arg( + argstr="", + position=1, + help="""the input track file.""", + ) + transform: ImageIn = shell.arg( + argstr="", + position=2, + help="""the image containing the transform.""", + ) + output: Tracks = shell.arg( + argstr="", + position=3, + help="""the output track file""", + ) + + # Options + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + pass diff --git a/pydra/tasks/mrtrix3/v3_1/tensor2metric.py b/pydra/tasks/mrtrix3/v3_1/tensor2metric.py new file mode 100644 index 0000000..a291765 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tensor2metric.py @@ -0,0 +1,200 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Tensor2Metric(shell.Task["Tensor2Metric.Outputs"]): + """ + References + ---------- + + Basser, P. J.; Mattiello, J. & Lebihan, D. MR diffusion tensor spectroscopy and imaging. Biophysical Journal, 1994, 66, 259-267 + + * If using -cl, -cp or -cs options: + Westin, C. F.; Peled, S.; Gudbjartsson, H.; Kikinis, R. & Jolesz, F. A. Geometrical diffusion measures for MRI from tensor basis analysis. Proc Intl Soc Mag Reson Med, 1997, 5, 1742 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Ben Jeurissen (ben.jeurissen@uantwerpen.be) and Thijs Dhollander (thijs.dhollander@gmail.com) and J-Donald Tournier (jdtournier@gmail.com) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "tensor2metric" + + # Arguments + tensor: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input tensor image.""", + ) + + # Options + mask: ImageIn | None = shell.arg( + default=None, + argstr="-mask", + help="""only perform computation within the specified binary brain mask image.""", + ) + + # Diffusion Tensor Imaging: + num: list[int] | None = shell.arg( + default=None, + argstr="-num", + help="""specify the desired eigenvalue/eigenvector(s). Note that several eigenvalues can be specified as a number sequence. For example, '1,3' specifies the principal (1) and minor (3) eigenvalues/eigenvectors (default = 1).""", + sep=",", + ) + modulate: str | None = shell.arg( + default=None, + argstr="-modulate", + help="""specify how to modulate the magnitude of the eigenvectors. Valid choices are: none, FA, eigval (default = FA).""", + allowed_values=["none", "fa", "eigval"], + ) + + # Diffusion Kurtosis Imaging: + dkt: ImageIn | None = shell.arg( + default=None, + argstr="-dkt", + help="""input diffusion kurtosis tensor.""", + ) + mk_dirs: File | None = shell.arg( + default=None, + argstr="-mk_dirs", + help="""specify the directions used to numerically calculate mean kurtosis (by default, the built-in 300 direction set is used). These should be supplied as a text file containing [ az el ] pairs for the directions.""", + ) + rk_ndirs: int | None = shell.arg( + default=None, + argstr="-rk_ndirs", + help="""specify the number of directions used to numerically calculate radial kurtosis (by default, 300 directions are used).""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + adc: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-adc", + path_template="adc.mif", + help="""compute the mean apparent diffusion coefficient (ADC) of the diffusion tensor. (sometimes also referred to as the mean diffusivity (MD))""", + ) + fa: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-fa", + path_template="fa.mif", + help="""compute the fractional anisotropy (FA) of the diffusion tensor.""", + ) + ad: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-ad", + path_template="ad.mif", + help="""compute the axial diffusivity (AD) of the diffusion tensor. (equivalent to the principal eigenvalue)""", + ) + rd: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-rd", + path_template="rd.mif", + help="""compute the radial diffusivity (RD) of the diffusion tensor. (equivalent to the mean of the two non-principal eigenvalues)""", + ) + value: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-value", + path_template="value.mif", + help="""compute the selected eigenvalue(s) of the diffusion tensor.""", + ) + vector: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-vector", + path_template="vector.mif", + help="""compute the selected eigenvector(s) of the diffusion tensor.""", + ) + cl: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-cl", + path_template="cl.mif", + help="""compute the linearity metric of the diffusion tensor. (one of the three Westin shape metrics)""", + ) + cp: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-cp", + path_template="cp.mif", + help="""compute the planarity metric of the diffusion tensor. (one of the three Westin shape metrics)""", + ) + cs: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-cs", + path_template="cs.mif", + help="""compute the sphericity metric of the diffusion tensor. (one of the three Westin shape metrics)""", + ) + mk: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-mk", + path_template="mk.mif", + help="""compute the mean kurtosis (MK) of the kurtosis tensor.""", + ) + ak: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-ak", + path_template="ak.mif", + help="""compute the axial kurtosis (AK) of the kurtosis tensor.""", + ) + rk: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-rk", + path_template="rk.mif", + help="""compute the radial kurtosis (RK) of the kurtosis tensor.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_afdconnectivity.py b/pydra/tasks/mrtrix3/v3_1/tests/test_afdconnectivity.py new file mode 100644 index 0000000..f86d25d --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_afdconnectivity.py @@ -0,0 +1,23 @@ +# Auto-generated test for afdconnectivity + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import AfdConnectivity + + +@pytest.mark.xfail +def test_afdconnectivity(tmp_path, cli_parse_only): + + task = AfdConnectivity( + all_fixels=False, + debug=False, + force=False, + image_=Nifti1.sample(), + tracks=Tracks.sample(), + wbft=None, + afd_map=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_amp2response.py b/pydra/tasks/mrtrix3/v3_1/tests/test_amp2response.py new file mode 100644 index 0000000..8434230 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_amp2response.py @@ -0,0 +1,27 @@ +# Auto-generated test for amp2response + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Amp2Response + + +@pytest.mark.xfail +def test_amp2response(tmp_path, cli_parse_only): + + task = Amp2Response( + amps=Nifti1.sample(), + debug=False, + directions=None, + directions_image=Nifti1.sample(), + force=False, + isotropic=False, + lmax=None, + mask=Nifti1.sample(), + noconstraint=False, + shells=None, + response=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_amp2sh.py b/pydra/tasks/mrtrix3/v3_1/tests/test_amp2sh.py new file mode 100644 index 0000000..89c1425 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_amp2sh.py @@ -0,0 +1,28 @@ +# Auto-generated test for amp2sh + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Amp2Sh + + +@pytest.mark.xfail +def test_amp2sh(tmp_path, cli_parse_only): + + task = Amp2Sh( + amp=Nifti1.sample(), + debug=False, + directions=None, + force=False, + fslgrad=None, + grad=None, + lmax=None, + normalise=False, + rician=None, + shells=None, + strides=None, + SH=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_connectome2tck.py b/pydra/tasks/mrtrix3/v3_1/tests/test_connectome2tck.py new file mode 100644 index 0000000..f5f935e --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_connectome2tck.py @@ -0,0 +1,29 @@ +# Auto-generated test for connectome2tck + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Connectome2Tck + + +@pytest.mark.xfail +def test_connectome2tck(tmp_path, cli_parse_only): + + task = Connectome2Tck( + assignments_in=File.sample(), + debug=False, + exclusive=False, + exemplars=None, + files=None, + force=False, + keep_self=False, + keep_unassigned=False, + nodes=None, + prefix_out="a-string", + prefix_tck_weights_out=None, + tck_weights_in=None, + tracks_in=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_connectomeedit.py b/pydra/tasks/mrtrix3/v3_1/tests/test_connectomeedit.py new file mode 100644 index 0000000..da7f6c3 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_connectomeedit.py @@ -0,0 +1,21 @@ +# Auto-generated test for connectomeedit + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import ConnectomeEdit + + +@pytest.mark.xfail +def test_connectomeedit(tmp_path, cli_parse_only): + + task = ConnectomeEdit( + debug=False, + force=False, + input="a-string", + operation="to_symmetric", + output="a-string", + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_connectomestats.py b/pydra/tasks/mrtrix3/v3_1/tests/test_connectomestats.py new file mode 100644 index 0000000..a267f64 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_connectomestats.py @@ -0,0 +1,42 @@ +# Auto-generated test for connectomestats + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import ConnectomeStats + + +@pytest.mark.xfail +def test_connectomestats(tmp_path, cli_parse_only): + + task = ConnectomeStats( + algorithm="nbs", + column=None, + contrast=File.sample(), + debug=False, + design=File.sample(), + errors=None, + exchange_whole=None, + exchange_within=None, + fonly=False, + force=False, + ftests=None, + in_file=File.sample(), + nonstationarity=False, + notest=False, + nshuffles=None, + nshuffles_nonstationarity=None, + output="a-string", + permutations=None, + permutations_nonstationarity=None, + skew_nonstationarity=None, + strong=False, + tfce_dh=None, + tfce_e=None, + tfce_h=None, + threshold=None, + variance=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dcmedit.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dcmedit.py new file mode 100644 index 0000000..2dd4ccc --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dcmedit.py @@ -0,0 +1,22 @@ +# Auto-generated test for dcmedit + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import DcmEdit + + +@pytest.mark.xfail +def test_dcmedit(tmp_path, cli_parse_only): + + task = DcmEdit( + anonymise=False, + debug=False, + file=File.sample(), + force=False, + id=None, + tag=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dcminfo.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dcminfo.py new file mode 100644 index 0000000..81fe9d6 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dcminfo.py @@ -0,0 +1,23 @@ +# Auto-generated test for dcminfo + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import DcmInfo + + +@pytest.mark.xfail +def test_dcminfo(tmp_path, cli_parse_only): + + task = DcmInfo( + all=False, + csa=False, + debug=False, + file=File.sample(), + force=False, + phoenix=False, + tag=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dirflip.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dirflip.py new file mode 100644 index 0000000..f4f61ca --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dirflip.py @@ -0,0 +1,22 @@ +# Auto-generated test for dirflip + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import DirFlip + + +@pytest.mark.xfail +def test_dirflip(tmp_path, cli_parse_only): + + task = DirFlip( + cartesian=False, + debug=False, + force=False, + in_=File.sample(), + number=None, + out=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dirgen.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dirgen.py new file mode 100644 index 0000000..b8a6a0a --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dirgen.py @@ -0,0 +1,25 @@ +# Auto-generated test for dirgen + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import DirGen + + +@pytest.mark.xfail +def test_dirgen(tmp_path, cli_parse_only): + + task = DirGen( + cartesian=False, + debug=False, + force=False, + ndir=1, + niter=None, + power=None, + restarts=None, + unipolar=False, + dirs=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dirmerge.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dirmerge.py new file mode 100644 index 0000000..8d5f3d2 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dirmerge.py @@ -0,0 +1,23 @@ +# Auto-generated test for dirmerge + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import DirMerge + + +@pytest.mark.xfail +def test_dirmerge(tmp_path, cli_parse_only): + + task = DirMerge( + bvalue_files=["a-string"], + debug=False, + firstisfirst=False, + force=False, + subsets=1, + unipolar_weight=None, + out=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dirorder.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dirorder.py new file mode 100644 index 0000000..08fc2ee --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dirorder.py @@ -0,0 +1,21 @@ +# Auto-generated test for dirorder + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import DirOrder + + +@pytest.mark.xfail +def test_dirorder(tmp_path, cli_parse_only): + + task = DirOrder( + cartesian=False, + debug=False, + force=False, + in_file=File.sample(), + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dirrotate.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dirrotate.py new file mode 100644 index 0000000..77be927 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dirrotate.py @@ -0,0 +1,22 @@ +# Auto-generated test for dirrotate + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import DirRotate + + +@pytest.mark.xfail +def test_dirrotate(tmp_path, cli_parse_only): + + task = DirRotate( + cartesian=False, + debug=False, + force=False, + in_=File.sample(), + number=None, + out=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dirsplit.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dirsplit.py new file mode 100644 index 0000000..e7750fd --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dirsplit.py @@ -0,0 +1,23 @@ +# Auto-generated test for dirsplit + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import DirSplit + + +@pytest.mark.xfail(reason="Job dirsplit is known not pass yet") +@pytest.mark.xfail +def test_dirsplit(tmp_path, cli_parse_only): + + task = DirSplit( + cartesian=False, + debug=False, + dirs=File.sample(), + force=False, + number=None, + out=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dirstat.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dirstat.py new file mode 100644 index 0000000..6b25ca7 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dirstat.py @@ -0,0 +1,23 @@ +# Auto-generated test for dirstat + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import DirStat + + +@pytest.mark.xfail +def test_dirstat(tmp_path, cli_parse_only): + + task = DirStat( + debug=False, + dirs=File.sample(), + force=False, + fslgrad=None, + grad=None, + output=None, + shells=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2adc.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2adc.py new file mode 100644 index 0000000..eae84de --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2adc.py @@ -0,0 +1,24 @@ +# Auto-generated test for dwi2adc + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Dwi2Adc + + +@pytest.mark.xfail +def test_dwi2adc(tmp_path, cli_parse_only): + + task = Dwi2Adc( + cutoff=None, + debug=False, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + ivim=False, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2fod.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2fod.py new file mode 100644 index 0000000..3d0e735 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2fod.py @@ -0,0 +1,34 @@ +# Auto-generated test for dwi2fod + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Dwi2Fod + + +@pytest.mark.xfail +def test_dwi2fod(tmp_path, cli_parse_only): + + task = Dwi2Fod( + algorithm="csd", + debug=False, + directions=None, + dwi=Nifti1.sample(), + filter=None, + force=False, + fslgrad=None, + grad=None, + lmax=None, + mask=None, + neg_lambda=None, + niter=None, + norm_lambda=None, + response_odf=[File.sample()], + shells=None, + strides=None, + threshold=None, + predicted_signal=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_3dautomask.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_3dautomask.py new file mode 100644 index 0000000..76767d6 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_3dautomask.py @@ -0,0 +1,37 @@ +# Auto-generated test for dwi2mask_3dautomask + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Dwi2Mask_3dautomask + + +@pytest.mark.xfail(reason="Job dwi2mask_3dautomask is known not pass yet") +@pytest.mark.xfail +def test_dwi2mask_3dautomask(tmp_path, cli_parse_only): + + task = Dwi2Mask_3dautomask( + NN1=False, + NN2=False, + NN3=False, + SI=None, + clfrac=None, + cont=None, + debug=False, + dilate=None, + eclip=False, + erode=None, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + nbhrs=None, + nocleanup=False, + nograd=False, + peels=None, + scratch=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_ants.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_ants.py new file mode 100644 index 0000000..6d40d73 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_ants.py @@ -0,0 +1,27 @@ +# Auto-generated test for dwi2mask_ants + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Dwi2Mask_Ants + + +@pytest.mark.xfail(reason="Job dwi2mask_ants is known not pass yet") +@pytest.mark.xfail +def test_dwi2mask_ants(tmp_path, cli_parse_only): + + task = Dwi2Mask_Ants( + cont=None, + debug=False, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + nocleanup=False, + scratch=None, + template=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_b02template.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_b02template.py new file mode 100644 index 0000000..379f824 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_b02template.py @@ -0,0 +1,31 @@ +# Auto-generated test for dwi2mask_b02template + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Dwi2Mask_B02template + + +@pytest.mark.xfail(reason="Job dwi2mask_b02template is known not pass yet") +@pytest.mark.xfail +def test_dwi2mask_b02template(tmp_path, cli_parse_only): + + task = Dwi2Mask_B02template( + ants_options=None, + cont=None, + debug=False, + flirt_options=None, + fnirt_config=None, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + nocleanup=False, + scratch=None, + software=None, + template=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_consensus.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_consensus.py new file mode 100644 index 0000000..b3e8e9d --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_consensus.py @@ -0,0 +1,30 @@ +# Auto-generated test for dwi2mask_consensus + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Dwi2Mask_Consensus + + +@pytest.mark.xfail(reason="Job dwi2mask_consensus is known not pass yet") +@pytest.mark.xfail +def test_dwi2mask_consensus(tmp_path, cli_parse_only): + + task = Dwi2Mask_Consensus( + algorithms=None, + cont=None, + debug=False, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + nocleanup=False, + scratch=None, + template=None, + threshold=None, + masks=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_fslbet.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_fslbet.py new file mode 100644 index 0000000..69cc06f --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_fslbet.py @@ -0,0 +1,31 @@ +# Auto-generated test for dwi2mask_fslbet + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Dwi2Mask_Fslbet + + +@pytest.mark.xfail(reason="Job dwi2mask_fslbet is known not pass yet") +@pytest.mark.xfail +def test_dwi2mask_fslbet(tmp_path, cli_parse_only): + + task = Dwi2Mask_Fslbet( + bet_c=None, + bet_f=None, + bet_g=None, + bet_r=None, + cont=None, + debug=False, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + nocleanup=False, + rescale=False, + scratch=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_hdbet.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_hdbet.py new file mode 100644 index 0000000..e69715c --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_hdbet.py @@ -0,0 +1,27 @@ +# Auto-generated test for dwi2mask_hdbet + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Dwi2Mask_Hdbet + + +@pytest.mark.xfail(reason="Job dwi2mask_hdbet is known not pass yet") +@pytest.mark.xfail +def test_dwi2mask_hdbet(tmp_path, cli_parse_only): + + task = Dwi2Mask_Hdbet( + cont=None, + debug=False, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + nocleanup=False, + nogpu=False, + scratch=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_legacy.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_legacy.py new file mode 100644 index 0000000..16fded8 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_legacy.py @@ -0,0 +1,27 @@ +# Auto-generated test for dwi2mask_legacy + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Dwi2Mask_Legacy + + +@pytest.mark.xfail(reason="Job dwi2mask_legacy is known not pass yet") +@pytest.mark.xfail +def test_dwi2mask_legacy(tmp_path, cli_parse_only): + + task = Dwi2Mask_Legacy( + clean_scale=None, + cont=None, + debug=False, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + nocleanup=False, + scratch=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_mean.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_mean.py new file mode 100644 index 0000000..68ebaaf --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_mean.py @@ -0,0 +1,28 @@ +# Auto-generated test for dwi2mask_mean + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Dwi2Mask_Mean + + +@pytest.mark.xfail(reason="Job dwi2mask_mean is known not pass yet") +@pytest.mark.xfail +def test_dwi2mask_mean(tmp_path, cli_parse_only): + + task = Dwi2Mask_Mean( + clean_scale=None, + cont=None, + debug=False, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + nocleanup=False, + scratch=None, + shells=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_mtnorm.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_mtnorm.py new file mode 100644 index 0000000..d8004b7 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_mtnorm.py @@ -0,0 +1,30 @@ +# Auto-generated test for dwi2mask_mtnorm + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Dwi2Mask_Mtnorm + + +@pytest.mark.xfail(reason="Job dwi2mask_mtnorm is known not pass yet") +@pytest.mark.xfail +def test_dwi2mask_mtnorm(tmp_path, cli_parse_only): + + task = Dwi2Mask_Mtnorm( + cont=None, + debug=False, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + init_mask=None, + lmax=None, + nocleanup=False, + scratch=None, + threshold=None, + out_file=File.sample(), + tissuesum=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_synthstrip.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_synthstrip.py new file mode 100644 index 0000000..0772c91 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_synthstrip.py @@ -0,0 +1,31 @@ +# Auto-generated test for dwi2mask_synthstrip + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Dwi2Mask_Synthstrip + + +@pytest.mark.xfail(reason="Job dwi2mask_synthstrip is known not pass yet") +@pytest.mark.xfail +def test_dwi2mask_synthstrip(tmp_path, cli_parse_only): + + task = Dwi2Mask_Synthstrip( + border=None, + cont=None, + debug=False, + force=False, + fslgrad=None, + gpu=False, + grad=None, + in_file=Nifti1.sample(), + model=None, + nocleanup=False, + nocsf=False, + scratch=None, + out_file=File.sample(), + stripped=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_trace.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_trace.py new file mode 100644 index 0000000..044ede7 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2mask_trace.py @@ -0,0 +1,30 @@ +# Auto-generated test for dwi2mask_trace + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Dwi2Mask_Trace + + +@pytest.mark.xfail(reason="Job dwi2mask_trace is known not pass yet") +@pytest.mark.xfail +def test_dwi2mask_trace(tmp_path, cli_parse_only): + + task = Dwi2Mask_Trace( + clean_scale=None, + cont=None, + debug=False, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + iterative=False, + max_iters=None, + nocleanup=False, + scratch=None, + shells=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2response_dhollander.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2response_dhollander.py new file mode 100644 index 0000000..b60a458 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2response_dhollander.py @@ -0,0 +1,38 @@ +# Auto-generated test for dwi2response_dhollander + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Dwi2Response_Dhollander + + +@pytest.mark.xfail(reason="Job dwi2response_dhollander is known not pass yet") +@pytest.mark.xfail +def test_dwi2response_dhollander(tmp_path, cli_parse_only): + + task = Dwi2Response_Dhollander( + cont=None, + csf=None, + debug=False, + erode=None, + fa=None, + force=False, + fslgrad=None, + gm=None, + grad=None, + in_file=Nifti1.sample(), + lmax=None, + mask=None, + nocleanup=False, + scratch=None, + sfwm=None, + shells=None, + wm_algo=None, + out_csf=File.sample(), + out_gm=File.sample(), + out_sfwm=File.sample(), + voxels=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2response_fa.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2response_fa.py new file mode 100644 index 0000000..e5fa186 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2response_fa.py @@ -0,0 +1,33 @@ +# Auto-generated test for dwi2response_fa + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Dwi2Response_Fa + + +@pytest.mark.xfail(reason="Job dwi2response_fa is known not pass yet") +@pytest.mark.xfail +def test_dwi2response_fa(tmp_path, cli_parse_only): + + task = Dwi2Response_Fa( + cont=None, + debug=False, + erode=None, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + lmax=None, + mask=None, + nocleanup=False, + number=None, + scratch=None, + shells=None, + threshold=None, + out_file=File.sample(), + voxels=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2response_manual.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2response_manual.py new file mode 100644 index 0000000..5f7e256 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2response_manual.py @@ -0,0 +1,32 @@ +# Auto-generated test for dwi2response_manual + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Dwi2Response_Manual + + +@pytest.mark.xfail(reason="Job dwi2response_manual is known not pass yet") +@pytest.mark.xfail +def test_dwi2response_manual(tmp_path, cli_parse_only): + + task = Dwi2Response_Manual( + cont=None, + debug=False, + dirs=None, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + in_voxels=Nifti1.sample(), + lmax=None, + mask=None, + nocleanup=False, + scratch=None, + shells=None, + out_file=File.sample(), + voxels=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2response_msmt_5tt.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2response_msmt_5tt.py new file mode 100644 index 0000000..b0f6a78 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2response_msmt_5tt.py @@ -0,0 +1,38 @@ +# Auto-generated test for dwi2response_msmt_5tt + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Dwi2Response_Msmt_5tt + + +@pytest.mark.xfail(reason="Job dwi2response_msmt_5tt is known not pass yet") +@pytest.mark.xfail +def test_dwi2response_msmt_5tt(tmp_path, cli_parse_only): + + task = Dwi2Response_Msmt_5tt( + cont=None, + debug=False, + dirs=None, + fa=None, + force=False, + fslgrad=None, + grad=None, + in_5tt=Nifti1.sample(), + in_file=Nifti1.sample(), + lmax=None, + mask=None, + nocleanup=False, + pvf=None, + scratch=None, + sfwm_fa_threshold=None, + shells=None, + wm_algo=None, + out_csf=File.sample(), + out_gm=File.sample(), + out_wm=File.sample(), + voxels=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2response_tax.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2response_tax.py new file mode 100644 index 0000000..0394ce4 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2response_tax.py @@ -0,0 +1,33 @@ +# Auto-generated test for dwi2response_tax + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Dwi2Response_Tax + + +@pytest.mark.xfail(reason="Job dwi2response_tax is known not pass yet") +@pytest.mark.xfail +def test_dwi2response_tax(tmp_path, cli_parse_only): + + task = Dwi2Response_Tax( + cont=None, + convergence=None, + debug=False, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + lmax=None, + mask=None, + max_iters=None, + nocleanup=False, + peak_ratio=None, + scratch=None, + shells=None, + out_file=File.sample(), + voxels=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2response_tournier.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2response_tournier.py new file mode 100644 index 0000000..44d13ab --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2response_tournier.py @@ -0,0 +1,34 @@ +# Auto-generated test for dwi2response_tournier + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Dwi2Response_Tournier + + +@pytest.mark.xfail(reason="Job dwi2response_tournier is known not pass yet") +@pytest.mark.xfail +def test_dwi2response_tournier(tmp_path, cli_parse_only): + + task = Dwi2Response_Tournier( + cont=None, + debug=False, + dilate=None, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + iter_voxels=None, + lmax=None, + mask=None, + max_iters=None, + nocleanup=False, + number=None, + scratch=None, + shells=None, + out_file=File.sample(), + voxels=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2tensor.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2tensor.py new file mode 100644 index 0000000..9ab7e85 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwi2tensor.py @@ -0,0 +1,30 @@ +# Auto-generated test for dwi2tensor + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Dwi2Tensor + + +@pytest.mark.xfail +def test_dwi2tensor(tmp_path, cli_parse_only): + + task = Dwi2Tensor( + constrain=False, + debug=False, + directions=None, + dwi=Nifti1.sample(), + force=False, + fslgrad=None, + grad=None, + iter=None, + mask=None, + ols=False, + b0=None, + dkt=None, + dt=File.sample(), + predicted_signal=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwibiascorrect_ants.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwibiascorrect_ants.py new file mode 100644 index 0000000..59b8142 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwibiascorrect_ants.py @@ -0,0 +1,31 @@ +# Auto-generated test for dwibiascorrect_ants + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import DwiBiascorrect_Ants + + +@pytest.mark.xfail(reason="Job dwibiascorrect_ants is known not pass yet") +@pytest.mark.xfail +def test_dwibiascorrect_ants(tmp_path, cli_parse_only): + + task = DwiBiascorrect_Ants( + ants_b=None, + ants_c=None, + ants_s=None, + cont=None, + debug=False, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + mask=None, + nocleanup=False, + scratch=None, + bias=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwibiascorrect_fsl.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwibiascorrect_fsl.py new file mode 100644 index 0000000..07c6c1a --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwibiascorrect_fsl.py @@ -0,0 +1,28 @@ +# Auto-generated test for dwibiascorrect_fsl + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import DwiBiascorrect_Fsl + + +@pytest.mark.xfail(reason="Job dwibiascorrect_fsl is known not pass yet") +@pytest.mark.xfail +def test_dwibiascorrect_fsl(tmp_path, cli_parse_only): + + task = DwiBiascorrect_Fsl( + cont=None, + debug=False, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + mask=None, + nocleanup=False, + scratch=None, + bias=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwibiascorrect_mtnorm.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwibiascorrect_mtnorm.py new file mode 100644 index 0000000..cb31ab5 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwibiascorrect_mtnorm.py @@ -0,0 +1,29 @@ +# Auto-generated test for dwibiascorrect_mtnorm + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import DwiBiascorrect_Mtnorm + + +@pytest.mark.xfail(reason="Job dwibiascorrect_mtnorm is known not pass yet") +@pytest.mark.xfail +def test_dwibiascorrect_mtnorm(tmp_path, cli_parse_only): + + task = DwiBiascorrect_Mtnorm( + cont=None, + debug=False, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + lmax=None, + mask=None, + nocleanup=False, + scratch=None, + bias=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwibiasnormmask.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwibiasnormmask.py new file mode 100644 index 0000000..65fc913 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwibiasnormmask.py @@ -0,0 +1,36 @@ +# Auto-generated test for dwibiasnormmask + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import DwiBiasnormmask + + +@pytest.mark.xfail(reason="Job dwibiasnormmask is known not pass yet") +@pytest.mark.xfail +def test_dwibiasnormmask(tmp_path, cli_parse_only): + + task = DwiBiasnormmask( + cont=None, + debug=False, + dice=None, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + init_mask=None, + lmax=None, + mask_algo=None, + max_iters=None, + nocleanup=False, + reference=None, + scratch=None, + output_bias=None, + output_dwi=File.sample(), + output_mask=File.sample(), + output_scale=None, + output_tissuesum=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwicat.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwicat.py new file mode 100644 index 0000000..81336ed --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwicat.py @@ -0,0 +1,26 @@ +# Auto-generated test for dwicat + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import DwiCat + + +@pytest.mark.xfail(reason="Job dwicat is known not pass yet") +@pytest.mark.xfail +def test_dwicat(tmp_path, cli_parse_only): + + task = DwiCat( + cont=None, + debug=False, + force=False, + inputs=Nifti1.sample(), + mask=None, + nocleanup=False, + nointensity=False, + scratch=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwidenoise.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwidenoise.py new file mode 100644 index 0000000..4617678 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwidenoise.py @@ -0,0 +1,26 @@ +# Auto-generated test for dwidenoise + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import DwiDenoise + + +@pytest.mark.xfail +def test_dwidenoise(tmp_path, cli_parse_only): + + task = DwiDenoise( + datatype=None, + debug=False, + dwi=Nifti1.sample(), + estimator=None, + extent=None, + force=False, + mask=None, + noise=None, + out=File.sample(), + rank=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwiextract.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwiextract.py new file mode 100644 index 0000000..7fc8743 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwiextract.py @@ -0,0 +1,32 @@ +# Auto-generated test for dwiextract + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import DwiExtract + + +@pytest.mark.xfail +def test_dwiextract(tmp_path, cli_parse_only): + + task = DwiExtract( + bzero=False, + debug=False, + force=False, + fslgrad=None, + grad=None, + import_pe_eddy=None, + import_pe_table=None, + in_file=Nifti1.sample(), + no_bzero=False, + pe=None, + shells=None, + singleshell=False, + strides=None, + export_grad_fsl=None, + export_grad_mrtrix=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwifslpreproc.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwifslpreproc.py new file mode 100644 index 0000000..dbfa555 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwifslpreproc.py @@ -0,0 +1,44 @@ +# Auto-generated test for dwifslpreproc + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import DwiFslpreproc + + +@pytest.mark.xfail(reason="Job dwifslpreproc is known not pass yet") +@pytest.mark.xfail +def test_dwifslpreproc(tmp_path, cli_parse_only): + + task = DwiFslpreproc( + align_seepi=False, + cont=None, + debug=False, + eddy_mask=None, + eddy_options=None, + eddy_slspec=None, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + json_import=None, + nocleanup=False, + pe_dir=None, + readout_time=None, + rpe_all=False, + rpe_header=False, + rpe_none=False, + rpe_pair=False, + scratch=None, + se_epi=None, + topup_files=None, + topup_options=None, + eddyqc_all=None, + eddyqc_text=None, + export_grad_fsl=None, + export_grad_mrtrix=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwigradcheck.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwigradcheck.py new file mode 100644 index 0000000..9b0421f --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwigradcheck.py @@ -0,0 +1,29 @@ +# Auto-generated test for dwigradcheck + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import DwiGradcheck + + +@pytest.mark.xfail(reason="Job dwigradcheck is known not pass yet") +@pytest.mark.xfail +def test_dwigradcheck(tmp_path, cli_parse_only): + + task = DwiGradcheck( + cont=None, + debug=False, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + mask=None, + nocleanup=False, + number=None, + scratch=None, + export_grad_fsl=None, + export_grad_mrtrix=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwinormalise_group.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwinormalise_group.py new file mode 100644 index 0000000..a80048b --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwinormalise_group.py @@ -0,0 +1,28 @@ +# Auto-generated test for dwinormalise_group + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import DwiNormalise_Group + + +@pytest.mark.xfail(reason="Job dwinormalise_group is known not pass yet") +@pytest.mark.xfail +def test_dwinormalise_group(tmp_path, cli_parse_only): + + task = DwiNormalise_Group( + cont=None, + debug=False, + fa_threshold=None, + force=False, + input_dir=File.sample(), + mask_dir=File.sample(), + nocleanup=False, + scratch=None, + fa_template=File.sample(), + output_dir=File.sample(), + wm_mask=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwinormalise_manual.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwinormalise_manual.py new file mode 100644 index 0000000..89648c5 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwinormalise_manual.py @@ -0,0 +1,29 @@ +# Auto-generated test for dwinormalise_manual + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import DwiNormalise_Manual + + +@pytest.mark.xfail(reason="Job dwinormalise_manual is known not pass yet") +@pytest.mark.xfail +def test_dwinormalise_manual(tmp_path, cli_parse_only): + + task = DwiNormalise_Manual( + cont=None, + debug=False, + force=False, + fslgrad=None, + grad=None, + input_dwi=Nifti1.sample(), + input_mask=Nifti1.sample(), + intensity=None, + nocleanup=False, + percentile=None, + scratch=None, + output_dwi=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwinormalise_mtnorm.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwinormalise_mtnorm.py new file mode 100644 index 0000000..82f7a71 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwinormalise_mtnorm.py @@ -0,0 +1,30 @@ +# Auto-generated test for dwinormalise_mtnorm + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import DwiNormalise_Mtnorm + + +@pytest.mark.xfail(reason="Job dwinormalise_mtnorm is known not pass yet") +@pytest.mark.xfail +def test_dwinormalise_mtnorm(tmp_path, cli_parse_only): + + task = DwiNormalise_Mtnorm( + cont=None, + debug=False, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + lmax=None, + mask=None, + nocleanup=False, + reference=None, + scratch=None, + out_file=File.sample(), + scale=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_dwishellmath.py b/pydra/tasks/mrtrix3/v3_1/tests/test_dwishellmath.py new file mode 100644 index 0000000..c1e7e3c --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_dwishellmath.py @@ -0,0 +1,27 @@ +# Auto-generated test for dwishellmath + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import DwiShellmath + + +@pytest.mark.xfail(reason="Job dwishellmath is known not pass yet") +@pytest.mark.xfail +def test_dwishellmath(tmp_path, cli_parse_only): + + task = DwiShellmath( + cont=None, + debug=False, + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + nocleanup=False, + operation="mean", + scratch=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_fivett2gmwmi.py b/pydra/tasks/mrtrix3/v3_1/tests/test_fivett2gmwmi.py new file mode 100644 index 0000000..452e2f8 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_fivett2gmwmi.py @@ -0,0 +1,21 @@ +# Auto-generated test for fivett2gmwmi + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Fivett2Gmwmi + + +@pytest.mark.xfail +def test_fivett2gmwmi(tmp_path, cli_parse_only): + + task = Fivett2Gmwmi( + debug=False, + force=False, + in_5tt=Nifti1.sample(), + mask_in=None, + mask_out=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_fivett2vis.py b/pydra/tasks/mrtrix3/v3_1/tests/test_fivett2vis.py new file mode 100644 index 0000000..501e348 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_fivett2vis.py @@ -0,0 +1,26 @@ +# Auto-generated test for fivett2vis + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Fivett2Vis + + +@pytest.mark.xfail +def test_fivett2vis(tmp_path, cli_parse_only): + + task = Fivett2Vis( + bg=None, + cgm=None, + csf=None, + debug=False, + force=False, + in_file=Nifti1.sample(), + path=None, + sgm=None, + wm=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_fivettcheck.py b/pydra/tasks/mrtrix3/v3_1/tests/test_fivettcheck.py new file mode 100644 index 0000000..6586892 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_fivettcheck.py @@ -0,0 +1,20 @@ +# Auto-generated test for fivettcheck + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import FivettCheck + + +@pytest.mark.xfail +def test_fivettcheck(tmp_path, cli_parse_only): + + task = FivettCheck( + debug=False, + force=False, + in_file=[Nifti1.sample()], + voxels=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_fivettedit.py b/pydra/tasks/mrtrix3/v3_1/tests/test_fivettedit.py new file mode 100644 index 0000000..627acdf --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_fivettedit.py @@ -0,0 +1,26 @@ +# Auto-generated test for fivettedit + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import FivettEdit + + +@pytest.mark.xfail +def test_fivettedit(tmp_path, cli_parse_only): + + task = FivettEdit( + cgm=None, + csf=None, + debug=False, + force=False, + in_file=Nifti1.sample(), + none=None, + path=None, + sgm=None, + wm=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_fivettgen_deep_atropos.py b/pydra/tasks/mrtrix3/v3_1/tests/test_fivettgen_deep_atropos.py new file mode 100644 index 0000000..a37a8dc --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_fivettgen_deep_atropos.py @@ -0,0 +1,26 @@ +# Auto-generated test for fivettgen_deep_atropos + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import FivettGen_Deep_atropos + + +@pytest.mark.xfail +def test_fivettgen_deep_atropos(tmp_path, cli_parse_only): + + task = FivettGen_Deep_atropos( + cont=None, + debug=False, + force=False, + in_file=Nifti1.sample(), + nocleanup=False, + nocrop=False, + scratch=None, + sgm_amyg_hipp=False, + white_stem=False, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_fivettgen_freesurfer.py b/pydra/tasks/mrtrix3/v3_1/tests/test_fivettgen_freesurfer.py new file mode 100644 index 0000000..18d7e66 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_fivettgen_freesurfer.py @@ -0,0 +1,27 @@ +# Auto-generated test for fivettgen_freesurfer + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import FivettGen_Freesurfer + + +@pytest.mark.xfail(reason="Job fivettgen_freesurfer is known not pass yet") +@pytest.mark.xfail +def test_fivettgen_freesurfer(tmp_path, cli_parse_only): + + task = FivettGen_Freesurfer( + cont=None, + debug=False, + force=False, + in_file=Nifti1.sample(), + lut=None, + nocleanup=False, + nocrop=False, + scratch=None, + sgm_amyg_hipp=False, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_fivettgen_fsl.py b/pydra/tasks/mrtrix3/v3_1/tests/test_fivettgen_fsl.py new file mode 100644 index 0000000..5593ca3 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_fivettgen_fsl.py @@ -0,0 +1,29 @@ +# Auto-generated test for fivettgen_fsl + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import FivettGen_Fsl + + +@pytest.mark.xfail(reason="Job fivettgen_fsl is known not pass yet") +@pytest.mark.xfail +def test_fivettgen_fsl(tmp_path, cli_parse_only): + + task = FivettGen_Fsl( + cont=None, + debug=False, + force=False, + in_file=Nifti1.sample(), + mask=None, + nocleanup=False, + nocrop=False, + premasked=False, + scratch=None, + sgm_amyg_hipp=False, + t2=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_fivettgen_gif.py b/pydra/tasks/mrtrix3/v3_1/tests/test_fivettgen_gif.py new file mode 100644 index 0000000..937a4a4 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_fivettgen_gif.py @@ -0,0 +1,26 @@ +# Auto-generated test for fivettgen_gif + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import FivettGen_Gif + + +@pytest.mark.xfail(reason="Job fivettgen_gif is known not pass yet") +@pytest.mark.xfail +def test_fivettgen_gif(tmp_path, cli_parse_only): + + task = FivettGen_Gif( + cont=None, + debug=False, + force=False, + in_file=Nifti1.sample(), + nocleanup=False, + nocrop=False, + scratch=None, + sgm_amyg_hipp=False, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_fivettgen_hsvs.py b/pydra/tasks/mrtrix3/v3_1/tests/test_fivettgen_hsvs.py new file mode 100644 index 0000000..794e3ca --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_fivettgen_hsvs.py @@ -0,0 +1,31 @@ +# Auto-generated test for fivettgen_hsvs + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import FivettGen_Hsvs + + +@pytest.mark.xfail(reason="Job fivettgen_hsvs is known not pass yet") +@pytest.mark.xfail +def test_fivettgen_hsvs(tmp_path, cli_parse_only): + + task = FivettGen_Hsvs( + cont=None, + debug=False, + force=False, + freesurfer_lut=None, + hippocampi=None, + in_file=File.sample(), + nocleanup=False, + nocrop=False, + scratch=None, + sgm_amyg_hipp=False, + template=None, + thalami=None, + white_stem=False, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_fixel2peaks.py b/pydra/tasks/mrtrix3/v3_1/tests/test_fixel2peaks.py new file mode 100644 index 0000000..b6f9ebc --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_fixel2peaks.py @@ -0,0 +1,22 @@ +# Auto-generated test for fixel2peaks + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Fixel2Peaks + + +@pytest.mark.xfail +def test_fixel2peaks(tmp_path, cli_parse_only): + + task = Fixel2Peaks( + debug=False, + force=False, + in_=File.sample(), + nan=False, + number=None, + out=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_fixel2sh.py b/pydra/tasks/mrtrix3/v3_1/tests/test_fixel2sh.py new file mode 100644 index 0000000..d6b2cfa --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_fixel2sh.py @@ -0,0 +1,21 @@ +# Auto-generated test for fixel2sh + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Fixel2Sh + + +@pytest.mark.xfail +def test_fixel2sh(tmp_path, cli_parse_only): + + task = Fixel2Sh( + debug=False, + fixel_in=Nifti1.sample(), + force=False, + lmax=None, + sh_out=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_fixel2tsf.py b/pydra/tasks/mrtrix3/v3_1/tests/test_fixel2tsf.py new file mode 100644 index 0000000..9e02706 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_fixel2tsf.py @@ -0,0 +1,22 @@ +# Auto-generated test for fixel2tsf + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Fixel2Tsf + + +@pytest.mark.xfail +def test_fixel2tsf(tmp_path, cli_parse_only): + + task = Fixel2Tsf( + angle=None, + debug=False, + fixel_in=Nifti1.sample(), + force=False, + tracks=Tracks.sample(), + tsf=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_fixel2voxel.py b/pydra/tasks/mrtrix3/v3_1/tests/test_fixel2voxel.py new file mode 100644 index 0000000..6d843b6 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_fixel2voxel.py @@ -0,0 +1,24 @@ +# Auto-generated test for fixel2voxel + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Fixel2Voxel + + +@pytest.mark.xfail +def test_fixel2voxel(tmp_path, cli_parse_only): + + task = Fixel2Voxel( + debug=False, + fill=None, + fixel_in=Nifti1.sample(), + force=False, + number=None, + operation="mean", + weighted=None, + image_out=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_fixelcfestats.py b/pydra/tasks/mrtrix3/v3_1/tests/test_fixelcfestats.py new file mode 100644 index 0000000..d10e981 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_fixelcfestats.py @@ -0,0 +1,46 @@ +# Auto-generated test for fixelcfestats + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import FixelCfestats + + +@pytest.mark.xfail(reason="Job fixelcfestats is known not pass yet") +@pytest.mark.xfail +def test_fixelcfestats(tmp_path, cli_parse_only): + + task = FixelCfestats( + cfe_c=None, + cfe_dh=None, + cfe_e=None, + cfe_h=None, + cfe_legacy=False, + column=None, + connectivity=File.sample(), + contrast=File.sample(), + debug=False, + design=File.sample(), + errors=None, + exchange_whole=None, + exchange_within=None, + fonly=False, + force=False, + ftests=None, + in_fixel_directory=File.sample(), + mask=None, + nonstationarity=False, + notest=False, + nshuffles=None, + nshuffles_nonstationarity=None, + out_fixel_directory="a-string", + permutations=None, + permutations_nonstationarity=None, + skew_nonstationarity=None, + strong=False, + subjects=Nifti1.sample(), + variance=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_fixelconnectivity.py b/pydra/tasks/mrtrix3/v3_1/tests/test_fixelconnectivity.py new file mode 100644 index 0000000..11e65be --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_fixelconnectivity.py @@ -0,0 +1,28 @@ +# Auto-generated test for fixelconnectivity + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import FixelConnectivity + + +@pytest.mark.xfail(reason="Job fixelconnectivity is known not pass yet") +@pytest.mark.xfail +def test_fixelconnectivity(tmp_path, cli_parse_only): + + task = FixelConnectivity( + angle=None, + debug=False, + fixel_directory=File.sample(), + force=False, + mask=None, + tck_weights_in=None, + threshold=None, + tracks=Tracks.sample(), + count=None, + extent=None, + matrix=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_fixelconvert.py b/pydra/tasks/mrtrix3/v3_1/tests/test_fixelconvert.py new file mode 100644 index 0000000..f39c6f7 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_fixelconvert.py @@ -0,0 +1,27 @@ +# Auto-generated test for fixelconvert + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import FixelConvert + + +@pytest.mark.xfail(reason="Job fixelconvert is known not pass yet") +@pytest.mark.xfail +def test_fixelconvert(tmp_path, cli_parse_only): + + task = FixelConvert( + debug=False, + fixel_in=File.sample(), + fixel_out=File.sample(), + force=False, + in_size=None, + name=None, + nii=False, + out_size=False, + template=None, + value=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_fixelcorrespondence.py b/pydra/tasks/mrtrix3/v3_1/tests/test_fixelcorrespondence.py new file mode 100644 index 0000000..5c6246d --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_fixelcorrespondence.py @@ -0,0 +1,24 @@ +# Auto-generated test for fixelcorrespondence + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import FixelCorrespondence + + +@pytest.mark.xfail(reason="Job fixelcorrespondence is known not pass yet") +@pytest.mark.xfail +def test_fixelcorrespondence(tmp_path, cli_parse_only): + + task = FixelCorrespondence( + angle=None, + debug=False, + force=False, + output_data="a-string", + output_directory="a-string", + subject_data=Nifti1.sample(), + template_directory=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_fixelcrop.py b/pydra/tasks/mrtrix3/v3_1/tests/test_fixelcrop.py new file mode 100644 index 0000000..48aaaff --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_fixelcrop.py @@ -0,0 +1,22 @@ +# Auto-generated test for fixelcrop + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import FixelCrop + + +@pytest.mark.xfail(reason="Job fixelcrop is known not pass yet") +@pytest.mark.xfail +def test_fixelcrop(tmp_path, cli_parse_only): + + task = FixelCrop( + debug=False, + force=False, + input_fixel_directory=File.sample(), + input_fixel_mask=Nifti1.sample(), + output_fixel_directory=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_fixelfilter.py b/pydra/tasks/mrtrix3/v3_1/tests/test_fixelfilter.py new file mode 100644 index 0000000..8d8ba39 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_fixelfilter.py @@ -0,0 +1,28 @@ +# Auto-generated test for fixelfilter + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import FixelFilter + + +@pytest.mark.xfail(reason="Job fixelfilter is known not pass yet") +@pytest.mark.xfail +def test_fixelfilter(tmp_path, cli_parse_only): + + task = FixelFilter( + debug=False, + filter="connect", + force=False, + fwhm=None, + input=File.sample(), + mask=None, + matrix=File.sample(), + minweight=None, + output=File.sample(), + threshold_connectivity=None, + threshold_value=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_fixelreorient.py b/pydra/tasks/mrtrix3/v3_1/tests/test_fixelreorient.py new file mode 100644 index 0000000..256ebdf --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_fixelreorient.py @@ -0,0 +1,22 @@ +# Auto-generated test for fixelreorient + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import FixelReorient + + +@pytest.mark.xfail(reason="Job fixelreorient is known not pass yet") +@pytest.mark.xfail +def test_fixelreorient(tmp_path, cli_parse_only): + + task = FixelReorient( + debug=False, + fixel_in=File.sample(), + force=False, + warp=Nifti1.sample(), + fixel_out=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_fod2dec.py b/pydra/tasks/mrtrix3/v3_1/tests/test_fod2dec.py new file mode 100644 index 0000000..26e0037 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_fod2dec.py @@ -0,0 +1,27 @@ +# Auto-generated test for fod2dec + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Fod2Dec + + +@pytest.mark.xfail +def test_fod2dec(tmp_path, cli_parse_only): + + task = Fod2Dec( + contrast=None, + debug=False, + force=False, + in_file=Nifti1.sample(), + lum=False, + lum_coefs=None, + lum_gamma=None, + mask=None, + no_weight=False, + threshold=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_fod2fixel.py b/pydra/tasks/mrtrix3/v3_1/tests/test_fod2fixel.py new file mode 100644 index 0000000..c976818 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_fod2fixel.py @@ -0,0 +1,31 @@ +# Auto-generated test for fod2fixel + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Fod2Fixel + + +@pytest.mark.xfail +def test_fod2fixel(tmp_path, cli_parse_only): + + task = Fod2Fixel( + debug=False, + dirpeak=False, + fmls_integral=None, + fmls_lobe_merge_ratio=None, + fmls_no_thresholds=False, + fmls_peak_value=None, + fod=Nifti1.sample(), + force=False, + mask=None, + maxnum=None, + nii=False, + afd=None, + disp=None, + fixel_directory=File.sample(), + peak_amp=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_label2colour.py b/pydra/tasks/mrtrix3/v3_1/tests/test_label2colour.py new file mode 100644 index 0000000..9c4a237 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_label2colour.py @@ -0,0 +1,21 @@ +# Auto-generated test for label2colour + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Label2Colour + + +@pytest.mark.xfail +def test_label2colour(tmp_path, cli_parse_only): + + task = Label2Colour( + debug=False, + force=False, + lut=None, + nodes_in=Nifti1.sample(), + colour_out=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_label2mesh.py b/pydra/tasks/mrtrix3/v3_1/tests/test_label2mesh.py new file mode 100644 index 0000000..b52103a --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_label2mesh.py @@ -0,0 +1,21 @@ +# Auto-generated test for label2mesh + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Label2Mesh + + +@pytest.mark.xfail +def test_label2mesh(tmp_path, cli_parse_only): + + task = Label2Mesh( + blocky=False, + debug=False, + force=False, + nodes_in=Nifti1.sample(), + mesh_out=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_labelconvert.py b/pydra/tasks/mrtrix3/v3_1/tests/test_labelconvert.py new file mode 100644 index 0000000..6df3508 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_labelconvert.py @@ -0,0 +1,23 @@ +# Auto-generated test for labelconvert + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import LabelConvert + + +@pytest.mark.xfail +def test_labelconvert(tmp_path, cli_parse_only): + + task = LabelConvert( + debug=False, + force=False, + lut_in=File.sample(), + lut_out=File.sample(), + path_in=Nifti1.sample(), + spine=None, + image_out=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_labelsgmfirst.py b/pydra/tasks/mrtrix3/v3_1/tests/test_labelsgmfirst.py new file mode 100644 index 0000000..286f8ee --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_labelsgmfirst.py @@ -0,0 +1,27 @@ +# Auto-generated test for labelsgmfirst + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import LabelSgmfirst + + +@pytest.mark.xfail +def test_labelsgmfirst(tmp_path, cli_parse_only): + + task = LabelSgmfirst( + cont=None, + debug=False, + force=False, + lut=File.sample(), + nocleanup=False, + parc=Nifti1.sample(), + premasked=False, + scratch=None, + sgm_amyg_hipp=False, + t1=Nifti1.sample(), + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_labelstats.py b/pydra/tasks/mrtrix3/v3_1/tests/test_labelstats.py new file mode 100644 index 0000000..272a7b1 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_labelstats.py @@ -0,0 +1,21 @@ +# Auto-generated test for labelstats + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import LabelStats + + +@pytest.mark.xfail +def test_labelstats(tmp_path, cli_parse_only): + + task = LabelStats( + debug=False, + force=False, + in_file=Nifti1.sample(), + output=None, + voxelspace=False, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mask2glass.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mask2glass.py new file mode 100644 index 0000000..73c584b --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mask2glass.py @@ -0,0 +1,27 @@ +# Auto-generated test for mask2glass + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Mask2Glass + + +@pytest.mark.xfail(reason="Job mask2glass is known not pass yet") +@pytest.mark.xfail +def test_mask2glass(tmp_path, cli_parse_only): + + task = Mask2Glass( + cont=None, + debug=False, + dilate=None, + force=False, + in_file=Nifti1.sample(), + nocleanup=False, + scale=None, + scratch=None, + smooth=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_maskdump.py b/pydra/tasks/mrtrix3/v3_1/tests/test_maskdump.py new file mode 100644 index 0000000..5be3124 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_maskdump.py @@ -0,0 +1,20 @@ +# Auto-generated test for maskdump + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MaskDump + + +@pytest.mark.xfail +def test_maskdump(tmp_path, cli_parse_only): + + task = MaskDump( + debug=False, + force=False, + in_file=Nifti1.sample(), + out_file=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_maskfilter.py b/pydra/tasks/mrtrix3/v3_1/tests/test_maskfilter.py new file mode 100644 index 0000000..63d5802 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_maskfilter.py @@ -0,0 +1,29 @@ +# Auto-generated test for maskfilter + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MaskFilter + + +@pytest.mark.xfail +def test_maskfilter(tmp_path, cli_parse_only): + + task = MaskFilter( + axes=None, + connectivity=False, + debug=False, + extent=None, + filter="clean", + force=False, + in_file=Nifti1.sample(), + largest=False, + minsize=None, + npass=None, + scale=None, + strides=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mesh2voxel.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mesh2voxel.py new file mode 100644 index 0000000..05b7af9 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mesh2voxel.py @@ -0,0 +1,21 @@ +# Auto-generated test for mesh2voxel + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Mesh2Voxel + + +@pytest.mark.xfail +def test_mesh2voxel(tmp_path, cli_parse_only): + + task = Mesh2Voxel( + debug=False, + force=False, + source=File.sample(), + template=Nifti1.sample(), + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_meshconvert.py b/pydra/tasks/mrtrix3/v3_1/tests/test_meshconvert.py new file mode 100644 index 0000000..aaf5125 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_meshconvert.py @@ -0,0 +1,22 @@ +# Auto-generated test for meshconvert + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MeshConvert + + +@pytest.mark.xfail +def test_meshconvert(tmp_path, cli_parse_only): + + task = MeshConvert( + binary=False, + debug=False, + force=False, + in_file=File.sample(), + transform=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_meshfilter.py b/pydra/tasks/mrtrix3/v3_1/tests/test_meshfilter.py new file mode 100644 index 0000000..af59c2c --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_meshfilter.py @@ -0,0 +1,23 @@ +# Auto-generated test for meshfilter + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MeshFilter + + +@pytest.mark.xfail +def test_meshfilter(tmp_path, cli_parse_only): + + task = MeshFilter( + debug=False, + filter="smooth", + force=False, + in_file=File.sample(), + smooth_influence=None, + smooth_spatial=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mraverageheader.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mraverageheader.py new file mode 100644 index 0000000..f9d1c96 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mraverageheader.py @@ -0,0 +1,24 @@ +# Auto-generated test for mraverageheader + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MrAverageheader + + +@pytest.mark.xfail +def test_mraverageheader(tmp_path, cli_parse_only): + + task = MrAverageheader( + datatype=None, + debug=False, + fill=False, + force=False, + in_file=[Nifti1.sample()], + padding=None, + spacing=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mrcat.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mrcat.py new file mode 100644 index 0000000..342796e --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mrcat.py @@ -0,0 +1,22 @@ +# Auto-generated test for mrcat + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MrCat + + +@pytest.mark.xfail +def test_mrcat(tmp_path, cli_parse_only): + + task = MrCat( + axis=None, + datatype=None, + debug=False, + force=False, + inputs=[Nifti1.sample()], + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mrcentroid.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mrcentroid.py new file mode 100644 index 0000000..f9a7a84 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mrcentroid.py @@ -0,0 +1,21 @@ +# Auto-generated test for mrcentroid + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MrCentroid + + +@pytest.mark.xfail +def test_mrcentroid(tmp_path, cli_parse_only): + + task = MrCentroid( + debug=False, + force=False, + in_file=Nifti1.sample(), + mask=None, + voxelspace=False, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mrcheckerboardmask.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mrcheckerboardmask.py new file mode 100644 index 0000000..a380f9f --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mrcheckerboardmask.py @@ -0,0 +1,23 @@ +# Auto-generated test for mrcheckerboardmask + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MrCheckerboardmask + + +@pytest.mark.xfail +def test_mrcheckerboardmask(tmp_path, cli_parse_only): + + task = MrCheckerboardmask( + debug=False, + force=False, + in_file=Nifti1.sample(), + invert=False, + nan=False, + tiles=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mrclusterstats.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mrclusterstats.py new file mode 100644 index 0000000..fbe83fa --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mrclusterstats.py @@ -0,0 +1,43 @@ +# Auto-generated test for mrclusterstats + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MrClusterstats + + +@pytest.mark.xfail +def test_mrclusterstats(tmp_path, cli_parse_only): + + task = MrClusterstats( + column=None, + connectivity=False, + contrast=File.sample(), + debug=False, + design=File.sample(), + errors=None, + exchange_whole=None, + exchange_within=None, + fonly=False, + force=False, + ftests=None, + in_file=File.sample(), + mask=Nifti1.sample(), + nonstationarity=False, + notest=False, + nshuffles=None, + nshuffles_nonstationarity=None, + output="a-string", + permutations=None, + permutations_nonstationarity=None, + skew_nonstationarity=None, + strong=False, + tfce_dh=None, + tfce_e=None, + tfce_h=None, + threshold=None, + variance=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mrcolour.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mrcolour.py new file mode 100644 index 0000000..76976c3 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mrcolour.py @@ -0,0 +1,24 @@ +# Auto-generated test for mrcolour + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MrColour + + +@pytest.mark.xfail +def test_mrcolour(tmp_path, cli_parse_only): + + task = MrColour( + colour=None, + debug=False, + force=False, + in_file=Nifti1.sample(), + lower=None, + map="gray", + upper=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mrconvert.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mrconvert.py new file mode 100644 index 0000000..9d6455f --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mrconvert.py @@ -0,0 +1,42 @@ +# Auto-generated test for mrconvert + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MrConvert + + +@pytest.mark.xfail(reason="Job mrconvert is known not pass yet") +@pytest.mark.xfail +def test_mrconvert(tmp_path, cli_parse_only): + + task = MrConvert( + append_property=None, + axes=None, + bvalue_scaling=False, + clear_property=None, + coord=None, + copy_properties=None, + datatype=None, + debug=False, + force=False, + fslgrad=None, + grad=None, + import_pe_eddy=None, + import_pe_table=None, + in_file=Nifti1.sample(), + json_import=None, + scaling=None, + set_property=None, + strides=None, + vox=None, + export_grad_fsl=None, + export_grad_mrtrix=None, + export_pe_eddy=None, + export_pe_table=None, + json_export=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mrdegibbs.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mrdegibbs.py new file mode 100644 index 0000000..441e2c8 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mrdegibbs.py @@ -0,0 +1,26 @@ +# Auto-generated test for mrdegibbs + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MrDegibbs + + +@pytest.mark.xfail +def test_mrdegibbs(tmp_path, cli_parse_only): + + task = MrDegibbs( + axes=None, + datatype=None, + debug=False, + force=False, + in_=Nifti1.sample(), + maxW=None, + minW=None, + mode=None, + nshifts=None, + out=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mrdump.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mrdump.py new file mode 100644 index 0000000..6c6dcac --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mrdump.py @@ -0,0 +1,21 @@ +# Auto-generated test for mrdump + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MrDump + + +@pytest.mark.xfail +def test_mrdump(tmp_path, cli_parse_only): + + task = MrDump( + debug=False, + force=False, + in_file=Nifti1.sample(), + mask=None, + out_file=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mredit.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mredit.py new file mode 100644 index 0000000..a37a7c9 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mredit.py @@ -0,0 +1,24 @@ +# Auto-generated test for mredit + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MrEdit + + +@pytest.mark.xfail +def test_mredit(tmp_path, cli_parse_only): + + task = MrEdit( + debug=False, + force=False, + in_file=Nifti1.sample(), + plane=None, + scanner=False, + sphere=None, + voxel=None, + out_file=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mrfilter.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mrfilter.py new file mode 100644 index 0000000..c7c81bc --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mrfilter.py @@ -0,0 +1,36 @@ +# Auto-generated test for mrfilter + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MrFilter + + +@pytest.mark.xfail +def test_mrfilter(tmp_path, cli_parse_only): + + task = MrFilter( + axes=None, + bridge=None, + centre_zero=False, + debug=False, + extent=None, + filter="fft", + force=False, + fwhm=None, + in_file=Nifti1.sample(), + inverse=False, + magnitude=False, + maskin=None, + rescale=False, + scanner=False, + stdev=None, + strides=None, + zlower=None, + zupper=None, + maskout=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mrgrid.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mrgrid.py new file mode 100644 index 0000000..15a6360 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mrgrid.py @@ -0,0 +1,36 @@ +# Auto-generated test for mrgrid + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MrGrid + + +@pytest.mark.xfail +def test_mrgrid(tmp_path, cli_parse_only): + + task = MrGrid( + all_axes=False, + as_=None, + axis=None, + crop_unbound=False, + datatype=None, + debug=False, + fill=None, + force=False, + in_file=Nifti1.sample(), + interp=None, + mask=None, + operation="regrid", + oversample=None, + scale=None, + size=None, + strides=None, + template=None, + uniform=None, + voxel=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mrhistmatch.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mrhistmatch.py new file mode 100644 index 0000000..a388057 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mrhistmatch.py @@ -0,0 +1,25 @@ +# Auto-generated test for mrhistmatch + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MrHistmatch + + +@pytest.mark.xfail +def test_mrhistmatch(tmp_path, cli_parse_only): + + task = MrHistmatch( + bins=None, + debug=False, + force=False, + in_file=Nifti1.sample(), + mask_input=None, + mask_target=None, + target=Nifti1.sample(), + type="scale", + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mrhistogram.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mrhistogram.py new file mode 100644 index 0000000..f3903f3 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mrhistogram.py @@ -0,0 +1,25 @@ +# Auto-generated test for mrhistogram + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MrHistogram + + +@pytest.mark.xfail +def test_mrhistogram(tmp_path, cli_parse_only): + + task = MrHistogram( + allvolumes=False, + bins=None, + debug=False, + force=False, + ignorezero=False, + image_=Nifti1.sample(), + mask=None, + template=None, + hist=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mrinfo.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mrinfo.py new file mode 100644 index 0000000..4e26fae --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mrinfo.py @@ -0,0 +1,46 @@ +# Auto-generated test for mrinfo + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MrInfo + + +@pytest.mark.xfail +def test_mrinfo(tmp_path, cli_parse_only): + + task = MrInfo( + all=False, + bvalue_scaling=False, + datatype=False, + debug=False, + dwgrad=False, + force=False, + format=False, + fslgrad=None, + grad=None, + image_=[Nifti1.sample()], + multiplier=False, + name=False, + ndim=False, + nodelete=False, + offset=False, + petable=False, + property=None, + shell_bvalues=False, + shell_indices=False, + shell_sizes=False, + size=False, + spacing=False, + strides=False, + transform=False, + export_grad_fsl=None, + export_grad_mrtrix=None, + export_pe_eddy=None, + export_pe_table=None, + json_all=None, + json_keyval=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mrmath.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mrmath.py new file mode 100644 index 0000000..03c653e --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mrmath.py @@ -0,0 +1,24 @@ +# Auto-generated test for mrmath + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MrMath + + +@pytest.mark.xfail +def test_mrmath(tmp_path, cli_parse_only): + + task = MrMath( + axis=None, + datatype=None, + debug=False, + force=False, + in_file=[Nifti1.sample()], + keep_unary_axes=False, + operation="mean", + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mrmetric.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mrmetric.py new file mode 100644 index 0000000..275ebd3 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mrmetric.py @@ -0,0 +1,27 @@ +# Auto-generated test for mrmetric + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MrMetric + + +@pytest.mark.xfail +def test_mrmetric(tmp_path, cli_parse_only): + + task = MrMetric( + debug=False, + force=False, + image1=Nifti1.sample(), + image2=Nifti1.sample(), + interp=None, + mask1=None, + mask2=None, + metric=None, + nonormalisation=False, + overlap=False, + space=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mrregister.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mrregister.py new file mode 100644 index 0000000..49a7cc0 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mrregister.py @@ -0,0 +1,78 @@ +# Auto-generated test for mrregister + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MrRegister + + +@pytest.mark.xfail +def test_mrregister(tmp_path, cli_parse_only): + + task = MrRegister( + affine_init_matrix=None, + affine_init_rotation=None, + affine_init_translation=None, + affine_lmax=None, + affine_metric=None, + affine_metric_diff_estimator=None, + affine_niter=None, + affine_scale=None, + contrast1_contrast2=None, + datatype=None, + debug=False, + diagnostics_image=None, + directions=None, + force=False, + image1_image2=Nifti1.sample(), + init_rotation_search_angles=None, + init_rotation_search_directions=None, + init_rotation_search_global_iterations=None, + init_rotation_search_run_global=False, + init_rotation_search_scale=None, + init_rotation_unmasked1=False, + init_rotation_unmasked2=False, + init_translation_unmasked1=False, + init_translation_unmasked2=False, + linstage_diagnostics_prefix=None, + linstage_iterations=None, + linstage_optimiser_default=None, + linstage_optimiser_first=None, + linstage_optimiser_last=None, + mask1=None, + mask2=None, + mc_weights=None, + nan=False, + nl_disp_smooth=None, + nl_grad_step=None, + nl_init=None, + nl_lmax=None, + nl_niter=None, + nl_scale=None, + nl_update_smooth=None, + noreorientation=False, + rigid_init_matrix=None, + rigid_init_rotation=None, + rigid_init_translation=None, + rigid_lmax=None, + rigid_metric=None, + rigid_metric_diff_estimator=None, + rigid_niter=None, + rigid_scale=None, + type=None, + affine=None, + affine_1tomidway=None, + affine_2tomidway=None, + affine_log=None, + nl_warp=None, + nl_warp_full=None, + rigid=None, + rigid_1tomidway=None, + rigid_2tomidway=None, + rigid_log=None, + transformed=None, + transformed_midway=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mrstats.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mrstats.py new file mode 100644 index 0000000..c2293de --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mrstats.py @@ -0,0 +1,24 @@ +# Auto-generated test for mrstats + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MrStats + + +@pytest.mark.xfail(reason="Job mrstats is known not pass yet") +@pytest.mark.xfail +def test_mrstats(tmp_path, cli_parse_only): + + task = MrStats( + allvolumes=False, + debug=False, + force=False, + ignorezero=False, + image_=Nifti1.sample(), + mask=None, + output=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mrthreshold.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mrthreshold.py new file mode 100644 index 0000000..8499511 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mrthreshold.py @@ -0,0 +1,31 @@ +# Auto-generated test for mrthreshold + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MrThreshold + + +@pytest.mark.xfail +def test_mrthreshold(tmp_path, cli_parse_only): + + task = MrThreshold( + abs=None, + allvolumes=False, + bottom=None, + comparison=None, + debug=False, + force=False, + ignorezero=False, + in_file=Nifti1.sample(), + invert=False, + mask=None, + nan=False, + out_masked=False, + percentile=None, + top=None, + out_file=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mrtransform.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mrtransform.py new file mode 100644 index 0000000..044e3cb --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mrtransform.py @@ -0,0 +1,45 @@ +# Auto-generated test for mrtransform + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MrTransform + + +@pytest.mark.xfail(reason="Job mrtransform is known not pass yet") +@pytest.mark.xfail +def test_mrtransform(tmp_path, cli_parse_only): + + task = MrTransform( + datatype=None, + debug=False, + directions=None, + flip=None, + force=False, + from_=None, + fslgrad=None, + grad=None, + half=False, + identity=False, + in_file=Nifti1.sample(), + interp=None, + inverse=False, + linear=None, + midway_space=False, + modulate=None, + nan=False, + no_reorientation=False, + oversample=None, + reorient_fod=False, + replace=None, + strides=None, + template=None, + warp=None, + warp_full=None, + export_grad_fsl=None, + export_grad_mrtrix=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mrtrix_cleanup.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mrtrix_cleanup.py new file mode 100644 index 0000000..dc247b6 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mrtrix_cleanup.py @@ -0,0 +1,25 @@ +# Auto-generated test for mrtrix_cleanup + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MrTrix_Cleanup + + +@pytest.mark.xfail(reason="Job mrtrix_cleanup is known not pass yet") +@pytest.mark.xfail +def test_mrtrix_cleanup(tmp_path, cli_parse_only): + + task = MrTrix_Cleanup( + cont=None, + debug=False, + force=False, + nocleanup=False, + path=File.sample(), + scratch=None, + test=False, + failed=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_mtnormalise.py b/pydra/tasks/mrtrix3/v3_1/tests/test_mtnormalise.py new file mode 100644 index 0000000..44ab60f --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_mtnormalise.py @@ -0,0 +1,27 @@ +# Auto-generated test for mtnormalise + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import MtNormalise + + +@pytest.mark.xfail +def test_mtnormalise(tmp_path, cli_parse_only): + + task = MtNormalise( + balanced=False, + debug=False, + force=False, + input_output=[File.sample()], + mask=Nifti1.sample(), + niter=None, + order=None, + reference=None, + check_factors=None, + check_mask=None, + check_norm=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_peaks2amp.py b/pydra/tasks/mrtrix3/v3_1/tests/test_peaks2amp.py new file mode 100644 index 0000000..62e824b --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_peaks2amp.py @@ -0,0 +1,20 @@ +# Auto-generated test for peaks2amp + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Peaks2Amp + + +@pytest.mark.xfail +def test_peaks2amp(tmp_path, cli_parse_only): + + task = Peaks2Amp( + debug=False, + directions=Nifti1.sample(), + force=False, + amplitudes=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_peaks2fixel.py b/pydra/tasks/mrtrix3/v3_1/tests/test_peaks2fixel.py new file mode 100644 index 0000000..440e567 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_peaks2fixel.py @@ -0,0 +1,21 @@ +# Auto-generated test for peaks2fixel + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Peaks2Fixel + + +@pytest.mark.xfail +def test_peaks2fixel(tmp_path, cli_parse_only): + + task = Peaks2Fixel( + dataname=None, + debug=False, + directions=Nifti1.sample(), + force=False, + fixels=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_population_template.py b/pydra/tasks/mrtrix3/v3_1/tests/test_population_template.py new file mode 100644 index 0000000..6e15178 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_population_template.py @@ -0,0 +1,58 @@ +# Auto-generated test for population_template + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import PopulationTemplate + + +@pytest.mark.xfail(reason="Job population_template is known not pass yet") +@pytest.mark.xfail +def test_population_template(tmp_path, cli_parse_only): + + task = PopulationTemplate( + affine_lmax=None, + affine_niter=None, + affine_scale=None, + aggregate=None, + aggregation_weights=None, + cont=None, + copy_input=False, + debug=False, + delete_temporary_files=False, + force=False, + initial_alignment=None, + input_dir=File.sample(), + leave_one_out=None, + linear_estimator=None, + linear_no_drift_correction=False, + linear_no_pause=False, + mask_dir=None, + mc_weight_affine=None, + mc_weight_initial_alignment=None, + mc_weight_nl=None, + mc_weight_rigid=None, + nanmask=False, + nl_disp_smooth=None, + nl_grad_step=None, + nl_lmax=None, + nl_niter=None, + nl_scale=None, + nl_update_smooth=None, + nocleanup=False, + noreorientation=False, + rigid_lmax=None, + rigid_niter=None, + rigid_scale=None, + scratch=None, + type=None, + voxel_size=None, + linear_transformations_dir=None, + template=File.sample(), + template_mask=None, + transformed_dir=None, + warp_dir=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_responsemean.py b/pydra/tasks/mrtrix3/v3_1/tests/test_responsemean.py new file mode 100644 index 0000000..1537282 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_responsemean.py @@ -0,0 +1,25 @@ +# Auto-generated test for responsemean + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import ResponseMean + + +@pytest.mark.xfail(reason="Job responsemean is known not pass yet") +@pytest.mark.xfail +def test_responsemean(tmp_path, cli_parse_only): + + task = ResponseMean( + cont=None, + debug=False, + force=False, + inputs=File.sample(), + legacy=False, + nocleanup=False, + scratch=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_sh2amp.py b/pydra/tasks/mrtrix3/v3_1/tests/test_sh2amp.py new file mode 100644 index 0000000..4cd6968 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_sh2amp.py @@ -0,0 +1,26 @@ +# Auto-generated test for sh2amp + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Sh2Amp + + +@pytest.mark.xfail +def test_sh2amp(tmp_path, cli_parse_only): + + task = Sh2Amp( + datatype=None, + debug=False, + directions=File.sample(), + force=False, + fslgrad=None, + grad=None, + in_file=Nifti1.sample(), + nonnegative=False, + strides=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_sh2peaks.py b/pydra/tasks/mrtrix3/v3_1/tests/test_sh2peaks.py new file mode 100644 index 0000000..3855236 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_sh2peaks.py @@ -0,0 +1,27 @@ +# Auto-generated test for sh2peaks + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Sh2Peaks + + +@pytest.mark.xfail +def test_sh2peaks(tmp_path, cli_parse_only): + + task = Sh2Peaks( + SH=Nifti1.sample(), + debug=False, + direction=None, + fast=False, + force=False, + mask=None, + num=None, + peaks=None, + seeds=None, + threshold=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_sh2power.py b/pydra/tasks/mrtrix3/v3_1/tests/test_sh2power.py new file mode 100644 index 0000000..3f9f1cb --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_sh2power.py @@ -0,0 +1,21 @@ +# Auto-generated test for sh2power + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Sh2Power + + +@pytest.mark.xfail +def test_sh2power(tmp_path, cli_parse_only): + + task = Sh2Power( + SH=Nifti1.sample(), + debug=False, + force=False, + spectrum=False, + power=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_sh2response.py b/pydra/tasks/mrtrix3/v3_1/tests/test_sh2response.py new file mode 100644 index 0000000..d9a3759 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_sh2response.py @@ -0,0 +1,24 @@ +# Auto-generated test for sh2response + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Sh2Response + + +@pytest.mark.xfail +def test_sh2response(tmp_path, cli_parse_only): + + task = Sh2Response( + SH=Nifti1.sample(), + debug=False, + directions=Nifti1.sample(), + force=False, + lmax=None, + mask=Nifti1.sample(), + dump=None, + response=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_shbasis.py b/pydra/tasks/mrtrix3/v3_1/tests/test_shbasis.py new file mode 100644 index 0000000..6ea3bc3 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_shbasis.py @@ -0,0 +1,20 @@ +# Auto-generated test for shbasis + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import ShBasis + + +@pytest.mark.xfail +def test_shbasis(tmp_path, cli_parse_only): + + task = ShBasis( + SH=[Nifti1.sample()], + convert=None, + debug=False, + force=False, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_shconv.py b/pydra/tasks/mrtrix3/v3_1/tests/test_shconv.py new file mode 100644 index 0000000..ab4e923 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_shconv.py @@ -0,0 +1,22 @@ +# Auto-generated test for shconv + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import ShConv + + +@pytest.mark.xfail +def test_shconv(tmp_path, cli_parse_only): + + task = ShConv( + datatype=None, + debug=False, + force=False, + odf_response=[File.sample()], + strides=None, + SH_out=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_tck2connectome.py b/pydra/tasks/mrtrix3/v3_1/tests/test_tck2connectome.py new file mode 100644 index 0000000..829b3e4 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_tck2connectome.py @@ -0,0 +1,37 @@ +# Auto-generated test for tck2connectome + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Tck2Connectome + + +@pytest.mark.xfail +def test_tck2connectome(tmp_path, cli_parse_only): + + task = Tck2Connectome( + assignment_all_voxels=False, + assignment_end_voxels=False, + assignment_forward_search=None, + assignment_radial_search=None, + assignment_reverse_search=None, + debug=False, + force=False, + keep_unassigned=False, + nodes_in=Nifti1.sample(), + scale_file=None, + scale_invlength=False, + scale_invnodevol=False, + scale_length=False, + stat_edge=None, + symmetric=False, + tck_weights_in=None, + tracks_in=Tracks.sample(), + vector=False, + zero_diagonal=False, + connectome_out=File.sample(), + out_assignments=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_tck2fixel.py b/pydra/tasks/mrtrix3/v3_1/tests/test_tck2fixel.py new file mode 100644 index 0000000..49d8d0e --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_tck2fixel.py @@ -0,0 +1,24 @@ +# Auto-generated test for tck2fixel + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Tck2Fixel + + +@pytest.mark.xfail(reason="Job tck2fixel is known not pass yet") +@pytest.mark.xfail +def test_tck2fixel(tmp_path, cli_parse_only): + + task = Tck2Fixel( + angle=None, + debug=False, + fixel_data_out="a-string", + fixel_folder_in=File.sample(), + fixel_folder_out="a-string", + force=False, + tracks=Tracks.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_tckconvert.py b/pydra/tasks/mrtrix3/v3_1/tests/test_tckconvert.py new file mode 100644 index 0000000..bafd053 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_tckconvert.py @@ -0,0 +1,29 @@ +# Auto-generated test for tckconvert + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import TckConvert + + +@pytest.mark.xfail +def test_tckconvert(tmp_path, cli_parse_only): + + task = TckConvert( + ascii=False, + debug=False, + dec=False, + force=False, + image2scanner=None, + increment=None, + input=File.sample(), + radius=None, + scanner2image=None, + scanner2voxel=None, + sides=None, + voxel2scanner=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_tckdfc.py b/pydra/tasks/mrtrix3/v3_1/tests/test_tckdfc.py new file mode 100644 index 0000000..dfba559 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_tckdfc.py @@ -0,0 +1,28 @@ +# Auto-generated test for tckdfc + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import TckDfc + + +@pytest.mark.xfail +def test_tckdfc(tmp_path, cli_parse_only): + + task = TckDfc( + backtrack=False, + debug=False, + dynamic=None, + fmri=Nifti1.sample(), + force=False, + stat_vox=None, + static=False, + template=None, + tracks=File.sample(), + upsample=None, + vox=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_tckedit.py b/pydra/tasks/mrtrix3/v3_1/tests/test_tckedit.py new file mode 100644 index 0000000..3259310 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_tckedit.py @@ -0,0 +1,34 @@ +# Auto-generated test for tckedit + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import TckEdit + + +@pytest.mark.xfail +def test_tckedit(tmp_path, cli_parse_only): + + task = TckEdit( + debug=False, + ends_only=False, + exclude=None, + force=False, + include=None, + include_ordered=None, + inverse=False, + mask=None, + maxlength=None, + maxweight=None, + minlength=None, + minweight=None, + number=None, + skip=None, + tck_weights_in=None, + tracks_in=[Tracks.sample()], + tracks_out=Tracks.sample(), + tck_weights_out=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_tckgen.py b/pydra/tasks/mrtrix3/v3_1/tests/test_tckgen.py new file mode 100644 index 0000000..269e9c6 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_tckgen.py @@ -0,0 +1,56 @@ +# Auto-generated test for tckgen + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import TckGen + + +@pytest.mark.xfail +def test_tckgen(tmp_path, cli_parse_only): + + task = TckGen( + act=None, + algorithm=None, + angle=None, + backtrack=False, + crop_at_gmwmi=False, + cutoff=None, + debug=False, + downsample=None, + exclude=None, + force=False, + fslgrad=None, + grad=None, + include=None, + include_ordered=None, + mask=None, + max_attempts_per_seed=None, + maxlength=None, + minlength=None, + noprecomputed=False, + power=None, + rk4=False, + samples=None, + seed_cutoff=None, + seed_direction=None, + seed_dynamic=None, + seed_gmwmi=None, + seed_grid_per_voxel=None, + seed_image=None, + seed_random_per_voxel=None, + seed_rejection=None, + seed_sphere=None, + seed_unidirectional=False, + seeds=None, + select=None, + source=Nifti1.sample(), + step=None, + stop=False, + tracks=Tracks.sample(), + trials=None, + output_seeds=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_tckglobal.py b/pydra/tasks/mrtrix3/v3_1/tests/test_tckglobal.py new file mode 100644 index 0000000..4afa7b9 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_tckglobal.py @@ -0,0 +1,42 @@ +# Auto-generated test for tckglobal + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import TckGlobal + + +@pytest.mark.xfail +def test_tckglobal(tmp_path, cli_parse_only): + + task = TckGlobal( + balance=None, + beta=None, + cpot=None, + debug=False, + density=None, + force=False, + grad=None, + lambda_=None, + length=None, + lmax=None, + mask=None, + niter=None, + noapo=False, + ppot=None, + prob=None, + response=File.sample(), + riso=None, + source=Nifti1.sample(), + t0=None, + t1=None, + tracks=Tracks.sample(), + weight=None, + eext=None, + etrend=None, + fiso=None, + fod=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_tckinfo.py b/pydra/tasks/mrtrix3/v3_1/tests/test_tckinfo.py new file mode 100644 index 0000000..bb0ac36 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_tckinfo.py @@ -0,0 +1,20 @@ +# Auto-generated test for tckinfo + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import TckInfo + + +@pytest.mark.xfail +def test_tckinfo(tmp_path, cli_parse_only): + + task = TckInfo( + count=False, + debug=False, + force=False, + tracks=[Tracks.sample()], + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_tckmap.py b/pydra/tasks/mrtrix3/v3_1/tests/test_tckmap.py new file mode 100644 index 0000000..b1513a1 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_tckmap.py @@ -0,0 +1,38 @@ +# Auto-generated test for tckmap + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import TckMap + + +@pytest.mark.xfail +def test_tckmap(tmp_path, cli_parse_only): + + task = TckMap( + backtrack=False, + contrast=None, + datatype=None, + debug=False, + dec=False, + dixel=None, + ends_only=False, + force=False, + fwhm_tck=None, + image_=None, + map_zero=False, + precise=False, + stat_tck=None, + stat_vox=None, + tck_weights_in=None, + template=None, + tod=None, + tracks=File.sample(), + upsample=None, + vector_file=None, + vox=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_tckresample.py b/pydra/tasks/mrtrix3/v3_1/tests/test_tckresample.py new file mode 100644 index 0000000..aa630a5 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_tckresample.py @@ -0,0 +1,27 @@ +# Auto-generated test for tckresample + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import TckResample + + +@pytest.mark.xfail +def test_tckresample(tmp_path, cli_parse_only): + + task = TckResample( + arc=None, + debug=False, + downsample=None, + endpoints=False, + force=False, + in_tracks=Tracks.sample(), + line=None, + num_points=None, + out_tracks=Tracks.sample(), + step_size=None, + upsample=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_tcksample.py b/pydra/tasks/mrtrix3/v3_1/tests/test_tcksample.py new file mode 100644 index 0000000..f70756c --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_tcksample.py @@ -0,0 +1,25 @@ +# Auto-generated test for tcksample + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import TckSample + + +@pytest.mark.xfail +def test_tcksample(tmp_path, cli_parse_only): + + task = TckSample( + debug=False, + force=False, + image_=Nifti1.sample(), + nointerp=False, + precise=False, + stat_tck=None, + tracks=Tracks.sample(), + use_tdi_fraction=False, + values=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_tcksift.py b/pydra/tasks/mrtrix3/v3_1/tests/test_tcksift.py new file mode 100644 index 0000000..3caa9e6 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_tcksift.py @@ -0,0 +1,37 @@ +# Auto-generated test for tcksift + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import TckSift + + +@pytest.mark.xfail +def test_tcksift(tmp_path, cli_parse_only): + + task = TckSift( + act=None, + debug=False, + fd_scale_gm=False, + fd_thresh=None, + force=False, + in_fod=Nifti1.sample(), + in_tracks=Tracks.sample(), + make_null_lobes=False, + no_dilate_lut=False, + nofilter=False, + out_tracks=Tracks.sample(), + output_at_counts=None, + proc_mask=None, + remove_untracked=False, + term_mu=None, + term_number=None, + term_ratio=None, + csv=None, + out_mu=None, + out_selection=None, + output_debug=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_tcksift2.py b/pydra/tasks/mrtrix3/v3_1/tests/test_tcksift2.py new file mode 100644 index 0000000..ccf3c40 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_tcksift2.py @@ -0,0 +1,44 @@ +# Auto-generated test for tcksift2 + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import TckSift2 + + +@pytest.mark.xfail +def test_tcksift2(tmp_path, cli_parse_only): + + task = TckSift2( + act=None, + debug=False, + fd_scale_gm=False, + fd_thresh=None, + force=False, + in_fod=Nifti1.sample(), + in_tracks=Tracks.sample(), + linear=False, + make_null_lobes=False, + max_coeff=None, + max_coeff_step=None, + max_factor=None, + max_iters=None, + min_cf_decrease=None, + min_coeff=None, + min_factor=None, + min_iters=None, + min_td_frac=None, + no_dilate_lut=False, + proc_mask=None, + reg_tikhonov=None, + reg_tv=None, + remove_untracked=False, + csv=None, + out_coeffs=None, + out_mu=None, + out_weights=File.sample(), + output_debug=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_tckstats.py b/pydra/tasks/mrtrix3/v3_1/tests/test_tckstats.py new file mode 100644 index 0000000..26fa736 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_tckstats.py @@ -0,0 +1,25 @@ +# Auto-generated test for tckstats + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import TckStats + + +@pytest.mark.xfail(reason="Job tckstats is known not pass yet") +@pytest.mark.xfail +def test_tckstats(tmp_path, cli_parse_only): + + task = TckStats( + debug=False, + force=False, + ignorezero=False, + output=None, + tck_weights_in=None, + tracks_in=Tracks.sample(), + dump=None, + histogram=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_tcktransform.py b/pydra/tasks/mrtrix3/v3_1/tests/test_tcktransform.py new file mode 100644 index 0000000..81ddd1d --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_tcktransform.py @@ -0,0 +1,21 @@ +# Auto-generated test for tcktransform + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import TckTransform + + +@pytest.mark.xfail +def test_tcktransform(tmp_path, cli_parse_only): + + task = TckTransform( + debug=False, + force=False, + output=Tracks.sample(), + tracks=Tracks.sample(), + transform=Nifti1.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_tensor2metric.py b/pydra/tasks/mrtrix3/v3_1/tests/test_tensor2metric.py new file mode 100644 index 0000000..b392b47 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_tensor2metric.py @@ -0,0 +1,37 @@ +# Auto-generated test for tensor2metric + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Tensor2Metric + + +@pytest.mark.xfail +def test_tensor2metric(tmp_path, cli_parse_only): + + task = Tensor2Metric( + debug=False, + dkt=None, + force=False, + mask=None, + mk_dirs=None, + modulate=None, + num=None, + rk_ndirs=None, + tensor=Nifti1.sample(), + ad=None, + adc=None, + ak=None, + cl=None, + cp=None, + cs=None, + fa=None, + mk=None, + rd=None, + rk=None, + value=None, + vector=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_transformcalc.py b/pydra/tasks/mrtrix3/v3_1/tests/test_transformcalc.py new file mode 100644 index 0000000..07f7026 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_transformcalc.py @@ -0,0 +1,21 @@ +# Auto-generated test for transformcalc + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import TransformCalc + + +@pytest.mark.xfail +def test_transformcalc(tmp_path, cli_parse_only): + + task = TransformCalc( + debug=False, + force=False, + inputs=[File.sample()], + operation="invert", + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_transformcompose.py b/pydra/tasks/mrtrix3/v3_1/tests/test_transformcompose.py new file mode 100644 index 0000000..42ddda9 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_transformcompose.py @@ -0,0 +1,21 @@ +# Auto-generated test for transformcompose + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import TransformCompose + + +@pytest.mark.xfail +def test_transformcompose(tmp_path, cli_parse_only): + + task = TransformCompose( + debug=False, + force=False, + in_file=[File.sample()], + output=File.sample(), + template=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_transformconvert.py b/pydra/tasks/mrtrix3/v3_1/tests/test_transformconvert.py new file mode 100644 index 0000000..3c34a61 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_transformconvert.py @@ -0,0 +1,21 @@ +# Auto-generated test for transformconvert + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import TransformConvert + + +@pytest.mark.xfail +def test_transformconvert(tmp_path, cli_parse_only): + + task = TransformConvert( + debug=False, + force=False, + input=[File.sample()], + operation="flirt_import", + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_tsfdivide.py b/pydra/tasks/mrtrix3/v3_1/tests/test_tsfdivide.py new file mode 100644 index 0000000..2debcc4 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_tsfdivide.py @@ -0,0 +1,21 @@ +# Auto-generated test for tsfdivide + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import TsfDivide + + +@pytest.mark.xfail +def test_tsfdivide(tmp_path, cli_parse_only): + + task = TsfDivide( + debug=False, + force=False, + input1=File.sample(), + input2=File.sample(), + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_tsfinfo.py b/pydra/tasks/mrtrix3/v3_1/tests/test_tsfinfo.py new file mode 100644 index 0000000..8f467f6 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_tsfinfo.py @@ -0,0 +1,21 @@ +# Auto-generated test for tsfinfo + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import TsfInfo + + +@pytest.mark.xfail +def test_tsfinfo(tmp_path, cli_parse_only): + + task = TsfInfo( + ascii=None, + count=False, + debug=False, + force=False, + tracks=[File.sample()], + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_tsfmult.py b/pydra/tasks/mrtrix3/v3_1/tests/test_tsfmult.py new file mode 100644 index 0000000..05b6f04 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_tsfmult.py @@ -0,0 +1,21 @@ +# Auto-generated test for tsfmult + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import TsfMult + + +@pytest.mark.xfail(reason="Job tsfmult is known not pass yet") +@pytest.mark.xfail +def test_tsfmult(tmp_path, cli_parse_only): + + task = TsfMult( + debug=False, + force=False, + input1=File.sample(), + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_tsfsmooth.py b/pydra/tasks/mrtrix3/v3_1/tests/test_tsfsmooth.py new file mode 100644 index 0000000..48f20e0 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_tsfsmooth.py @@ -0,0 +1,21 @@ +# Auto-generated test for tsfsmooth + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import TsfSmooth + + +@pytest.mark.xfail +def test_tsfsmooth(tmp_path, cli_parse_only): + + task = TsfSmooth( + debug=False, + force=False, + in_file=File.sample(), + stdev=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_tsfthreshold.py b/pydra/tasks/mrtrix3/v3_1/tests/test_tsfthreshold.py new file mode 100644 index 0000000..8d0b39e --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_tsfthreshold.py @@ -0,0 +1,22 @@ +# Auto-generated test for tsfthreshold + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import TsfThreshold + + +@pytest.mark.xfail +def test_tsfthreshold(tmp_path, cli_parse_only): + + task = TsfThreshold( + T=1.0, + debug=False, + force=False, + in_file=File.sample(), + invert=False, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_tsfvalidate.py b/pydra/tasks/mrtrix3/v3_1/tests/test_tsfvalidate.py new file mode 100644 index 0000000..8d89454 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_tsfvalidate.py @@ -0,0 +1,20 @@ +# Auto-generated test for tsfvalidate + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import TsfValidate + + +@pytest.mark.xfail +def test_tsfvalidate(tmp_path, cli_parse_only): + + task = TsfValidate( + debug=False, + force=False, + tracks=File.sample(), + tsf=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_vectorstats.py b/pydra/tasks/mrtrix3/v3_1/tests/test_vectorstats.py new file mode 100644 index 0000000..21d548e --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_vectorstats.py @@ -0,0 +1,33 @@ +# Auto-generated test for vectorstats + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import VectorStats + + +@pytest.mark.xfail +def test_vectorstats(tmp_path, cli_parse_only): + + task = VectorStats( + column=None, + contrast=File.sample(), + debug=False, + design=File.sample(), + errors=None, + exchange_whole=None, + exchange_within=None, + fonly=False, + force=False, + ftests=None, + in_file=File.sample(), + notest=False, + nshuffles=None, + output="a-string", + permutations=None, + strong=False, + variance=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_voxel2fixel.py b/pydra/tasks/mrtrix3/v3_1/tests/test_voxel2fixel.py new file mode 100644 index 0000000..4213188 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_voxel2fixel.py @@ -0,0 +1,23 @@ +# Auto-generated test for voxel2fixel + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Voxel2Fixel + + +@pytest.mark.xfail(reason="Job voxel2fixel is known not pass yet") +@pytest.mark.xfail +def test_voxel2fixel(tmp_path, cli_parse_only): + + task = Voxel2Fixel( + debug=False, + fixel_data_out="a-string", + fixel_directory_in=File.sample(), + fixel_directory_out="a-string", + force=False, + image_in=Nifti1.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_voxel2mesh.py b/pydra/tasks/mrtrix3/v3_1/tests/test_voxel2mesh.py new file mode 100644 index 0000000..fd8f196 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_voxel2mesh.py @@ -0,0 +1,22 @@ +# Auto-generated test for voxel2mesh + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Voxel2Mesh + + +@pytest.mark.xfail +def test_voxel2mesh(tmp_path, cli_parse_only): + + task = Voxel2Mesh( + blocky=False, + debug=False, + force=False, + in_file=Nifti1.sample(), + threshold=None, + out_file=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_warp2metric.py b/pydra/tasks/mrtrix3/v3_1/tests/test_warp2metric.py new file mode 100644 index 0000000..c902fad --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_warp2metric.py @@ -0,0 +1,22 @@ +# Auto-generated test for warp2metric + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import Warp2Metric + + +@pytest.mark.xfail +def test_warp2metric(tmp_path, cli_parse_only): + + task = Warp2Metric( + debug=False, + fc=None, + force=False, + in_=Nifti1.sample(), + jdet=None, + jmat=None, + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_warpconvert.py b/pydra/tasks/mrtrix3/v3_1/tests/test_warpconvert.py new file mode 100644 index 0000000..5583736 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_warpconvert.py @@ -0,0 +1,24 @@ +# Auto-generated test for warpconvert + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import WarpConvert + + +@pytest.mark.xfail +def test_warpconvert(tmp_path, cli_parse_only): + + task = WarpConvert( + debug=False, + force=False, + from_=None, + in_=Nifti1.sample(), + midway_space=False, + template=None, + type="deformation2displacement", + out=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_warpcorrect.py b/pydra/tasks/mrtrix3/v3_1/tests/test_warpcorrect.py new file mode 100644 index 0000000..35a8841 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_warpcorrect.py @@ -0,0 +1,22 @@ +# Auto-generated test for warpcorrect + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import WarpCorrect + + +@pytest.mark.xfail +def test_warpcorrect(tmp_path, cli_parse_only): + + task = WarpCorrect( + debug=False, + force=False, + in_=Nifti1.sample(), + marker=None, + tolerance=None, + out=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_warpinit.py b/pydra/tasks/mrtrix3/v3_1/tests/test_warpinit.py new file mode 100644 index 0000000..52d8a7e --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_warpinit.py @@ -0,0 +1,20 @@ +# Auto-generated test for warpinit + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import WarpInit + + +@pytest.mark.xfail +def test_warpinit(tmp_path, cli_parse_only): + + task = WarpInit( + debug=False, + force=False, + template=Nifti1.sample(), + warp=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/tests/test_warpinvert.py b/pydra/tasks/mrtrix3/v3_1/tests/test_warpinvert.py new file mode 100644 index 0000000..967d05f --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tests/test_warpinvert.py @@ -0,0 +1,23 @@ +# Auto-generated test for warpinvert + +import pytest +from fileformats.generic import File, Directory, FsObject # noqa +from fileformats.medimage import Nifti1 # noqa +from fileformats.medimage_mrtrix3 import ImageFormat, ImageIn, Tracks # noqa +from pydra.tasks.mrtrix3.v3_1 import WarpInvert + + +@pytest.mark.xfail(reason="Job warpinvert is known not pass yet") +@pytest.mark.xfail +def test_warpinvert(tmp_path, cli_parse_only): + + task = WarpInvert( + debug=False, + displacement=False, + force=False, + in_=Nifti1.sample(), + template=None, + out=File.sample(), + ) + result = task(worker="debug") + assert not result.errored diff --git a/pydra/tasks/mrtrix3/v3_1/transformcalc.py b/pydra/tasks/mrtrix3/v3_1/transformcalc.py new file mode 100644 index 0000000..b88be61 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/transformcalc.py @@ -0,0 +1,164 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class TransformCalc(shell.Task["TransformCalc.Outputs"]): + """ + Example usages + -------------- + + + Invert a transformation: + + `$ transformcalc matrix_in.txt invert matrix_out.txt` + + + + Calculate the matrix square root of the input transformation (halfway transformation): + + `$ transformcalc matrix_in.txt half matrix_out.txt` + + + + Calculate the rigid component of an affine input transformation: + + `$ transformcalc affine_in.txt rigid rigid_out.txt` + + + + Calculate the transformation matrix from an original image and an image with modified header: + + `$ transformcalc orig_image modified_image header output` + + + + Calculate the average affine matrix of a set of input matrices: + + `$ transformcalc input1.txt ... inputN.txt average matrix_out.txt` + + + + Create interpolated transformation matrix between two inputs: + + `$ transformcalc input1.txt input2.txt interpolate matrix_out.txt` + + Based on matrix decomposition with linear interpolation of translation, rotation and stretch described in: Shoemake, K., Hill, M., & Duff, T. (1992). Matrix Animation and Polar Decomposition. Matrix, 92, 258-264. doi:10.1.1.56.1336 + + + Decompose transformation matrix M into translation, rotation and stretch and shear (M = T * R * S): + + `$ transformcalc matrix_in.txt decompose matrixes_out.txt` + + The output is a key-value text file containing: scaling: vector of 3 scaling factors in x, y, z direction; shear: list of shear factors for xy, xz, yz axes; angles: list of Euler angles about static x, y, z axes in radians in the range [0:pi]x[-pi:pi]x[-pi:pi]; angle_axis: angle in radians and rotation axis; translation: translation vector along x, y, z axes in mm; R: composed roation matrix (R = rot_x * rot_y * rot_z); S: composed scaling and shear matrix + + + Calculate transformation that aligns two images based on sets of corresponding landmarks: + + `$ transformcalc input moving.txt fixed.txt align_vertices_rigid rigid.txt` + + Similary, 'align_vertices_rigid_scale' produces an affine matrix (rigid and global scale). Vertex coordinates are in scanner space, corresponding vertices must be stored in the same row of moving.txt and fixed.txt. Requires 3 or more vertices in each file. Algorithm: Kabsch 'A solution for the best rotation to relate two sets of vectors' DOI:10.1107/S0567739476001873 + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Max Pietsch (maximilian.pietsch@kcl.ac.uk) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "transformcalc" + + # Arguments + inputs: MultiInputObj[ty.Any] = shell.arg( + argstr="", + position=1, + help="""the input(s) for the specified operation""", + ) + operation: str = shell.arg( + argstr="", + position=2, + help="""the operation to perform; one of: invert, half, rigid, header, average, interpolate, decompose, align_vertices_rigid, align_vertices_rigid_scale (see description section for details).""", + allowed_values=[ + "invert", + "half", + "rigid", + "header", + "average", + "interpolate", + "decompose", + "align_vertices_rigid", + "align_vertices_rigid_scale", + ], + ) + + # Options + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: File = shell.outarg( + argstr="", + position=3, + path_template="out_file.txt", + help="""the output transformation matrix.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/transformcompose.py b/pydra/tasks/mrtrix3/v3_1/transformcompose.py new file mode 100644 index 0000000..7fbbe79 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/transformcompose.py @@ -0,0 +1,104 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class TransformCompose(shell.Task["TransformCompose.Outputs"]): + """Any linear transforms must be supplied as a 4x4 matrix in a text file (e.g. as per the output of mrregister). Any warp fields must be supplied as a 4D image representing a deformation field (e.g. as output from mrrregister -nl_warp). + + Input transformations should be provided to the command in the order in which they would be applied to an image if they were to be applied individually. + + If all input transformations are linear, and the -template option is not provided, then the file output by the command will also be a linear transformation saved as a 4x4 matrix in a text file. If a template image is supplied, then the output will always be a deformation field. If at least one of the inputs is a warp field, then the output will be a deformation field, which will be defined on the grid of the last input warp image supplied if the -template option is not used. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "transformcompose" + + # Arguments + in_file: MultiInputObj[File] = shell.arg( + argstr="", + position=1, + help="""the input transforms (either linear or non-linear warps).""", + ) + output: ty.Any = shell.arg( + argstr="", + position=2, + help="""the output file (may be a linear transformation text file, or a deformation warp field image, depending on usage)""", + ) + + # Options + template: ImageIn | None = shell.arg( + default=None, + argstr="-template", + help="""define the output grid defined by a template image""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + pass diff --git a/pydra/tasks/mrtrix3/v3_1/transformconvert.py b/pydra/tasks/mrtrix3/v3_1/transformconvert.py new file mode 100644 index 0000000..1ab1a5f --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/transformconvert.py @@ -0,0 +1,118 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class TransformConvert(shell.Task["TransformConvert.Outputs"]): + """This command allows to convert transformation matrices provided by other registration softwares to a format usable in MRtrix3. Example usages are provided below. + + + Example usages + -------------- + + + Convert a transformation matrix produced by FSL's flirt command into a format usable by MRtrix3: + + `$ transformconvert transform_flirt.mat flirt_in.nii flirt_ref.nii flirt_import transform_mrtrix.txt` + + The two images provided as inputs for this operation must be in the correct order: first the image that was provided to flirt via the -in option, second the image that was provided to flirt via the -ref option. + + + Convert a plain text transformation matrix file produced by ITK's affine registration (e.g. ANTS, Slicer) into a format usable by MRtrix3: + + `$ transformconvert transform_itk.txt itk_import transform_mrtrix.txt` + + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Max Pietsch (maximilian.pietsch@kcl.ac.uk) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "transformconvert" + + # Arguments + input: MultiInputObj[ty.Any] = shell.arg( + argstr="", + position=1, + help="""the input(s) for the specified operation""", + ) + operation: str = shell.arg( + argstr="", + position=2, + help="""the operation to perform; one of: flirt_import, itk_import""", + allowed_values=["flirt_import", "itk_import"], + ) + + # Options + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: File = shell.outarg( + argstr="", + position=3, + path_template="out_file.txt", + help="""the output transformation matrix.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/tsfdivide.py b/pydra/tasks/mrtrix3/v3_1/tsfdivide.py new file mode 100644 index 0000000..6c53a1d --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tsfdivide.py @@ -0,0 +1,98 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class TsfDivide(shell.Task["TsfDivide.Outputs"]): + """ + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "tsfdivide" + + # Arguments + input1: File = shell.arg( + argstr="", + position=1, + help="""the first input track scalar file.""", + ) + input2: File = shell.arg( + argstr="", + position=2, + help="""the second input track scalar file.""", + ) + + # Options + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: File = shell.outarg( + argstr="", + position=3, + path_template="out_file.txt", + help="""the output track scalar file""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/tsfinfo.py b/pydra/tasks/mrtrix3/v3_1/tsfinfo.py new file mode 100644 index 0000000..6e3b7e2 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tsfinfo.py @@ -0,0 +1,98 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class TsfInfo(shell.Task["TsfInfo.Outputs"]): + """ + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "tsfinfo" + + # Arguments + tracks: MultiInputObj[File] = shell.arg( + argstr="", + position=1, + help="""the input track scalar file.""", + ) + + # Options + count: bool = shell.arg( + default=False, + argstr="-count", + help="""count number of tracks in file explicitly, ignoring the header""", + ) + ascii: str | None = shell.arg( + default=None, + argstr="-ascii", + help="""save values of each track scalar file in individual ascii files, with the specified prefix.""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + pass diff --git a/pydra/tasks/mrtrix3/v3_1/tsfmult.py b/pydra/tasks/mrtrix3/v3_1/tsfmult.py new file mode 100644 index 0000000..525fd2a --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tsfmult.py @@ -0,0 +1,98 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class TsfMult(shell.Task["TsfMult.Outputs"]): + """ + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "tsfmult" + + # Arguments + input1: File = shell.arg( + argstr="", + position=1, + help="""the first input track scalar file.""", + ) + input1: File = shell.arg( + argstr="", + position=2, + help="""the second input track scalar file.""", + ) + + # Options + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: File = shell.outarg( + argstr="", + position=3, + path_template="out_file.txt", + help="""the output track scalar file""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/tsfsmooth.py b/pydra/tasks/mrtrix3/v3_1/tsfsmooth.py new file mode 100644 index 0000000..d9ebf75 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tsfsmooth.py @@ -0,0 +1,98 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class TsfSmooth(shell.Task["TsfSmooth.Outputs"]): + """ + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "tsfsmooth" + + # Arguments + in_file: File = shell.arg( + argstr="", + position=1, + help="""the input track scalar file.""", + ) + + # Options + stdev: float | None = shell.arg( + default=None, + argstr="-stdev", + help="""apply Gaussian smoothing with the specified standard deviation. The standard deviation is defined in units of track points (default: 4)""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: File = shell.outarg( + argstr="", + position=2, + path_template="out_file.txt", + help="""the output track scalar file""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/tsfthreshold.py b/pydra/tasks/mrtrix3/v3_1/tsfthreshold.py new file mode 100644 index 0000000..1d3587e --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tsfthreshold.py @@ -0,0 +1,103 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class TsfThreshold(shell.Task["TsfThreshold.Outputs"]): + """ + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "tsfthreshold" + + # Arguments + in_file: File = shell.arg( + argstr="", + position=1, + help="""the input track scalar file.""", + ) + T: float = shell.arg( + argstr="", + position=2, + help="""the desired threshold""", + ) + + # Options + invert: bool = shell.arg( + default=False, + argstr="-invert", + help="""invert the output mask""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: File = shell.outarg( + argstr="", + position=3, + path_template="out_file.txt", + help="""the binary output track scalar file""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/tsfvalidate.py b/pydra/tasks/mrtrix3/v3_1/tsfvalidate.py new file mode 100644 index 0000000..e700fdc --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/tsfvalidate.py @@ -0,0 +1,93 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class TsfValidate(shell.Task["TsfValidate.Outputs"]): + """ + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "tsfvalidate" + + # Arguments + tsf: File = shell.arg( + argstr="", + position=1, + help="""the input track scalar file""", + ) + tracks: File = shell.arg( + argstr="", + position=2, + help="""the track file on which the TSF is based""", + ) + + # Options + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + pass diff --git a/pydra/tasks/mrtrix3/v3_1/vectorstats.py b/pydra/tasks/mrtrix3/v3_1/vectorstats.py new file mode 100644 index 0000000..d5d0982 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/vectorstats.py @@ -0,0 +1,167 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class VectorStats(shell.Task["VectorStats.Outputs"]): + """This command can be used to perform permutation testing of any form of data. The data for each input subject must be stored in a text file, with one value per row. The data for each row across subjects will be tested independently, i.e. there is no statistical enhancement that occurs between the data; however family-wise error control will be used. + + In some software packages, a column of ones is automatically added to the GLM design matrix; the purpose of this column is to estimate the "global intercept", which is the predicted value of the observed variable if all explanatory variables were to be zero. However there are rare situations where including such a column would not be appropriate for a particular experimental design. Hence, in MRtrix3 statistical inference commands, it is up to the user to determine whether or not this column of ones should be included in their design matrix, and add it explicitly if necessary. The contrast matrix must also reflect the presence of this additional column. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "vectorstats" + + # Arguments + in_file: File = shell.arg( + argstr="", + position=1, + help="""a text file listing the file names of the input subject data""", + ) + design: File = shell.arg( + argstr="", + position=2, + help="""the design matrix""", + ) + contrast: File = shell.arg( + argstr="", + position=3, + help="""the contrast matrix""", + ) + output: str = shell.arg( + argstr="", + position=4, + help="""the filename prefix for all output""", + ) + + # Options + + # Options relating to shuffling of data for nonparametric statistical inference: + notest: bool = shell.arg( + default=False, + argstr="-notest", + help="""don't perform statistical inference; only output population statistics (effect size, stdev etc)""", + ) + errors: str | None = shell.arg( + default=None, + argstr="-errors", + help="""specify nature of errors for shuffling; options are: ee,ise,both (default: ee)""", + allowed_values=["ee", "ise", "both"], + ) + exchange_within: File | None = shell.arg( + default=None, + argstr="-exchange_within", + help="""specify blocks of observations within each of which data may undergo restricted exchange""", + ) + exchange_whole: File | None = shell.arg( + default=None, + argstr="-exchange_whole", + help="""specify blocks of observations that may be exchanged with one another (for independent and symmetric errors, sign-flipping will occur block-wise)""", + ) + strong: bool = shell.arg( + default=False, + argstr="-strong", + help="""use strong familywise error control across multiple hypotheses""", + ) + nshuffles: int | None = shell.arg( + default=None, + argstr="-nshuffles", + help="""the number of shuffles (default: 5000)""", + ) + permutations: File | None = shell.arg( + default=None, + argstr="-permutations", + help="""manually define the permutations (relabelling). The input should be a text file defining a m x n matrix, where each relabelling is defined as a column vector of size m, and the number of columns n defines the number of permutations. Can be generated with the palm_quickperms function in PALM (http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/PALM). Overrides the -nshuffles option.""", + ) + + # Options related to the General Linear Model (GLM): + variance: File | None = shell.arg( + default=None, + argstr="-variance", + help="""define variance groups for the G-statistic; measurements for which the expected variance is equivalent should contain the same index""", + ) + ftests: File | None = shell.arg( + default=None, + argstr="-ftests", + help="""perform F-tests; input text file should contain, for each F-test, a row containing ones and zeros, where ones indicate the rows of the contrast matrix to be included in the F-test.""", + ) + fonly: bool = shell.arg( + default=False, + argstr="-fonly", + help="""only assess F-tests; do not perform statistical inference on entries in the contrast matrix""", + ) + column: MultiInputObj[File] | None = shell.arg( + default=None, + argstr="-column", + help="""add a column to the design matrix corresponding to subject element-wise values (note that the contrast matrix must include an additional column for each use of this option); the text file provided via this option should contain a file name for each subject""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + pass diff --git a/pydra/tasks/mrtrix3/v3_1/voxel2fixel.py b/pydra/tasks/mrtrix3/v3_1/voxel2fixel.py new file mode 100644 index 0000000..5e73fa1 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/voxel2fixel.py @@ -0,0 +1,108 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Voxel2Fixel(shell.Task["Voxel2Fixel.Outputs"]): + """This command is designed to enable CFE-based statistical analysis to be performed on voxel-wise measures. + + Fixel data are stored utilising the fixel directory format described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/fixel_based_analysis/fixel_directory_format.html + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "voxel2fixel" + + # Arguments + image_in: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input image.""", + ) + fixel_directory_in: Directory = shell.arg( + argstr="", + position=2, + help="""the input fixel directory; used to define the fixels and their directions""", + ) + fixel_directory_out: str = shell.arg( + argstr="", + position=3, + help="""the fixel directory where the output will be written; this can be the same as the input directory if desired""", + ) + fixel_data_out: str = shell.arg( + argstr="", + position=4, + help="""the name of the fixel data image.""", + ) + + # Options + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + pass diff --git a/pydra/tasks/mrtrix3/v3_1/voxel2mesh.py b/pydra/tasks/mrtrix3/v3_1/voxel2mesh.py new file mode 100644 index 0000000..aae9ba4 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/voxel2mesh.py @@ -0,0 +1,107 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Voxel2Mesh(shell.Task["Voxel2Mesh.Outputs"]): + """This command utilises the Marching Cubes algorithm to generate a polygonal surface that represents the isocontour(s) of the input image at a particular intensity. By default, an appropriate threshold will be determined automatically from the input image, however the intensity value of the isocontour(s) can instead be set manually using the -threhsold option. + + If the -blocky option is used, then the Marching Cubes algorithm will not be used. Instead, the input image will be interpreted as a binary mask image, and polygonal surfaces will be generated at the outer faces of the voxel clusters within the mask. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "voxel2mesh" + + # Arguments + in_file: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input image.""", + ) + + # Options + blocky: bool = shell.arg( + default=False, + argstr="-blocky", + help="""generate a 'blocky' mesh that precisely represents the voxel edges""", + ) + threshold: float | None = shell.arg( + default=None, + argstr="-threshold", + help="""manually set the intensity threshold for the Marching Cubes algorithm""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out_file: File = shell.outarg( + argstr="", + position=2, + path_template="out_file.txt", + help="""the output mesh file.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/warp2metric.py b/pydra/tasks/mrtrix3/v3_1/warp2metric.py new file mode 100644 index 0000000..395e11a --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/warp2metric.py @@ -0,0 +1,110 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class Warp2Metric(shell.Task["Warp2Metric.Outputs"]): + """Fixel data are stored utilising the fixel directory format described in the main documentation, which can be found at the following link: + https://mrtrix.readthedocs.io/en/3.0.4/fixel_based_analysis/fixel_directory_format.html + + + References + ---------- + + Raffelt, D.; Tournier, JD/; Smith, RE.; Vaughan, DN.; Jackson, G.; Ridgway, GR. Connelly, A. Investigating White Matter Fibre Density and Morphology using Fixel-Based Analysis. Neuroimage, 2017, 144, 58-73. doi: 10.1016/j.neuroimage.2016.09.029 + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "warp2metric" + + # Arguments + in_: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input deformation field""", + ) + + # Options + fc: tuple[ImageIn, ImageIn, ImageIn] | None = shell.arg( + default=None, + argstr="-fc", + help="""use an input template fixel image to define fibre orientations and output a fixel image describing the change in fibre cross-section (FC) in the perpendicular plane to the fixel orientation.""", + sep=" ", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + jmat: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-jmat", + path_template="jmat.mif", + help="""output a Jacobian matrix image stored in column-major order along the 4th dimension. Note the output jacobian describes the warp gradient w.r.t the scanner space coordinate system""", + ) + jdet: ImageOut | bool | None = shell.outarg( + default=None, + argstr="-jdet", + path_template="jdet.mif", + help="""output the Jacobian determinant instead of the full matrix""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/warpconvert.py b/pydra/tasks/mrtrix3/v3_1/warpconvert.py new file mode 100644 index 0000000..debfb07 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/warpconvert.py @@ -0,0 +1,121 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class WarpConvert(shell.Task["WarpConvert.Outputs"]): + """A deformation field is defined as an image where each voxel defines the corresponding position in the other image (in scanner space coordinates). A displacement field stores the displacements (in mm) to the other image from each voxel's position (in scanner space). The warpfull file is the 5D format output from mrregister -nl_warp_full, which contains linear transforms, warps and their inverses that map each image to a midway space. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "warpconvert" + + # Arguments + in_: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input warp image.""", + ) + type: str = shell.arg( + argstr="", + position=2, + help="""the conversion type required; valid choices are: deformation2displacement, displacement2deformation, warpfull2deformation, warpfull2displacement""", + allowed_values=[ + "deformation2displacement", + "displacement2deformation", + "warpfull2deformation", + "warpfull2displacement", + ], + ) + + # Options + template: ImageIn | None = shell.arg( + default=None, + argstr="-template", + help="""define a template image when converting a warpfull file (which is defined on a grid in the midway space between image 1 & 2). For example, to generate the deformation field that maps image1 to image2, then supply image2 as the template image""", + ) + midway_space: bool = shell.arg( + default=False, + argstr="-midway_space", + help="""to be used only with warpfull2deformation and warpfull2displacement conversion types. The output will only contain the non-linear warp to map an input image to the midway space (defined by the warpfull grid). If a linear transform exists in the warpfull file header then it will be composed and included in the output.""", + ) + from_: int | None = shell.arg( + default=None, + argstr="-from", + help="""to be used only with warpfull2deformation and warpfull2displacement conversion types. Used to define the direction of the desired output field. Use -from 1 to obtain the image1->image2 field and from 2 for image2->image1. Can be used in combination with the -midway_space option to produce a field that only maps to midway space.""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out: ImageOut = shell.outarg( + argstr="", + position=3, + path_template="out.mif", + help="""the output warp image.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/warpcorrect.py b/pydra/tasks/mrtrix3/v3_1/warpcorrect.py new file mode 100644 index 0000000..cca429e --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/warpcorrect.py @@ -0,0 +1,106 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class WarpCorrect(shell.Task["WarpCorrect.Outputs"]): + """This can be used in conjunction with the warpinit command to compute a MRtrix compatible deformation field from non-linear transformations generated by any other registration package. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: David Raffelt (david.raffelt@florey.edu.au) and Max Pietsch (mail@maxpietsch.com) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "warpcorrect" + + # Arguments + in_: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input warp image.""", + ) + + # Options + marker: list[float] | None = shell.arg( + default=None, + argstr="-marker", + help="""single value or a comma separated list of values that define out of bounds voxels in the input warp image. Default: (0,0,0).""", + sep=",", + ) + tolerance: float | None = shell.arg( + default=None, + argstr="-tolerance", + help="""numerical precision used for L2 matrix norm comparison. Default: 9.99999975e-06.""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="out.mif", + help="""the output warp image.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/warpinit.py b/pydra/tasks/mrtrix3/v3_1/warpinit.py new file mode 100644 index 0000000..3ebf3b5 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/warpinit.py @@ -0,0 +1,108 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class WarpInit(shell.Task["WarpInit.Outputs"]): + """This is useful to obtain the warp fields from other normalisation applications, by applying the transformation of interest to the warp field generated by this command. + + The image generated is a 4D image with the same spatial characteristics as the input template image. It contains 3 volumes, with each voxel containing its own x,y,z coordinates. + + + Example usages + -------------- + + + Create three separate NIfTI images, for each of X,Y,Z components: + + `$ warpinit template.mif warp-'[]'.nii` + + By utilising the MRtrix multi-file numbering syntax, the command can natively produce three separate images, which may be useful to create images suitable for use in some registration software + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: J-Donald Tournier (jdtournier@gmail.com) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "warpinit" + + # Arguments + template: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input template image.""", + ) + + # Options + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + warp: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="warp.mif", + help="""the output warp image.""", + ) diff --git a/pydra/tasks/mrtrix3/v3_1/warpinvert.py b/pydra/tasks/mrtrix3/v3_1/warpinvert.py new file mode 100644 index 0000000..9c8d7b9 --- /dev/null +++ b/pydra/tasks/mrtrix3/v3_1/warpinvert.py @@ -0,0 +1,105 @@ +# Auto-generated from MRtrix C++ command with '__print_pydra_code__' secret option + +import typing as ty +from pathlib import Path # noqa: F401 +from fileformats.generic import File, Directory # noqa: F401 +from fileformats.medimage_mrtrix3 import ImageIn, ImageOut, Tracks # noqa: F401 +from pydra.compose import shell +from pydra.utils.typing import MultiInputObj + + +@shell.define +class WarpInvert(shell.Task["WarpInvert.Outputs"]): + """By default, this command assumes that the input warp field is a deformation field, i.e. each voxel stores the corresponding position in the other image (in scanner space), and the calculated output warp image will also be a deformation field. If the input warp field is instead a displacment field, i.e. where each voxel stores an offset from which to sample the other image (but still in scanner space), then the -displacement option should be used; the output warp field will additionally be calculated as a displacement field in this case. + + + References + ---------- + + Tournier, J.-D.; Smith, R. E.; Raffelt, D.; Tabbara, R.; Dhollander, T.; Pietsch, M.; Christiaens, D.; Jeurissen, B.; Yeh, C.-H. & Connelly, A. MRtrix3: A fast, flexible and open software framework for medical image processing and visualisation. NeuroImage, 2019, 202, 116137 + + + MRtrix + ------ + + Version:3.0.4-1402-gd28b95cd, built Aug 22 2025 + + Author: Robert E. Smith (robert.smith@florey.edu.au) and David Raffelt (david.raffelt@florey.edu.au) + + Copyright: Copyright (c) 2008-2025 the MRtrix3 contributors. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Covered Software is provided under this License on an "as is" + basis, without warranty of any kind, either expressed, implied, or + statutory, including, without limitation, warranties that the + Covered Software is free of defects, merchantable, fit for a + particular purpose or non-infringing. + See the Mozilla Public License v. 2.0 for more details. + + For more details, see http://www.mrtrix.org/. + """ + + executable = "warpinvert" + + # Arguments + in_: ImageIn = shell.arg( + argstr="", + position=1, + help="""the input warp image.""", + ) + + # Options + template: ImageIn | None = shell.arg( + default=None, + argstr="-template", + help="""define a template image grid for the output warp""", + ) + displacement: bool = shell.arg( + default=False, + argstr="-displacement", + help="""indicates that the input warp field is a displacement field; the output will also be a displacement field""", + ) + + # Standard options + info: bool = shell.arg( + default=False, + argstr="-info", + help="""display information messages.""", + ) + quiet: bool = shell.arg( + default=False, + argstr="-quiet", + help="""do not display information messages or progress status; alternatively, this can be achieved by setting the MRTRIX_QUIET environment variable to a non-empty string.""", + ) + debug: bool = shell.arg( + default=False, + argstr="-debug", + help="""display debugging messages.""", + ) + force: bool = shell.arg( + default=False, + argstr="-force", + help="""force overwrite of output files (caution: using the same file as input and output might cause unexpected behaviour).""", + ) + nthreads: int | None = shell.arg( + default=None, + argstr="-nthreads", + help="""use this number of threads in multi-threaded applications (set to 0 to disable multi-threading).""", + ) + config: MultiInputObj[tuple[str, str]] | None = shell.arg( + default=None, + argstr="-config", + help="""temporarily set the value of an MRtrix config file entry.""", + sep=" ", + ) + + class Outputs(shell.Outputs): + out: ImageOut = shell.outarg( + argstr="", + position=2, + path_template="out.mif", + help="""the output warp image.""", + ) diff --git a/pyproject.toml b/pyproject.toml index 3aaa352..be1ad1b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,15 +3,11 @@ requires = ["hatchling", "hatch-vcs"] build-backend = "hatchling.build" [project] -name = "pydra-mrtrix3" -description = "pydra-mrtrix3 contains Pydra task specifications for MRtrix3 tools" +name = "pydra-tasks-mrtrix3" +description = "pydra-tasks-mrtrix3 contains Pydra task specifications for MRtrix3 tools" readme = "README.rst" -requires-python = ">=3.8" -dependencies = [ - "fileformats-medimage_mrtrix3 >=3.0.4a5", - "numpy", - "pydra >=0.23", -] +requires-python = ">=3.11" +dependencies = ["fileformats-medimage_mrtrix3 >=3.0.4a5", "numpy", "pydra"] license = { file = "LICENSE" } authors = [{ name = "Thomas G. Close", email = "tom.g.close@gmail.com" }] maintainers = [{ name = "Thomas G. Close", email = "tom.g.close@gmail.com" }] @@ -88,3 +84,6 @@ strict = true namespace_packages = true explicit_package_bases = true exclude = ["tests", "scripts", "docs", "build", "dist"] + +[tool.pyright] +reportAssignmentType = false diff --git a/related-packages/fileformats-extras/fileformats/extras/medimage_mrtrix3/converters.py b/related-packages/fileformats-extras/fileformats/extras/medimage_mrtrix3/converters.py index 7015c6f..1cfc522 100644 --- a/related-packages/fileformats-extras/fileformats/extras/medimage_mrtrix3/converters.py +++ b/related-packages/fileformats-extras/fileformats/extras/medimage_mrtrix3/converters.py @@ -1,77 +1,47 @@ -from fileformats.core import converter +import typing as ty +from fileformats.core import converter, FileSet from fileformats.medimage.base import MedicalImage - from fileformats.medimage_mrtrix3 import ( ImageFormat as MrtrixImage, ImageHeader as MrtrixImageHeader, ImageFormatGz as MrtrixImageGz, ) -try: - from pydra.tasks.mrtrix3.v3_0 import MrConvert -except ImportError: - from pydra.tasks.mrtrix3.latest import mrconvert as MrConvert - - in_out_file_kwargs = {"in_file": "input", "out_file": "output"} -else: - in_out_file_kwargs = {} +from pydra.tasks.mrtrix3.v3_0 import MrConvert -@converter( - source_format=MedicalImage, - target_format=MrtrixImageGz, - out_ext=MrtrixImageGz.ext, - **in_out_file_kwargs, -) -@converter( - source_format=MedicalImage, - target_format=MrtrixImageHeader, - out_ext=MrtrixImageHeader.ext, - **in_out_file_kwargs, -) -@converter( - source_format=MedicalImage, - target_format=MrtrixImage, - out_ext=MrtrixImage.ext, - **in_out_file_kwargs, -) -def mrconvert(name, out_ext: str, **kwargs): - """Initiate an MRConvert task with the output file extension set +def out_file_template(fileformat: ty.Type[FileSet]) -> str: + """Return the output file name for a given file format Parameters ---------- - name : str - name of the converter task - out_ext : str - extension of the output file, used by MRConvert to determine the desired format + fileformat : type + the file format class Returns ------- - pydra.ShellCommandTask - the converter task + str + the output file name """ - return MrConvert(name=name, out_file="out" + out_ext, **kwargs) + return "out" + fileformat.ext -# @converter( -# source_format=MedicalImage, -# target_format=MrtrixImageHeader, -# out_ext=MrtrixImageHeader.ext, -# **in_out_file_kwargs, -# ) -# def mrconvert2(name, out_ext: str, **kwargs): -# """Initiate an MRConvert task with the output file extension set +# Register MrConvert as a converter for MrTrix formats -# Parameters -# ---------- -# name : str -# name of the converter task -# out_ext : str -# extension of the output file, used by MRConvert to determine the desired format +converter( + source_format=MedicalImage, + target_format=MrtrixImageGz, + out_file=out_file_template(MrtrixImageGz), +)(MrConvert) -# Returns -# ------- -# pydra.ShellCommandTask -# the converter task -# """ -# return MrConvert(name=name, out_file="out" + out_ext, **kwargs) +converter( + source_format=MedicalImage, + target_format=MrtrixImageHeader, + out_file=out_file_template(MrtrixImageHeader), +)(MrConvert) + +converter( + source_format=MedicalImage, + target_format=MrtrixImage, + out_file=out_file_template(MrtrixImage), +)(MrConvert) diff --git a/related-packages/fileformats-extras/pyproject.toml b/related-packages/fileformats-extras/pyproject.toml index 0ee7929..f4a19a0 100644 --- a/related-packages/fileformats-extras/pyproject.toml +++ b/related-packages/fileformats-extras/pyproject.toml @@ -8,7 +8,8 @@ description = "Classes for representing different file formats in Python classes readme = "README.rst" requires-python = ">=3.8" dependencies = [ - "fileformats >= 0.8", + "fileformats >=0.15a3", + "fileformats-medimage >=0.10.0a", "fileformats-medimage-mrtrix3 >=3.0.4a5", "medimages4tests", "pydra >= 0.23.0", diff --git a/related-packages/fileformats/fileformats/medimage_mrtrix3/in_out.py b/related-packages/fileformats/fileformats/medimage_mrtrix3/in_out.py index 3b1adb4..6005575 100644 --- a/related-packages/fileformats/fileformats/medimage_mrtrix3/in_out.py +++ b/related-packages/fileformats/fileformats/medimage_mrtrix3/in_out.py @@ -34,14 +34,14 @@ ImageIn: TypeAlias = ty.Union[ + DicomImage, + DicomDir, ImageFormat, ImageFormatGz, ImageHeader, ImageFormatB, ImageFormatGzB, ImageHeaderB, - DicomImage, - DicomDir, NiftiGzX, NiftiGz, NiftiX, @@ -51,6 +51,10 @@ NiftiGzB, NiftiGzXB, NiftiXB, + NiftiBvec, + NiftiGzBvec, + NiftiXBvec, + NiftiGzXBvec, Mgh, MghGz, Analyze, diff --git a/related-packages/fileformats/pyproject.toml b/related-packages/fileformats/pyproject.toml index c31e5b3..5d030c6 100644 --- a/related-packages/fileformats/pyproject.toml +++ b/related-packages/fileformats/pyproject.toml @@ -7,21 +7,13 @@ name = "fileformats-medimage-mrtrix3" description = "Classes for representing different file formats in Python classes for use in type hinting in data workflows" readme = "README.rst" requires-python = ">=3.8" -dependencies = [ - "fileformats >= 0.8.5", - "fileformats-medimage >= 0.4.4" -] -license = {file = "LICENSE"} -authors = [ - {name = "Thomas G. Close", email = "tom.g.close@gmail.com"}, -] +dependencies = ["fileformats >=0.15a3", "fileformats-medimage >= 0.10.0a"] +license = { file = "LICENSE" } +authors = [{ name = "Thomas G. Close", email = "tom.g.close@gmail.com" }] maintainers = [ - {name = "Thomas G. Close", email = "tom.g.close@gmail.com"}, + { name = "Thomas G. Close", email = "tom.g.close@gmail.com" }, ] # Ideally this would be the generic MRtrix developers authors list, but will leave it as me for now -keywords = [ - "file formats", - "data", -] +keywords = ["file formats", "data"] classifiers = [ "Development Status :: 3 - Alpha", "Environment :: Console", @@ -39,19 +31,8 @@ classifiers = [ dynamic = ["version"] [project.optional-dependencies] -dev = [ - "black", - "pre-commit", - "codespell", - "flake8", - "flake8-pyproject", -] -test = [ - "pytest >=6.2.5", - "pytest-env>=0.6.2", - "pytest-cov>=2.12.1", - "codecov", -] +dev = ["black", "pre-commit", "codespell", "flake8", "flake8-pyproject"] +test = ["pytest >=6.2.5", "pytest-env>=0.6.2", "pytest-cov>=2.12.1", "codecov"] [project.urls] repository = "https://github.com/MRtrix3/mrtrix3" @@ -75,9 +56,7 @@ ignore-words = ".codespell-ignorewords" [tool.flake8] doctests = true -per-file-ignores = [ - "__init__.py:F401" -] +per-file-ignores = ["__init__.py:F401"] max-line-length = 88 select = "C,E,F,W,B,B950" extend-ignore = ['E203', 'E501', 'E129']