A neuroimaging workflow library that builds upon Nipype's interfaces
Project description
PyNipe
A neuroimaging workflow library that builds upon Nipype's excellent interfaces while providing a more intuitive and debuggable execution model with support for parallel execution.
Overview
PyNipe enables neuroimaging researchers to create processing pipelines using natural Python flow, making development and debugging significantly easier while maintaining the ability to run tasks in parallel.
Key Features
- Reuse Nipype interfaces: Leverage the mature interface implementations from Nipype
- Natural Python flow: Enable standard Python control structures (if/else, loops, etc.)
- Improved debugging: Make it easy to see what's happening at each step
- Modular processing: Build pipelines from reusable processing functions
- Parallel execution: Support concurrent execution of independent tasks
- Delayed execution: Configure tasks first, execute later through the executor
- Automatic dependency tracking: Dependencies between tasks are automatically tracked
- Integration with pipeline tools: Support modern pipeline management tools like Airflow
Installation
pip install pynipe
Basic Usage
from nipype.interfaces import fsl
from pynipe import TaskContext, Workflow, LocalExecutor
# Define a processing function
def process_subject(subject_id, anat_file, output_dir):
# Brain extraction task
with TaskContext("Brain Extraction") as ctx:
# Create and configure the interface
bet = fsl.BET()
ctx.set_interface(bet)
# Configure the interface parameters
ctx.configure_interface(
in_file=anat_file,
out_file=f"{output_dir}/{subject_id}_brain.nii.gz",
mask=True,
frac=0.3
)
# Get output proxies for later use
outputs = ctx.get_output_proxy()
brain_file = outputs.outputs.out_file
mask_file = outputs.outputs.mask_file
return {
"brain": brain_file,
"mask": mask_file
}
# Create a workflow
workflow = Workflow("Simple Pipeline")
# Add processing for a subject
workflow.add_function(
process_subject,
inputs={
"subject_id": "sub-01",
"anat_file": "/path/to/sub-01/anat.nii.gz",
"output_dir": "/path/to/output"
}
)
# Run the workflow with parallel execution
executor = LocalExecutor(max_workers=2)
results = workflow.run(executor=executor)
# Access task information after execution
for task_name, task_outputs in results["tasks"].items():
task = workflow.get_task_by_name(task_name)
if task:
print(f"Task: {task_name}")
print(f"Status: {task.status}")
print(f"Execution time: {task.elapsed_time:.2f}s")
print(f"Command: {task.command}")
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pynipe-0.1.0.tar.gz.
File metadata
- Download URL: pynipe-0.1.0.tar.gz
- Upload date:
- Size: 113.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5150d9ef09a7a7be0bcc02a5040eb9701c56536aecb3d4ee6e08c3cf6181d64
|
|
| MD5 |
a495e65278d90eddea85466767c7ff5a
|
|
| BLAKE2b-256 |
49e0d2a2132fb3becf21a66c7ed25afa51f7b481fa9c267b463499a889f30487
|
Provenance
The following attestation bundles were made for pynipe-0.1.0.tar.gz:
Publisher:
workflow.yml on vanandrew/pynipe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pynipe-0.1.0.tar.gz -
Subject digest:
f5150d9ef09a7a7be0bcc02a5040eb9701c56536aecb3d4ee6e08c3cf6181d64 - Sigstore transparency entry: 201211095
- Sigstore integration time:
-
Permalink:
vanandrew/pynipe@889fb4b7c79a89c30b0f8c3be640d4ca6eef9be2 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/vanandrew
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@889fb4b7c79a89c30b0f8c3be640d4ca6eef9be2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pynipe-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pynipe-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10f6d8aeaa567f20cb66d6aa2c46f362022d490f117bc59c09c18c831a0113d5
|
|
| MD5 |
cbed77f26e20a6828c73bae9ef6f7560
|
|
| BLAKE2b-256 |
91e6391264d5d0eee35f3ace8e7aa04a96d22790afa0c501c010e2895641d1bc
|
Provenance
The following attestation bundles were made for pynipe-0.1.0-py3-none-any.whl:
Publisher:
workflow.yml on vanandrew/pynipe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pynipe-0.1.0-py3-none-any.whl -
Subject digest:
10f6d8aeaa567f20cb66d6aa2c46f362022d490f117bc59c09c18c831a0113d5 - Sigstore transparency entry: 201211096
- Sigstore integration time:
-
Permalink:
vanandrew/pynipe@889fb4b7c79a89c30b0f8c3be640d4ca6eef9be2 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/vanandrew
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@889fb4b7c79a89c30b0f8c3be640d4ca6eef9be2 -
Trigger Event:
release
-
Statement type: