Hello,
Is there any command to do the same as “Shift ideal” that is available in FIM → Edit Ideal in the graph window?
Thanks very much,
Cesar
Hello,
Is there any command to do the same as “Shift ideal” that is available in FIM → Edit Ideal in the graph window?
Thanks very much,
Cesar
Isn’t this just a temporally shifted time series that could be accomplished by using the subbrick selectors as in this recent post:
https://afni.nimh.nih.gov/afni/community/board/read.php?1,167634,167682#msg-167682
You can add zeros to beginning or end, as you like, with 3dTcat, repeat the first and last elements or wrap around.
Thank you Daniel
Cesar
Hi Daniel,
I noticed that the suggested solution with subbrick selectors is valid for integer shifts of the time series, but the shift ideal option in the GUI also enables sub-integer shits (e.g., 0.5 steps). How is it possible to implement those?
Thanks in advance,
Cesar
The subbrick indices will be locked to integers, of course, but you could oversample to double the number of time points to be able to get to an index by 1/2 the original TR. Here’s an example with a 3d+time dataset.
#!/bin/tcsh
set dset = epi_r1+orig
set nv = 3dnvals $dset
@ nv –
set nlist = count -digits 1 0 $nv
set n2list = ()
foreach i ($nlist)
set n2list = ($n2list $i, $i,)
end
echo $n2list
3dTcat -prefix tempx2.nii.gz -overwrite $dset"[$n2list]"
3dcalc -a tempx2.nii.gz -b a+l -c a-l -expr ‘step(l/2)*(b+c)/2 + not(step(l/2)*a)’
-datum float -prefix x2_oversample.nii.gz -overwrite
Also, with a giant thanks to Rick, this task can now be accomplished with 3dTshift.
3dTshift -linear -prefix newideal.1D -TR 1 -tzero 0 -tpattern ‘@1D: 0.5’ ideal.1D
This required a change in the code, so it will take a little while to get to regular distribution.
Hi Daniel,
Thanks very much to you and Rick.
The following command did not work properly today.
❯ 3dTshift -linear -prefix newideal.1D -TR 1 -tzero 0 -tpattern ‘@1D: 1.2’ mm_raw.1D'
++ 3dTshift: AFNI version=AFNI_22.1.06 (Apr 24 2022) [64-bit]
** FATAL ERROR: Illegal value 1.2 in tpattern file 1D: 1.2
** Program compile date = Apr 24 2022
mm_raw.1D is the raw displacement from AFNI_data6/FT_analysis/FT
Is it because the shift is larger than TR?
Thank you in advance and best wishes,
Cesar
Yes, 3dTshift requires the shift to be within the TR.
For your command it might be better to insert an extra zero (or whatever seems appropriate) at the beginning (to capture the 1 TR shift earlier) and then use 0.2 with the tpattern.
Keep in mind that interpolation might be a temporally local. I do not believe it evaluates the whole time series at once, which would be good idea for such cases.
Hi Rick,
Then, what’s the actual command to shift the ideals in the FIM panel within the graph window?
Cesar
Hi Cesar,
I took a look, and the function from the Graph viewer is similar but not identical to that used by 3dTshift (the Graph viewer only has the cubic interpolation version). I did not yet take time to see whether the TR is an important or simply a sensible limitation for 3dTshift…
Hello Rick,
I was wondering if there is a way to use the shift ideal function from Graph Viewer in the command line? I am looking to do sub-integer shifts outside the TR which is possible in the Graph Viewer but not using 3dTshift. For example, increments of 0.5 and 10 steps to the left and right.
Thank you!
Mairi
The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.
Freedom of Information Act |
HHS Vulnerability Disclosure
National Institute of Mental
Health | National Institutes of Health | U.S.
Department of Health and Human Services |