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: Restore resampling to T1w target #3116

Merged
merged 19 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
ENH: Check for bold length before building workflow
  • Loading branch information
effigies committed Oct 17, 2023
commit 9778661b59f45c5e9d3402b2066228ebc97ab143
3 changes: 3 additions & 0 deletions fmriprep/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,9 @@ def init_single_subject_wf(subject_id: str):
precomputed=functional_cache,
fieldmap_id=fieldmap_id,
)
if bold_wf is None:
continue

bold_wf.__desc__ = func_pre_desc + (bold_wf.__desc__ or "")

workflow.connect([
Expand Down
20 changes: 8 additions & 12 deletions fmriprep/workflows/bold/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ def init_bold_wf(
fmriprep_dir = config.execution.fmriprep_dir
omp_nthreads = config.nipype.omp_nthreads

nvols, mem_gb = _create_mem_gb(bold_file)
if nvols <= 5 - config.execution.sloppy:
config.loggers.workflow.warning(
f"Too short BOLD series (<= 5 timepoints). Skipping processing of <{bold_file}>."
)
return

functional_cache = {}
if config.execution.derivatives:
from fmriprep.utils.bids import collect_derivatives, extract_entities
Expand Down Expand Up @@ -454,17 +461,6 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False):
)
from niworkflows.interfaces.utility import KeySelect

img = nb.load(bold_file[0] if isinstance(bold_file, (list, tuple)) else bold_file)
nvols = 1 if img.ndim < 4 else img.shape[3]
if nvols <= 5 - config.execution.sloppy:
config.loggers.workflow.warning(
f"Too short BOLD series (<= 5 timepoints). Skipping processing of <{bold_file}>."
)
return

mem_gb = {"filesize": 1, "resampled": 1, "largemem": 1}
bold_tlen = 10

# Have some options handy
omp_nthreads = config.nipype.omp_nthreads
freesurfer = config.workflow.run_reconall
Expand Down Expand Up @@ -1439,7 +1435,7 @@ def _create_mem_gb(bold_fname):
nvox = int(np.prod(img.shape, dtype='u8'))
# Assume tools will coerce to 8-byte floats to be safe
bold_size_gb = 8 * nvox / (1024**3)
bold_tlen = img.shape[-1]
bold_tlen = 1 if img.ndim < 4 else img.shape[3]
mem_gb = {
"filesize": bold_size_gb,
"resampled": bold_size_gb * 4,
Expand Down