Skip to main content

pydra-tasks-freesurfer

PyPI - Version PyPI - Python Version PyPI - Downloads Status-docs Status-CICD


Pydra tasks for FreeSurfer.

Pydra is a dataflow engine which provides a set of lightweight abstractions for DAG construction, manipulation, and distributed execution.

FreeSurfer is a neuroimaging toolkit for processing, analyzing, and visualizing human brain MR images.

This project exposes some of FreeSurfer's utilities as Pydra tasks to facilitate their integration into more advanced processing workflows.

Table of contents

Tested interfaces

Module Interfaces
gtmseg GTMSeg
mri Aparc2Aseg, Binarize, Convert, Coreg, Label2Vol, RobustRegister, RobustTemplate, Surf2Surf, Vol2Vol
mris AnatomicalStats, CALabel, CATrain, Expand, Preproc
recon_all ReconAll, BaseReconAll, LongReconAll

Installation

pip install pydra-tasks-freesurfer

A separate installation of FreeSurfer is required to use this package. Please review the following instructions and licensing details.

Automatic Conversion

Automatically generated tasks can be found in the pydra.tasks.freesurfer.auto sub-package. These interfaces should be treated with caution as they likely do not pass testing. Generated tasks that have been edited and pass testing will be imported into one or more of the pydra.tasks.freesurfer.v* sub-packages (e.g. pydra.tasks.freesurfer.v7_4) corresponding to the version of the freesurfer toolkit they are designed for.

Continuous integration

This template uses GitHub Actions to run tests and deploy packages to PYPI. New packages are built and uploaded when releases are created on GitHub, or new releases of Nipype or the Nipype2Pydra conversion tool are released. Releases triggered by updates to Nipype or Nipype2Pydra are signified by the postN suffix where N = <nipype-version><nipype2pydra-version> with the '.'s stripped, e.g. v0.2.3post185010 corresponds to the v0.2.3 tag of this repository with auto-generated packages from Nipype 1.8.5 using Nipype2Pydra 0.1.0.

Development

Methodology

The development of this package is expected to have two phases

  1. Where the corresponding Nipype interfaces are considered to be the ground truth, and the Pydra tasks are generated from them
  2. When the Pydra tasks are considered be mature and they are edited by hand

Different tasks will probably mature at different times so there will probably be an intermediate phase between 1 and 2.

Developer installation

Before the pydra task interfaces can be generated and installed, the file-format classes fileformats packages corresponding to Freesurfer specific file formats will need to be installed

pip install -e ./related-packages/fileformats[dev]
pip install -e ./related-packages/fileformats-extras[dev]

Next install the requirements for running the auto-conversion script and generate the Pydra task interfaces from their Nipype counterparts

pip install -r nipype-auto-conv/requirements.txt

The run the conversion script to convert Nipype interfaces to Pydra

nipype-auto-conv/generate

Install repo in developer mode from the source directory and install pre-commit to ensure consistent code-style and quality.

pip install -e .[test,dev]
pre-commit install

Auto-conversion phase

The auto-converted Pydra tasks are generated from their corresponding Nipype interface in combination with "conversion hints" contained in YAML specs located in nipype-auto-conv/specs/. The self-documented conversion specs are to be edited by hand in order to assist the auto-converter produce valid pydra tasks. After editing one or more conversion specs the pydra.tasks.freesurfer.auto package should be regenerated by running

nipype-auto-conv/generate

The tests should be run on the auto-generated tasks to see if they are valid

pytest pydra/tasks/freesurfer/auto/tests/test_<the-name-of-the-task-you-edited>.py

If the test passes you should then edit the pydra/tasks/freesurfer/v*/__init__.py file to import the auto-generated task interface to signify that it has been validated and is ready for use, where v* corresponds to the version of Freesurfer that you have tested it against e.g.

from pydra.tasks.freesurfer.auto import <the-task-you-have-validated>

and copy the test file pydra/tasks/freesurfer/auto/tests/test_<validated-task>.py into pydra/tasks/freesurfer/v*/tests.

File-formats and sample test data

The automatically generated tests will attempt to provided the task instance to be tested with sensible default values based on the type of the field and any constraints it has on it. However, these will often need to be manually overridden after consulting the underlying tool's documentation.

For file-based data, automatically generated file-system objects will be created for selected format types, e.g. Nifti, Dicom. Therefore, it is important to specify the format of the file using the "mime-like" string corresponding to a fileformats class in the inputs > types and outputs > types dicts of the YAML spec.

If the required file-type is not found implemented within fileformats, please see the fileformats docs [https://arcanaframework.github.io/fileformats/developer.html] for instructions on how to define new fileformat types, and see fileformats-medimage-extras for an example on how to implement methods to generate sample data for them. Implementations of new fileformats that are specific to Freesurfer, and functions to generate sample data for them, should be defined in related-packages/fileformats and related-packages/fileformats-extras, respectively.

Licensing

This project is distributed under the terms of the Apache License, Version 2.0.

Metadata

Release files for pydra-tasks-freesurfer 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydra-tasks-freesurfer 0.3.1
File Size Uploaded
pydra_tasks_freesurfer-0.3.1.tar.gz 90.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pydra-tasks-freesurfer 0.3.1
File Interpreter ABI Platform
pydra_tasks_freesurfer-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 262.7 kB

Release files / pydra_tasks_freesurfer-0.3.1.tar.gz

Download URL pydra_tasks_freesurfer-0.3.1.tar.gz
Size 90.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ea57570f00323d465536da58c6fb9a4f6e62ffae46fbef8966cac279d180ab6d
BLAKE2b-256 checksum
How to use checksums
eef4c9cd7803f21136add4232d75ee0f9c0924e99e3045f50e51d2597b11997b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Release files / pydra_tasks_freesurfer-0.3.1-py3-none-any.whl

Download URL pydra_tasks_freesurfer-0.3.1-py3-none-any.whl
Size 172.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
32ab75f7cc92c7a3ecde48a6cc873bfe40681e0c1ae1aecd78126260f46cc60f
BLAKE2b-256 checksum
How to use checksums
f89a0c2d349857c8f48d535dc7e8153db2ed55ed830b3375a16b780f1db140e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page