|
39 | 39 |
|
40 | 40 | from ... import config
|
41 | 41 | from ...interfaces import DerivativesDataSink
|
| 42 | +from ...utils.misc import estimate_bold_mem_usage |
42 | 43 |
|
43 | 44 | # BOLD workflows
|
44 | 45 | from .apply import init_bold_volumetric_resample_wf
|
@@ -176,7 +177,7 @@ def init_bold_wf(
|
176 | 177 | omp_nthreads = config.nipype.omp_nthreads
|
177 | 178 | all_metadata = [config.execution.layout.get_metadata(file) for file in bold_series]
|
178 | 179 |
|
179 |
| - nvols, mem_gb = _create_mem_gb(bold_file) |
| 180 | + nvols, mem_gb = estimate_bold_mem_usage(bold_file) |
180 | 181 | if nvols <= 5 - config.execution.sloppy:
|
181 | 182 | config.loggers.workflow.warning(
|
182 | 183 | f"Too short BOLD series (<= 5 timepoints). Skipping processing of <{bold_file}>."
|
@@ -683,21 +684,6 @@ def _last(inlist):
|
683 | 684 | return workflow
|
684 | 685 |
|
685 | 686 |
|
686 |
| -def _create_mem_gb(bold_fname): |
687 |
| - img = nb.load(bold_fname) |
688 |
| - nvox = int(np.prod(img.shape, dtype='u8')) |
689 |
| - # Assume tools will coerce to 8-byte floats to be safe |
690 |
| - bold_size_gb = 8 * nvox / (1024**3) |
691 |
| - bold_tlen = 1 if img.ndim < 4 else img.shape[3] |
692 |
| - mem_gb = { |
693 |
| - "filesize": bold_size_gb, |
694 |
| - "resampled": bold_size_gb * 4, |
695 |
| - "largemem": bold_size_gb * (max(bold_tlen / 100, 1.0) + 4), |
696 |
| - } |
697 |
| - |
698 |
| - return bold_tlen, mem_gb |
699 |
| - |
700 |
| - |
701 | 687 | def _get_wf_name(bold_fname, prefix):
|
702 | 688 | """
|
703 | 689 | Derive the workflow name for supplied BOLD file.
|
|
0 commit comments