Skip to content

Commit

Permalink
Merge branch 'dev-v2.0.0' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
jordandekraker authored Dec 12, 2024
2 parents 9fd29d1 + f1e90ab commit 4d7c299
Show file tree
Hide file tree
Showing 33 changed files with 1,864 additions and 878 deletions.
28 changes: 14 additions & 14 deletions .dryrun_test_all.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/bin/bash
set -euxo pipefail
HIPPUNFOLD_CACHE_DIR=`pwd`/test_data/fake_models
hippunfold test_data/bids_singleT2w test_out participant -np --modality T2w
hippunfold test_data/bids_singleT2w test_out participant -np --modality T2w --hemi R
hippunfold test_data/bids_singleT2w test_out participant -np --modality T2w --hemi L
hippunfold test_data/bids_multiT2w test_out participant -np --modality T2w
hippunfold test_data/bids_T1w test_out participant -np --modality T1w
hippunfold test_data/bids_hippb500 test_out participant -np --modality hippb500
hippunfold test_data/bids_T1w_longitudinal test_out participant -np --modality T1w
hippunfold test_data/bids_singleT2w_longitudinal test_out participant -np --modality T2w
hippunfold test_data/bids_segT2w test_out participant -np --modality segT2w
hippunfold . test_out participant -np --modality cropseg --path_cropseg test_data/data_cropseg/sub-{subject}_hemi-{hemi}_dseg.nii.gz
hippunfold . test_out participant -np --modality cropseg --path_cropseg test_data/data_cropseg_1hemi/sub-{subject}_hemi-{hemi}_dseg.nii.gz --hemi L
hippunfold test_data/bids_singleT2w test_out participant -np --modality T2w --t1_reg_template
hippunfold test_data/bids_singleT2w test_out participant -np --modality T2w --output_space T1w
hippunfold test_data/bids_T1w test_out participant -np --modality T1w --use-template-seg
hippunfold test_data/bids_singleT2w test_out participant -np --modality T2w
hippunfold test_data/bids_singleT2w test_out participant -np --modality T2w --hemi R
hippunfold test_data/bids_singleT2w test_out participant -np --modality T2w --hemi L
hippunfold test_data/bids_multiT2w test_out participant -np --modality T2w
hippunfold test_data/bids_T1w test_out participant -np --modality T1w
hippunfold test_data/bids_hippb500 test_out participant -np --modality hippb500
hippunfold test_data/bids_T1w_longitudinal test_out participant -np --modality T1w
hippunfold test_data/bids_singleT2w_longitudinal test_out participant -np --modality T2w
hippunfold test_data/bids_segT2w test_out participant -np --modality segT2w
hippunfold . test_out participant -np --modality cropseg --path_cropseg test_data/data_cropseg/sub-{subject}_hemi-{hemi}_dseg.nii.gz
hippunfold . test_out participant -np --modality cropseg --path_cropseg test_data/data_cropseg_1hemi/sub-{subject}_hemi-{hemi}_dseg.nii.gz --hemi L
hippunfold test_data/bids_singleT2w test_out participant -np --modality T2w --t1_reg_template
hippunfold test_data/bids_singleT2w test_out participant -np --modality T2w --output_space T1w
hippunfold test_data/bids_T1w test_out participant -np --modality T1w --use-template-seg
163 changes: 160 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,160 @@
hippunfold.egg-info
hippunfold/.snakemake
hippunfold/__pycache__
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
35 changes: 25 additions & 10 deletions hippunfold/config/snakebids.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ debug: False

derivatives: False #will search in bids/derivatives if True; can also be path(s) to derivatives datasets


#list of analysis levels in the bids app
analysis_levels: &analysis_levels
- participant
Expand All @@ -35,8 +36,8 @@ pybids_inputs:
suffix: 'T2w'
extension: '.nii.gz'
datatype: 'anat'
invalid_filters: 'allow'
space: null
# invalid_filters: 'allow'
# space: null
wildcards:
- subject
- session
Expand All @@ -58,8 +59,8 @@ pybids_inputs:
suffix: 'T1w'
extension: '.nii.gz'
datatype: 'anat'
invalid_filters: 'allow'
space: null
# invalid_filters: 'allow'
# space: null
wildcards:
- subject
- session
Expand All @@ -75,6 +76,8 @@ pybids_inputs:
wildcards:
- subject
- session
- acquisition
- run

