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

Issues upsampling #119

Open
andreifoldes opened this issue Dec 5, 2023 · 1 comment
Open

Issues upsampling #119

andreifoldes opened this issue Dec 5, 2023 · 1 comment
Assignees

Comments

@andreifoldes
Copy link

andreifoldes commented Dec 5, 2023

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.

@iancharest
Copy link
Collaborator

I have now made a commit to pyslicetime fixing the chunking. @andreifoldes Can you check whether this fixes your issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants