AFNI Message Board

Dear AFNI users-

We are very pleased to announce that the new AFNI Message Board framework is up! Please join us at:

https://discuss.afni.nimh.nih.gov

Existing user accounts have been migrated, so returning users can login by requesting a password reset. New users can create accounts, as well, through a standard account creation process. Please note that these setup emails might initially go to spam folders (esp. for NIH users!), so please check those locations in the beginning.

The current Message Board discussion threads have been migrated to the new framework. The current Message Board will remain visible, but read-only, for a little while.

Sincerely, AFNI HQ

History of AFNI updates  

|
May 06, 2005 09:18AM
It is possible to dump all the data in a dataset to a pure ASCII file, but a little work is required on your part to edit the result to remove a few header lines that also come with the numbers. The AFNI command is

3dAFNIto3D dataset+orig.HEAD

which will produce file dataset.3D

This file is in ASCII text, with an XML-ish element header tag at the top and a XML-ish element end tag at the end. For example, the first and last few lines, including the first 2 voxels and the last voxel, of a dataset I just did this way:

# <AFNI_3D_dataset # ni_idcode = "MCW_DMRDPREMLMV"
# ni_type = "68*float"
# ni_dimen = "64,64,16"
# ni_delta = "-3.75,3.75,-7"
# ni_origin = "118.125,-118.125,52"
# ni_axes = "S-I,A-P,L-R"
# >
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
13 10 8 12 10 7 9 12 11 9 8 12 5 7 7 8 11 12 8 9 9 10 9 11 14 8 9 11 10 10 7 8 12 11 11 11 6 8 9 9 10 7 16 10 8 8 8 10 14 10 12 8 10 13 9 8 10 9 13 10 9 7 9 12 6 15 7 12
.... MANY MORE LINES ...
2 1 3 1 1 2 2 5 2 3 5 5 7 3 1 1 1 5 2 3 4 5 1 2 3 2 2 3 3 2 1 3 2 3 1 4 2 3 5 2 2 6 3 2 1 6 2 4 6 2 5 2 2 1 4 3 3 1 2 5 1 6 2 2 4 4 4 2
# </AFNI_3D_dataset>

Each line is the time series from 1 voxel. In this file, there are 64*64*16=65536 data lines, each with 68 values (there were 68 time points in this dataset).

So, if you want to import this into a spreadsheet or some other progam that likes big tables of ASCII numbers, you first will probably want to edit the file to remove the header and footer lines that start with '#'. This could easily be done with a Unix command, such as

grep -v '#' dataset.3D > dataset_new.3D

which will leave only the data lines left (this is the "little editing work" I mentioned at the start). If you want to transpose the file so that the columns are the time courses and the rows are the voxel, an AFNI command like

1dtranspose dataset.3D dataset.1D

should work. This program will ignore the '#' lines, so the grep operation above isn't required prior to the transposing.

There is no very simple way to use this method to extract just a subset of the voxels, via a mask or something similar. Some method for this purpose could be put together using various combinations of Unix and AFNI commands, by someone sufficiently clever and motivated.

Finally, AFNI can actually read a file in the .3D format as a dataset (as long as you don't remove the header lines!).
Subject Author Posted

Timecourse of all voxels

Giovanni May 06, 2005 05:52AM

Re: Timecourse of all voxels

Robert Cox May 06, 2005 09:18AM

Re: Timecourse of all voxels

rick reynolds May 06, 2005 09:53AM

Re: Timecourse of all voxels

Ziad S. Saad May 06, 2005 01:51PM

Re: Timecourse of all voxels

Daniel Glen May 06, 2005 10:30AM