Skip to content

Commit

Permalink
Remove sdcflows and model ASLPrep on fMRIPrep/next (#338)
Browse files Browse the repository at this point in the history
* Try this.

* keep working.

* Update plotting.py

* Update base.py

* Update base.py

* Update.

* Update plotting.py

* Update plotting.py

* fix.

* Update plotting.py

* Update plotting.py

* Update plotting.py

* Update.

* Update cbf.py

* Update cbf.py

* Update cbf.py

* Update cbf.py

* Set Infs to 0.

The Philips M0 scan has values of zero for some in-mask voxels, which, when used to calculate CBF, results in Infs.

* Try just using standard ASL preproc pipeline.

* Try that.

* Update tests.py

* Update outputs.py

* Update base.py

* Update base.py

* More work.

* More work.

* More work.

* Update utility.py

* More work.

* Run black and isort.

* Update.

* Update.

* More work.

* Update.

* Fix.

* Update gecbf.py

* Update.

* Update misc.py

* Update fit.py

* Update.

* Update.

* Fix?

* Update fit.py

* Update fit.py

* Update fit.py

* Update reference.py

* Update reference.py

* Update fit.py

* Update fit.py

* Whoops!

* Update fit.py

* Update fit.py

* Update fit.py

* Update fit.py

* Update fit.py

* Lots of changes.

* Update config.py

* Update base.py

* Update base.py

* Update base.py

* Update base.py

* Update.

* Update base.py

* Update.

* Update.

* Update base.py

* Update confounds.py

* Update.

* Update base.py

* Update.

* Update confounds.py

* Update.

* Update.

* Update.

* Update workflows.rst

* Update fit.py

* Use new fMRIPrep!

* Update.

* Update.

* update.

* Update reference.py

* Update.

* Fix some things.

* Fix many things.

* Try 3.10.

* Update.

* Bump build Docker image version.

* Update.

* Update lint.yml

* Update.

* Update run.py

* Update test_cli.py

* Update test_cli.py

* Update parser.py

* Update parser.py

* Update parser.py

* Update parser.py

* Update.

* Update base.py

* Update base.py

* Update fit.py

* Update fit.py

* Update base.py

* Update qc.py

* Update apply.py

* Update base.py

* Update reference.py

* Update base.py

* Update base.py

* Fix connections.

* Make ApplyTransforms calls verbose.

* Fix ApplyTransforms calls.

* Try that.

* Update.

* Try fixing m0scan_native.

* Try that then.

* Try that then.

* Update cbf.py

* Update test_cli.py

* Update aslprep_bids_config.json

* Update test_cli.py

* Write out native-space derivatives.

* Update outputs.py

* Update expected outputs.

* Update base.py

* Update expected outputs.

* Update.

* Parcellate data no matter what.

* More cleanup.

* Try adding numpy to build requirements.

* Run isort.

* Update __init__.py

* Deal with style issues.

* Add precomputed (will be empty).

* Ignore unused parameter.

* Try fixing install.

* precomputed is a dictionary.

* Outsource more workflows to fmriprep.

* Try to implement functional cache.

* Update BASIL output names.

* Update base.py

* Update hmc.py

* Update bids.py

* Remove GE workflows.

* Try to fix GE HMC.

* Whoops!

* Run isort.

* Update hmc.py

* Update hmc.py

* Update expected outputs.

* Write out QC file.

* Update utility.py

* Add outputnode back in.

* Try to debug motion params more.

* Support single-volume motion parameters.

* Add source to docstring.

* Keep cleaning up GE processing.

* Set confounds min volumes to 2.

* Update confounds.py

* Make QC calculations flexible.

* Remove unused import.

* Remove unused data files.

* Write out QC file correctly.

* Rename QC json filename.

* Add confounds to GE outputs.

* Drop unused functions and classes.

* Try fixing tests.

* Use GenericLabel instead of MultiLabel.

* Use fMRIPrep's resampling interfaces.

* Remove unnecessary comment.

* Outsource more workflows to fMRIPrep.

* Update expected_outputs_test_002.txt

* Update expected outputs.

* Update expected_outputs_test_001.txt

* Don't use FixHeadersApplyTransforms.

* Fix some connections in fit.

* Add checks.

* Fix logger name.

* Retain niftis for now.

* Override DDS for some workflow calls.

* Disable aslref-space outputs unless requested

Copies nipreps/fmriprep#3159.

* Pass FLAIR images to anatomical workflow builder

Copied from nipreps/fmriprep#3146.

* Tag memory estimates in resamplers

Copied from nipreps/fmriprep#3150.

* Use M0 scan for reference for GE data.

* Try to fix transform name.

* Add reference image smoothing step.

* Give smoothing output a BIDS-ish name.

* Update fit.py

* Remove unused modules.

* Pin sMRIPrep version.

* Reduce mask.

* Squeeze masks before merging.

* Fix module name.

* Drop niftis from test outputs.

* Update workflows.rst

* Improve documentation.

* Update api.rst

* Update workflows.rst

* Update citations.

* More documentation improvements.

* Remove dropped coverage files from expected outputs.

* Update license and output docs.

* Fix issues with CIFTI connections.

* Update base Docker image.

The new version has MSM.

* Add level testing jobs.

* Update expected outputs.

* Try fixing more issues.

* Draft workflow to produce CIFTI CBF maps.

* Keep working on CIFTI CBF workflow.

* Keep working on CIFTI CBF workflow.

* Add reference images.

* Update outputs.py

* Address multiple bugs with GIFTI outputs.

* Try outputting fsaverage.

* Add docstrings.

* Ignore unused argument.

* Update tests.

* Fix!

* Update test_002 cache (it was already v3).

* Update.

* Update test_cli.py

* Update config.yml

* Update config.yml

* Fix things.

* Update test_cli.py

* Update config.yml

* Combine QC and confounds modules.

* Remove unused functions/interfaces.

* Remove another unused function.

* Remove unused interface function.

* Bump anatomical test data version.

* Fix import.

* Update expected outputs.

* Create expected_outputs_qtab.txt

* Grab MNI152NLin2009cAsym xfm for resampling.

* Update expected outputs.

* Add topup to boilerplate BibTeX file.

* Revert some changes.

* Update expected outputs.

* Move asl_anat_wf from resampling to full.

* Try outputting CIFTI for one test.

* Add updated fsLR workflow from fMRIPrep.

* Update resampling.py

* Speed up test_003.

* Use internal version of init_bold_surf_wf.

* Fix style issues.

* Remove unused script.

* Fix typos.

* Drop CIFTI test and sort expected outputs.
  • Loading branch information
tsalo committed Dec 6, 2023
1 parent 10fc6ba commit 8c80d31
Show file tree
Hide file tree
Showing 116 changed files with 9,632 additions and 12,022 deletions.
290 changes: 252 additions & 38 deletions .circleci/config.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
os: ['ubuntu-latest']
python-version: [3.8]
python-version: ['3.10']

steps:
- uses: actions/checkout@v2
Expand Down
68 changes: 22 additions & 46 deletions .maint/update_authors.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ def read_md_table(md_text):
retval = []
for line in md_text.splitlines():
if line.strip().startswith("| --- |"):
keys = (
k.replace("*", "").strip()
for k in prev.split("|")
)
keys = (k.replace("*", "").strip() for k in prev.split("|"))
keys = [k.lower() for k in keys if k]
continue
elif not keys:
Expand All @@ -61,19 +58,13 @@ def sort_contributors(entries, git_lines, exclude=None, last=None):
last = last or []
sorted_authors = sorted(entries, key=lambda i: i["name"])

first_last = [
" ".join(val["name"].split(",")[::-1]).strip() for val in sorted_authors
]
first_last_excl = [
" ".join(val["name"].split(",")[::-1]).strip() for val in exclude or []
]
first_last = [" ".join(val["name"].split(",")[::-1]).strip() for val in sorted_authors]
first_last_excl = [" ".join(val["name"].split(",")[::-1]).strip() for val in exclude or []]

unmatched = []
author_matches = []
for ele in git_lines:
matches = process.extract(
ele, first_last, scorer=fuzz.token_sort_ratio, limit=2
)
matches = process.extract(ele, first_last, scorer=fuzz.token_sort_ratio, limit=2)
# matches is a list [('First match', % Match), ('Second match', % Match)]
if matches[0][1] > 80:
val = sorted_authors[first_last.index(matches[0][0])]
Expand Down Expand Up @@ -153,8 +144,9 @@ def cli():
@cli.command()
@click.option("-z", "--zenodo-file", type=click.Path(exists=True), default=".zenodo.json")
@click.option("-m", "--maintainers", type=click.Path(exists=True), default=".maint/MAINTAINERS.md")
@click.option("-c", "--contributors", type=click.Path(exists=True),
default=".maint/CONTRIBUTORS.md")
@click.option(
"-c", "--contributors", type=click.Path(exists=True), default=".maint/CONTRIBUTORS.md"
)
@click.option("--pi", type=click.Path(exists=True), default=".maint/PIs.md")
@click.option("-f", "--former-file", type=click.Path(exists=True), default=".maint/FORMER.md")
def zenodo(
Expand All @@ -177,15 +169,13 @@ def zenodo(
)

zen_contributors, miss_contributors = sort_contributors(
_namelast(read_md_table(Path(contributors).read_text())),
data,
exclude=former
_namelast(read_md_table(Path(contributors).read_text())), data, exclude=former
)

zen_pi = _namelast(
sorted(
read_md_table(Path(pi).read_text()),
key=lambda v: (int(v.get("position", -1)), v.get("lastname"))
key=lambda v: (int(v.get("position", -1)), v.get("lastname")),
)
)

Expand All @@ -195,8 +185,7 @@ def zenodo(
misses = set(miss_creators).intersection(miss_contributors)
if misses:
print(
"Some people made commits, but are missing in .maint/ "
f"files: {', '.join(misses)}",
"Some people made commits, but are missing in .maint/ " f"files: {', '.join(misses)}",
file=sys.stderr,
)

Expand All @@ -215,15 +204,14 @@ def zenodo(
if isinstance(creator["affiliation"], list):
creator["affiliation"] = creator["affiliation"][0]

Path(zenodo_file).write_text(
"%s\n" % json.dumps(zenodo, indent=2)
)
Path(zenodo_file).write_text("%s\n" % json.dumps(zenodo, indent=2))


@cli.command()
@click.option("-m", "--maintainers", type=click.Path(exists=True), default=".maint/MAINTAINERS.md")
@click.option("-c", "--contributors", type=click.Path(exists=True),
default=".maint/CONTRIBUTORS.md")
@click.option(
"-c", "--contributors", type=click.Path(exists=True), default=".maint/CONTRIBUTORS.md"
)
@click.option("--pi", type=click.Path(exists=True), default=".maint/PIs.md")
@click.option("-f", "--former-file", type=click.Path(exists=True), default=".maint/FORMER.md")
def publication(
Expand All @@ -233,9 +221,8 @@ def publication(
former_file,
):
"""Generate the list of authors and affiliations for papers."""
members = (
_namelast(read_md_table(Path(maintainers).read_text()))
+ _namelast(read_md_table(Path(contributors).read_text()))
members = _namelast(read_md_table(Path(maintainers).read_text())) + _namelast(
read_md_table(Path(contributors).read_text())
)

hits, misses = sort_contributors(
Expand All @@ -247,15 +234,12 @@ def publication(
pi_hits = _namelast(
sorted(
read_md_table(Path(pi).read_text()),
key=lambda v: (int(v.get("position", -1)), v.get("lastname"))
key=lambda v: (int(v.get("position", -1)), v.get("lastname")),
)
)

pi_names = [pi["name"] for pi in pi_hits]
hits = [
hit for hit in hits
if hit["name"] not in pi_names
] + pi_hits
hits = [hit for hit in hits if hit["name"] not in pi_names] + pi_hits

def _aslist(value):
if isinstance(value, (list, tuple)):
Expand All @@ -282,30 +266,22 @@ def _aslist(value):

if misses:
print(
"Some people made commits, but are missing in .maint/ "
f"files: {', '.join(misses)}",
"Some people made commits, but are missing in .maint/ " f"files: {', '.join(misses)}",
file=sys.stderr,
)

print("Authors (%d):" % len(hits))
print(
"%s."
% "; ".join(
[
"%s \\ :sup:`%s`\\ " % (i["name"], idx)
for i, idx in zip(hits, aff_indexes)
]
)
% "; ".join(["%s \\ :sup:`%s`\\ " % (i["name"], idx) for i, idx in zip(hits, aff_indexes)])
)

print(
"\n\nAffiliations:\n%s"
% "\n".join(
["{0: >2}. {1}".format(i + 1, a) for i, a in enumerate(affiliations)]
)
% "\n".join(["{0: >2}. {1}".format(i + 1, a) for i, a in enumerate(affiliations)])
)


if __name__ == "__main__":
""" Install entry-point """
"""Install entry-point"""
cli()
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build:
apt_packages:
- graphviz
tools:
python: "3.9"
python: "3.10"

sphinx:
configuration: docs/conf.py
Expand Down
2 changes: 0 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@
"[python]": {
"editor.rulers": [99]
},
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"python.analysis.typeCheckingMode": "off",
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM pennlinc/aslprep_build:0.0.4
FROM pennlinc/aslprep_build:0.0.7

# Install aslprep
COPY . /src/aslprep
Expand Down
Loading

0 comments on commit 8c80d31

Please sign in to comment.