@@ -14,6 +14,9 @@ This software can be installed via source or via pip from PyPi with `pip install
1414| ---------| ------ |
1515| ` docker build . -t petdeface ` | ![ docker_build] ( https://codebuild.us-east-1.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiYzdXV0tYSkQzTVNkcG04cHA2S055UXlKRlZTU1VONThUMVRoZVcwU3l1aHFhdVBlNDNaRGVCYzdWM1Q0WjYzQ1lRU2ZTSHpmSERPWFRkVXVyb3k3RTZBPSIsIml2UGFyYW1ldGVyU3BlYyI6IjRCZFFIQnNGT2lKcDA1VG4iLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=main ) |
1616| ` docker push ` | ![ docker push icon] ( https://codebuild.us-east-1.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoia0c1bEJYUGI2SXlWYi9JMm1tcGtiYWVTdVd3bmlnOUFaTjN4QjJITU5PTVpvQnN3TlowajhxNmhHY2RwQ2Z5SU93OExqc2xvMzFnTHFvajlqVk1MV2FzPSIsIml2UGFyYW1ldGVyU3BlYyI6Ikl6SzRyc1RabzBnSkplTjciLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=main ) |
17+ | ` Python 3.14 >= 3.10 ` | [ ![ Check Python Compatibility] ( https://github.com/openneuropet/petdeface/actions/workflows/check_python_compatibility.yaml/badge.svg )] ( https://github.com/openneuropet/petdeface/actions/workflows/check_python_compatibility.yaml ) |
18+ | ` packaging ` | [ ![ Publish to PyPI] ( https://github.com/openneuropet/petdeface/actions/workflows/publish_to_pypi.yaml/badge.svg )] ( https://github.com/openneuropet/petdeface/actions/workflows/publish_to_pypi.yaml ) |
19+ | ` Docs ` | ![ RTD BADGE] ( https://app.readthedocs.org/projects/petdeface/badge/?version=latest&style=default ) |
1720
1821## Requirements
1922
@@ -36,9 +39,9 @@ This software can be installed via source or via pip from PyPi with `pip install
3639
3740``` bash
3841usage: petdeface.py [-h] [--anat_only] [--participant_label PARTICIPANT_LABEL [PARTICIPANT_LABEL ...]] [--docker] [--singularity] [--n_procs N_PROCS]
39- [--skip_bids_validator] [--version] [--placement PLACEMENT] [--remove_existing] [--preview_pics]
42+ [--skip_bids_validator] [--version] [--placement PLACEMENT] [--remove_existing]
4043 [--participant_label_exclude participant_label_exclude [participant_label_exclude ...]] [--session_label SESSION [SESSION ...]]
41- [--session_label_exclude session_label_exclude [session_label_exclude ...]]
44+ [--session_label_exclude session_label_exclude [session_label_exclude ...]] [--open_browser]
4245 bids_dir [output_dir] [analysis_level]
4346
4447PetDeface
@@ -63,15 +66,18 @@ options:
6366 Where to place the defaced images. Options are ' adjacent' : next to the bids_dir (default) in a folder appended with _defaced' inplace' :
6467 defaces the dataset in place, e.g. replaces faced PET and T1w images w/ defaced at bids_dir' derivatives' : does all of the defacing within
6568 the derivatives folder in bids_dir.
66- --remove_existing, -r
67- Remove existing output files in output_dir.
68- --preview_pics Create preview pictures of defacing, defaults to false for docker
69+ --remove_existing, -r Remove existing output files in output_dir.
70+ --preview_pics Create preview pictures of defacing, defaults to false for docker (only works if FreeView is installed on machine)
6971 --participant_label_exclude participant_label_exclude [participant_label_exclude ...]
7072 Exclude a subject(s) from the defacing workflow. e.g. --participant_label_exclude sub-01 sub-02
7173 --session_label SESSION [SESSION ...]
7274 Select only a specific session(s) to include in the defacing workflow
7375 --session_label_exclude session_label_exclude [session_label_exclude ...]
7476 Select a specific session(s) to exclude from the defacing workflow
77+ --use_template_anat Use template anatomical image when no T1w is available for PET scans.
78+ Options: ' t1' (included T1w template), ' mni' (MNI template), or ' pet'
79+ (averaged PET image).
80+ --open_browser Open browser to show QA reports after completion
7581```
7682
7783Working example usage:
@@ -80,6 +86,26 @@ Working example usage:
8086petdeface /inputfolder /outputfolder --n_procs 16 --skip_bids_validator --placement adjacent
8187```
8288
89+ ### Template Anatomical Images
90+
91+ When PET scans lack corresponding T1w anatomical images, PETdeface can use template anatomical images for registration and defacing. Three options are available:
92+
93+ - **`--use_template_anat t1`**: Uses a T1w template included with the PETdeface library
94+ - **`--use_template_anat mni`**: Uses the MNI standard brain template
95+ - **`--use_template_anat pet`**: Creates a template by averaging the PET data across time
96+
97+ **Important**: When using template anatomical images, it' s crucial to validate the defacing quality. Inspect the output using the generated HTML report (with ` --open_browser` ) or a NIfTI viewer to ensure the defacing is valid for your data.
98+
99+ ** Recommended workflow for subjects missing T1w images** :
100+ 1. First, exclude subjects missing T1w using ` --participant_label_exclude`
101+ 2. Run defacing on subjects with T1w images
102+ 3. Then run defacing separately on subjects missing T1w using ` --participant_label` and test different templates (` t1` , ` mni` , ` pet` ) to determine which works best for your data
103+
104+ Example usage with template anatomical:
105+ ` ` ` bash
106+ petdeface /inputfolder /outputfolder --use_template_anat t1 --n_procs 16
107+ ` ` `
108+
83109# ## Docker Usage
84110
85111Requirements:
@@ -138,12 +164,27 @@ trouble running this container in singularity/apptainer.
138164
139165## Development
140166
141- This project uses poetry to package and build, to create a pip installable version of the package run:
167+ This project supports both [UV](https://github.com/astral-sh/uv) and standard Python (pip + build) workflows for development and packaging.
168+
169+ ### Using UV (recommended for speed)
170+
171+ ```bash
172+ git clone https://github.com/openneuropet/petdeface.git
173+ cd petdeface
174+ uv build
175+ pip install dist/petdeface-<X.X.X>-py3-none-any.whl # where X.X.X is the version number of the generated file
176+ ```
177+
178+ ### Using pip and python (no UV required)
142179
143180```bash
144181git clone https://github.com/openneuropet/petdeface.git
145182cd petdeface
146- poetry build
183+ pip install --upgrade pip
184+ pip install .[dev]
185+ # To build a wheel or sdist:
186+ pip install build
187+ python -m build
147188pip install dist/petdeface-<X.X.X>-py3-none-any.whl # where X.X.X is the version number of the generated file
148189```
149190
0 commit comments