Skip to content

AFNI and NIfTI Server for NIMH/NIH/PHS/DHHS/USA/Earth

Sections
Personal tools
You are here: Home » FAQs » How can I extract a voxel timeseries to a text file?

How can I extract a voxel timeseries to a text file?

Document Actions
Up to table of contents

Q75. How can I extract a voxel timeseries to a text file?
From the AFNI graph window, you can use the menu item Opt->Write Center to write the central sub-graph's data to a file. This file will be named something like 001_002_003.1D, where 001 is the x-axis voxel index (sometimes called I), 002 is the y-axis voxel index (J), and 003 is the z-axis voxel index (K). These voxel indexes are shown in the lower-right corner of the graph window. They can also be shown in the AFNI controller window if you turn on the Datamode->Misc->Voxel Coords toggle.

If you want to extract the data from the command line (perhaps in a script), you can do something like this:

  3dmaskdump -cmask "-a dset+orig[0] -expr rect(i-1)*rect(j-2)*rect(k-3)" -noijk dset+orig > qtemp
  1dtranspose qtemp 001_002_003.1D
  /bin/rm qtemp
The first line uses the -cmask feature of 3dmaskdump to compute a mask "on-the-fly", in this case a mask that is nonzero only at the single voxel (I,J,K)=(1,2,3). The output is sent to file qtemp. This will consist of all the data in a single line. The utility program 1dtranspose is used to tranpose this to a .1D format file (a single column), and then qtemp is deleted.

[Answer added 23 May 2001]

This FAQ applies to: Any version.

Created by Robert Cox
Last modified 2005-08-01 14:53
 

Powered by Plone

This site conforms to the following standards: