Hello AFNI Community,
I was wondering whether there is a way to shuffle the time series for each voxel in a brain individually? It is fairly straightforward to randomly shuffle all time series in a brain similarly using the 3dTcat program with the ‘[count s]’ function. However, I would like to apply a separate shuffling to each voxel, so as to break any temporal associations between these voxels. Could someone please advise?
Thank you so very much in advance!
I don’t think it would be too hard to add something to do this, but what is it you are trying to accomplish with this shuffling? Maybe we have some alternatives for you.
I would really like to break the temporal associations between voxels. That is why I wanted to shuffle. Thank you!
Sorry, I just noticed that my last reply was probably not very descriptive. I am looking to break the temporal associations between voxels in order to simulate a null distribution of all of the functional connections (i.e., the connectome) for all of my subjects. I’d love to do this in AFNI if possible. Thanks again!
Dear Daniel and Nick,
I agree with Daniel in that it would not be very difficult to create this function since it is basically shuffling the phase of the FFT of the voxel time series, and then apply the inverse FFT. Meanwhile, I’ve created my own 3dFFTshuffle using the R interface to create AFNI compatible programs, as described in 3dRprogDemo. Please contact me (email@example.com) so that I can share them to you. If anyone else is interested, I could upload them in the distrubution but my feeling is that an implementation in C will be much faster and not difficult to do.
I have just added the “-random” option to program 3dTsort, which will randomly permute each voxel (independently) from an input 3D+time dataset. Source code is now in the AFNI github repository, and binaries will be available whenever we next rebuild.
Fortunately, I had a random permutation generator already coded up in 3dttest++, so was able to re-purpose that, and the rest was just bookkeeping (an excellent word with 3 double letters in a row).
Hi Bob and Cesar,
Thank you both very much for your quick responses! Bob, I will definitely grab the source code. Thank you both once again!
The source code for 3dTsort.c now has the “-ranFFT” option, which will do phase scrambling of the FFT to produce a synthesized time series with similar statistical properties, but independent between voxel pairs.