Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: separate anatomical and functional reports per session for densely sampled dataset #3191

Merged
merged 30 commits into from
Jan 31, 2024

Conversation

celprov
Copy link
Contributor

@celprov celprov commented Dec 21, 2023

enh: beyond a certain number of session for a single subject (4), we separate the anatomical report from the functional and we separate the functional reports per session. For fewer sessions than 4, we keep the original behavior of aggregating all sessions and the anatomical in one report.

enh: find the suitable bootstrapfile within generate_reports rather than before

enh: add session_list argument to generate_reports

Builds on top of #3177

Closes #3080

Copy link

codecov bot commented Dec 21, 2023

Codecov Report

Attention: 11 lines in your changes are missing coverage. Please review.

Comparison is base (4d21c37) 71.90% compared to head (7884e58) 72.60%.

Files Patch % Lines
fmriprep/reports/core.py 76.31% 9 Missing ⚠️
fmriprep/cli/run.py 0.00% 1 Missing ⚠️
fmriprep/cli/workflow.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3191      +/-   ##
==========================================
+ Coverage   71.90%   72.60%   +0.69%     
==========================================
  Files          55       56       +1     
  Lines        4161     4241      +80     
==========================================
+ Hits         2992     3079      +87     
+ Misses       1169     1162       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@celprov
Copy link
Contributor Author

celprov commented Jan 19, 2024

@oesteban @effigies I merged #3177 into this PR. Please review it. Thank you!

fmriprep/reports/core.py Outdated Show resolved Hide resolved
fmriprep/cli/parser.py Outdated Show resolved Hide resolved
fmriprep/cli/parser.py Outdated Show resolved Hide resolved
fmriprep/reports/core.py Outdated Show resolved Hide resolved
fmriprep/cli/run.py Outdated Show resolved Hide resolved
fmriprep/cli/workflow.py Outdated Show resolved Hide resolved
fmriprep/reports/core.py Outdated Show resolved Hide resolved
fmriprep/reports/core.py Outdated Show resolved Hide resolved
fmriprep/reports/core.py Outdated Show resolved Hide resolved
fix: turn the subject into a list if it is inputted as a string
… the name of the html reports

enh: add test to verify that the reports get separated above max-ses-agr and that otherwise we retain the old behavior
enh: add test to verify that the implementation above is not disrupted by adding a crash file in the subject folder
…session, the full boilerplate (describing both anatomical and functional preprocessing) is appended only in the anatomical report.

enh: report errors in the visual report. Similarly to the boilerplate, in case of report separation, all errors are reported only in the anatomical report.
fix: delete misplaced test files
…n the report.

enh: add test to check that the boilerplate has been incorporated in the reports.
fix: condense all the tests in one implementation
@celprov celprov force-pushed the enh/sep_anat_func_report branch 3 times, most recently from 4182c9e to 3249c18 Compare January 30, 2024 13:34
@celprov
Copy link
Contributor Author

celprov commented Jan 30, 2024

I don't know what to do about the "Check fmriprep" test, because if I run python -m black --color fmriprep locally, it does make any changes. Additionally, I tried applying those changes by hand, but it keeps complaining about the same lines requesting the same change again (in a vicious loop ^^').

PS the lines it complains about are not in the file I have changed for this PR

Copy link
Member

@oesteban oesteban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very quick lookthrough

fmriprep/cli/parser.py Outdated Show resolved Hide resolved
fmriprep/cli/run.py Outdated Show resolved Hide resolved
fmriprep/cli/parser.py Show resolved Hide resolved
fmriprep/data/reports-spec-anat.yml Outdated Show resolved Hide resolved
fmriprep/data/reports-spec-anat.yml Outdated Show resolved Hide resolved
fmriprep/data/reports-spec.yml Outdated Show resolved Hide resolved
fmriprep/data/reports-spec.yml Outdated Show resolved Hide resolved
@oesteban
Copy link
Member

oesteban commented Jan 30, 2024 via email

Co-authored-by: Oscar Esteban <code@oscaresteban.es>
Copy link
Member

@effigies effigies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fmriprep/data/reports-spec-anat.yml Outdated Show resolved Hide resolved
fmriprep/data/reports-spec.yml Outdated Show resolved Hide resolved
fmriprep/cli/run.py Outdated Show resolved Hide resolved
fmriprep/cli/workflow.py Outdated Show resolved Hide resolved
Copy link
Member

@effigies effigies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outputs look good to me.

I pushed a few additional changes.

  1. I emptied out the SVG files to avoid cluttering the repository. We don't care about these contents, so we don't need git to track these. We'll need to squash to prevent the commits that do contain these from staying in the repository long-term.
  2. In general, we want to avoid using __file__, as that puts constraints on installers. In some cases, an installer may want to keep the package zipped, and __file__ is not zip-safe. The fmriprep.data.load object lets us have Path-like objects when we need to read things and actual Paths when we need files that definitely exist on the filesystem. See https://www.nipreps.org/niworkflows/master/api/niworkflows.data.html for the API.
  3. I used a tmp_path fixture to allow us to avoid writing into the package directory and delete files at the end.

