Greetings,
Trying to upsample an fmriprep'ed preproc_bold file before using glmsingle, but I get the following " requested array has an inhomogeneous shape after 1 dimensions". These have have already been slice time corrected, so I guess slicetimes should be shifted by half a TR (given fmriprep STC)?
Nonetheless, the error persists.
import os
import numpy as np
from slicetime.nipype_interface import SliceTime
# get some test data
in_file = '/test/test/bids/derivatives/fmriprep-20.2.7/fmriprep/sub-test/func/sub-test-task_run-5_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz'
# define some parameters
tr_old = 2
tr_new = 1
st = SliceTime()
st.inputs.in_file = in_file
st.inputs.tr_old = tr_old
st.inputs.tr_new = tr_new
st.inputs.out_file = os.path.join('.../tmp', 'test_upsampled.nii.gz')
data_pointer = nib.load(in_file)
data = data_pointer.get_fdata()
x, y, z, n_times = data.shape
slicetimes = np.flip(np.arange(0, tr_old, tr_old/z))
# turn slicetimes into a list
st.inputs.slicetimes = slicetimes.tolist()
res = st.run()
Traceback (most recent call last):
File "", line 1, in
File "/home/xx/anaconda3/envs/spy310/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 397, in run
runtime = self._run_interface(runtime)
File "/home/xx/anaconda3/envs/spy310/lib/python3.10/site-packages/slicetime/nipype_interface.py", line 47, in _run_interface
run_slicetime(
File "/home/xx/anaconda3/envs/spy310/lib/python3.10/site-packages/slicetime/main.py", line 50, in run_slicetime
new_slice_ts = tseriesinterp(this_slice_ts,
File "/home/xx/anaconda3/envs/spy310/lib/python3.10/site-packages/slicetime/tseriesinterp.py", line 104, in tseriesinterp
print("numchunks",numchunks)
File "/home/xx/anaconda3/envs/spy310/lib/python3.10/site-packages/slicetime/tseriesinterp.py", line 260, in chunking
f = []
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (20,) + inhomogeneous part.
Greetings, Trying to upsample an fmriprep'ed preproc_bold file before using glmsingle, but I get the following " requested array has an inhomogeneous shape after 1 dimensions". These have have already been slice time corrected, so I guess slicetimes should be shifted by half a TR (given fmriprep STC)?
Nonetheless, the error persists.
Traceback (most recent call last): File "", line 1, in
File "/home/xx/anaconda3/envs/spy310/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 397, in run
runtime = self._run_interface(runtime)
File "/home/xx/anaconda3/envs/spy310/lib/python3.10/site-packages/slicetime/nipype_interface.py", line 47, in _run_interface
run_slicetime(
File "/home/xx/anaconda3/envs/spy310/lib/python3.10/site-packages/slicetime/main.py", line 50, in run_slicetime
new_slice_ts = tseriesinterp(this_slice_ts,
File "/home/xx/anaconda3/envs/spy310/lib/python3.10/site-packages/slicetime/tseriesinterp.py", line 104, in tseriesinterp
print("numchunks",numchunks)
File "/home/xx/anaconda3/envs/spy310/lib/python3.10/site-packages/slicetime/tseriesinterp.py", line 260, in chunking
f = []
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (20,) + inhomogeneous part.