Hi everyone,
I'm a master's student fairly new to MATLAB and PhysIO, and I've been trying to use the toolbox to extract cardiac (ECG) data from fMRI sessions with the goal of calculating HRV for my subjects. I'm running into an error that affects around 13 out of 90 subjects and I can't figure out what's causing it.
Error message:
Warning: PhysIO failed for <subject_id> <task>:
Unable to perform assignment because the size of the left side is N-by-1
and the size of the right side is (N-1)-by-1.
> In project_loop (line 190)
The exact value of N differs per subject (e.g. roughly in the range of 475,000 to 2,074,000 samples), but the pattern is always the same: left side is exactly 1 sample larger than the right side.
Setup:
- Scanner: Siemens
- PhysIO version: R2024a-v9.0.3
- TAPAS version: 6.1.0
- MATLAB: R2024a
- Signal: ECG only (no respiratory data — hence the expected
No respiratory time series provided warnings)
- Sync method:
scan_timing_log using a JSON sidecar file
- I am running a loop over subjects and tasks (two tasks per subject)
Relevant configuration:
Scan timing:
physio.scan_timing.sync.method = 'scan_timing_log';
physio.scan_timing.sqpar.TR = 2.36;
physio.scan_timing.sqpar.Nslices = 48;
physio.scan_timing.sqpar.Ndummies = 0;
physio.scan_timing.sqpar.onset_slice = 1;
Cardiac preprocessing:
physio.preproc.cardiac.modality = 'ECG';
physio.preproc.cardiac.fix_mismatch = true;
physio.preproc.cardiac.fix_mismatch_method = 'round'; % also tried 'truncate'
physio.preproc.cardiac.initial_cpulse_select.method = 'auto_matched';
physio.preproc.cardiac.initial_cpulse_select.max_heart_rate_bpm = 90;
physio.preproc.cardiac.initial_cpulse_select.min = 0.4;
physio.preproc.cardiac.posthoc_cpulse_select.method = 'off';
Log file alignment:
physio.log_files.align_physio = 'scan';
physio.log_files.relative_start_acquisition = 0;
physio.log_files.align_scan = 'first';
What I've already tried:
- Setting
fix_mismatch = true with both fix_mismatch_method = 'truncate' and 'round'; neither resolved the error
- The error is caught by a
try/catch block so the loop continues, but those subjects are fully skipped
- The subjects that fail don't seem to share any obvious characteristics (scan duration, task, etc.) compared to those that succeed
Questions:
- What is most likely causing this 1-sample mismatch for some subjects but not others?
- Why doesn't
fix_mismatch catch this; is the mismatch happening before that logic runs?
- Is there a recommended workaround, or a specific line in the Siemens reader I should patch manually?
Any help would be hugely appreciated! Thanks in advance!
Hi everyone,
I'm a master's student fairly new to MATLAB and PhysIO, and I've been trying to use the toolbox to extract cardiac (ECG) data from fMRI sessions with the goal of calculating HRV for my subjects. I'm running into an error that affects around 13 out of 90 subjects and I can't figure out what's causing it.
Error message:
The exact value of N differs per subject (e.g. roughly in the range of 475,000 to 2,074,000 samples), but the pattern is always the same: left side is exactly 1 sample larger than the right side.
Setup:
No respiratory time series providedwarnings)scan_timing_logusing a JSON sidecar fileRelevant configuration:
Scan timing:
Cardiac preprocessing:
Log file alignment:
What I've already tried:
fix_mismatch = truewith bothfix_mismatch_method = 'truncate'and'round'; neither resolved the errortry/catchblock so the loop continues, but those subjects are fully skippedQuestions:
fix_mismatchcatch this; is the mismatch happening before that logic runs?Any help would be hugely appreciated! Thanks in advance!