LMK what you think, but I think this should be good to merge if the tests pass.

@effigies
Copy link
Member

Going to go ahead and get this in, re-update the style PR, and we can address any concerns with my last-second hacks in a separate PR.

Thanks for all your effort on this!

@effigies effigies merged commit f3e95d9 into nipreps:master Jan 31, 2024
17 checks passed
@celprov
Copy link
Contributor Author

celprov commented Feb 1, 2024

Thank you @effigies for your help finalizing it! I'm happy this one is out of the door :)

tsalo pushed a commit to tsalo/fmriprep that referenced this pull request Feb 29, 2024
…ly sampled dataset (nipreps#3191)

enh: beyond a certain number of session for a single subject (4), we
separate the anatomical report from the functional and we separate the
functional reports per session. For fewer sessions than 4, we keep the
original behavior of aggregating all sessions and the anatomical in one
report.

enh: find the suitable bootstrapfile within generate_reports rather than
before

enh: add session_list argument to generate_reports

Builds on top of nipreps#3177

Closes nipreps#3080

---------

Co-authored-by: Oscar Esteban <code@oscaresteban.es>
Co-authored-by: Chris Markiewicz <markiewicz@stanford.edu>
effigies added a commit that referenced this pull request Jun 17, 2024
24.0.0 (June 17, 2024)

New feature release in the 24.0.x series.

This release is an incremental improvement on 23.2.x, with some
fixes for bugs discovered in the updated workflow.

New features include separation of HTML reports by session for subjects
with many BOLD runs, a new ``--fs-no-resume`` option to improve interoperability
with less typical FreeSurfer directories, such as those generated by longitudinal
FreeSurfer or FastSurfer, and adoption of DatasetLinks and BIDS-URIs, to follow
the recommendations of recent versions of BIDS.

With thanks to Dimitri Papadopoulos, Basile Pinsard, Celine Provins, Taylor Salo
and Wang Hao-Ting for their contributions!

* FIX: Add "double" type to allowed DisplacementFieldTransform (#3287)
* FIX: Require recent templateflow, select correct aparc dseg.tsv (#3256)
* FIX: Ensure proper templates are retrieved with sloppy (#3251)
* FIX: Delete summary from functional report when separated by sessions (#3223)
* FIX: Support lists in bids filter file containing ``null`` or ``*`` (#3215)
* FIX: Re-enable anat fasttrack for dataset without t1w (#3202)
* ENH: Use BIDSURI in init_ds_boldmask_wf (#3297)
* ENH: Add templateflow to DatasetLinks (#3267)
* ENH: Track proximal sources of functional GIFTIs (#3263)
* ENH: Support named derivative paths (#3264)
* ENH: Track Sources for standard-space outputs (#3262)
* ENH: Add --fs-no-resume option to reuse existing FreeSurfer outputs without resuming (#3142)
* ENH: Use BIDS URIs to track Sources in sidecars (#3255)
* ENH: Ignore unselected subjects in BIDSLayoutIndexer (#3236)
* ENH: Add metadata for motion parameters (#3245)
* ENH: Separate anatomical and functional reports per session for densely sampled dataset (#3191)
* ENH: Leverage T2w if available for BOLD -> anat coregistration (#3208)
* RF: Fix ITK warp conversion to nitransforms format (#3300)
* RF: Load report assembler from nireports (#3177)
* DOC: Clarify ``--dvars-spike-threshold`` uses standardized DVARS (#3205)
* TST: Update test to reflect new report generation behavior (#3210)
* STY: Manual conversions to f-strings (#3241)
* STY: Apply ruff/pyupgrade rule UP031 (#3280)
* STY: Lint and style check full repository (#3221)
* STY: Adopt ruff for linting and formatting (#3206)
* MNT: Pin libitk 5.3 and note dependencies (#3298)
* MNT: Upgrade ruff pre-commit, add fixing checks (#3283)
* MNT: Complete transition from flake8/black to ruff (#3279)
* MNT: Apply Repo-Review suggestions (#3194)
* MNT: Verbatim copy of Apache license 2.0 (#3259)
* MNT: Bump cryptography from 41.0.7 to 42.0.4 (#3234)
* MNT: Drop copyright year, unused dunder fields (#3247)
* MNT: Update environment pins (#3226)
* MNT: Bump codecov/codecov-action from 3 to 4 (#3219)
* DOCKER: Restore mincinfo binary (#3249)
* CI: Move to new circle machine tags (#3248)
* CI: Avoid ruff warning (#3244)
* CI: Pass ruff tests (#3243)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

One visual report per session for dataset with many sessions for a single subject
3 participants