create 3d+time dataset from 2D matrix


I have generated simulated data (voxel time series) in the form of a 2D matrix ( N voxels x T timepoints). I would like to save it in a 3D+time dataset, for example a dataset with one slice (nx=ny and nz=1) and nt=T timepoints, in order to visualize it in AFNI. I’ve looked at 3dEmpty, but I am not sure whether it is the best option. Any suggestion?

Thanks in advance,

3dUndump can take a text file with i,j,k,value, but it’s limited to a single volume at a time, so you could create a loop to do this across time.

Hi Cesar,

Use AFNI_WRITE_1D_AS_PREFIX to tell the software not to just write as 1D, even if it looks like it.

For example, if t.1D has 3 rows (voxels) and 5 columns (time points), then the command:


would produce a TT+orig with 3 voxels and 5 time points.

Does that do what you want? If you need to transpose, use 1dtranspose before 3dcopy.

  • rick

Hi Rick and Daniel,

Yes, Rick’s solution is what I need. Thanks very much.

Best wishes,