cropseg:
filters:
Expand All @@ -86,6 +89,9 @@ pybids_inputs:
- subject
- session
- hemi
- acquisition
- run




Expand Down Expand Up @@ -178,17 +184,11 @@ parse_args:
help: 'Scales the default smoothing sigma for gradient and warp in greedy registration for template-based segmentation. Using a value higher than 1 will use result in a smoother warp. (default: %(default)s)'
default: 2.0


--derivatives:
help: 'Path to the derivatives folder (e.g. for finding manual segs) (default: %(default)s) '
default: False

--skip_preproc:
help: 'Set this flag if your inputs (e.g. T2w, dwi) are already pre-processed (default: %(default)s)'
default: False
action: 'store_true'


--skip_coreg:
help: 'Set this flag if your inputs (e.g. T2w, dwi) are already registered to T1w space (default: %(default)s)'
default: False
Expand Down Expand Up @@ -330,6 +330,20 @@ parse_args:
- synthseg_v0.2
- neonateT1w_v2

--enable-bids-validation:
help: |
Enable validation of BIDS dataset. BIDS validation would be performed
using the bids-validator plugin (if installed/enabled) or with the pybids
validator implementation (if bids-validator is not installed/enabled).
dest: "plugins.validator.skip"
action: "store_false"
default: True


--version:
help: 'Print the version of HippUnfold'
action: version
version: "1.5.2-pre.2"



Expand Down Expand Up @@ -700,6 +714,7 @@ output_density:

laminar_coords_method: equivolume
skip_preproc: False
plugins.validator.skip: False
nnunet_enable_tta: False
use_gpu: False
skip_coreg: False
Expand Down
25 changes: 13 additions & 12 deletions hippunfold/pipeline_description.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"Name": "Snakemake BIDS app for hippocampal unfolding & subfield segmentation",
"BIDSVersion": "1.4.0",
"DatasetType": "derivative",
"GeneratedBy": [
{
"Name": "hippunfold",
"Version": "1.5.2-pre.2",
"CodeURL": "https://github.com/khanlab/hippunfold",
"Author": "Jordan DeKraker & Ali Khan",
"AuthorEmail": "[email protected]"
}
]

"Name": "Snakemake BIDS app for hippocampal unfolding & subfield segmentation",
"BIDSVersion": "1.8.0",
"DatasetType": "derivative",
"GeneratedBy": [
{
"Name": "hippunfold",
"Version": "1.5.4",
"CodeURL": "https://github.com/khanlab/hippunfold",
"Author": "Jordan DeKraker & Ali Khan",
"AuthorEmail": "[email protected]"
}
]
}
33 changes: 18 additions & 15 deletions hippunfold/run.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
#!/usr/bin/env python3
import os
from pathlib import Path

from snakebids.app import SnakeBidsApp
from snakebids.cli import add_dynamic_args
from snakebids import bidsapp, plugins

if "__file__" not in globals():
__file__ = "../hippunfold/run.py"

def get_parser():
"""Exposes parser for sphinx doc generation, cwd is the docs dir"""
app = SnakeBidsApp("../hippunfold")
add_dynamic_args(app.parser, app.config["parse_args"], app.config["pybids_inputs"])
return app.parser

app = bidsapp.app(
[
plugins.SnakemakeBidsApp(Path(__file__).resolve().parent),
plugins.BidsValidator(),
plugins.Version(distribution="hippunfold"),
plugins.CliConfig("parse_args"),
plugins.ComponentEdit("pybids_inputs"),
]
)


def main():
app = SnakeBidsApp(
os.path.abspath(os.path.dirname(__file__)),
configfile_path="config/snakebids.yml",
)
app.run_snakemake()
def get_parser():
"""Exposes parser for sphinx doc generation, cwd is the docs dir."""
return app.build_parser().parser


if __name__ == "__main__":
main()
app.run()
Loading

0 comments on commit 4d7c299

Please sign in to comment.