File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -160,24 +160,25 @@ def init_raw_boldref_wf(
160
160
def _select_frames (
161
161
in_file : str , ref_frame_start : int , dummy_scans : int | None
162
162
) -> tuple [int , list ]:
163
+ import warnings
164
+
163
165
import nibabel as nb
164
166
import numpy as np
165
167
166
168
img = nb .load (in_file )
167
169
img_len = img .shape [3 ]
168
170
169
- if dummy_scans :
170
- # Ensure start index is the largest of the two
171
- # Will usually be `ref_frame_start`
172
- start_frame = max (ref_frame_start , dummy_scans )
173
- else :
174
- start_frame = ref_frame_start
171
+ # Ensure start index is the largest of the two
172
+ # Will usually be `ref_frame_start`
173
+ start_frame = max (ref_frame_start , dummy_scans ) if dummy_scans else ref_frame_start
175
174
176
175
if start_frame >= img_len :
177
- raise KeyError (
178
- f'Caculating the BOLD reference starting on frame: { start_frame } but not enough BOLD '
179
- f'volumes in { in_file } .'
176
+ warnings .warn (
177
+ f'Caculating the BOLD reference starting on frame { start_frame } but only { img_len } '
178
+ 'volumes in BOLD file, so using last volume.' ,
179
+ stacklevel = 1 ,
180
180
)
181
+ start_frame = img_len - 1
181
182
182
183
t_mask = np .array ([False ] * img_len , dtype = bool )
183
184
t_mask [start_frame :] = True
You can’t perform that action at this time.
0 commit comments