Processing individual subject data

Overview

These notes are to take you through the basics of a single subject analyses for a quick look at the data. There will be continuing documentation for such things as pix, when i get around to it....thanks,fred


Step by step

1 convert your raw anatomicals -Go from epi to analyze file format
2 grind your functionals -Do a correlational analysis
3 display your data -if you want to look at motion...or your full anatomicals
4 overlay -Put those functional maps on the anatomical HiRes
5 AIR -motion correct your raw data





Details

*NOTE* before starting, if you have any problems with any of the commands here check the help before bothering fred. type "man [command-name]" at the prompt, and on at least a couple of the machines you will get more documentation. This is for UNIX help pages. For help with each of the programs designed by Mark Cohen you will be able to type the command without any options and get extensive help. The only way to really learn this is to try to solve problems yourself.

Note on my style: when you see this character '>' it means that is a prompt, what is in front of it you should type.
If there is something inside those characters [like_this] it means that you should not refer to it literally, but apply it to your own uses. An example would be with the make directory command. you will see below i have a line:
>mkdir [sub_name]
this means at the prompt type 'mkdir' and then YOUR subject name, not the actual characters .
Where possible, I have pasted in the Usage statement from Mark's programs.

The first thing is to find a directory to analyze this data. It should be on the same disk as your other data. Please do not spam data all over the place. make a new directory in the project directory.

>mkdir [sub_name]

then you want to cd into that directory to start your work.

CONVERT IT
This step is used to convert your EPI HiRes scan from EPI format to a '.bshort'

-->imconvert
Usage: imconvert -i input_file -o output_file
        -M scalar intensity multiplier
        -T slice thickness (for Analyze output)
        -A Analyze 3D format. Follow by slice thickness
        -# number of slices in 'mdisplay' format for infile
        -t separate file for each time point
        -s separate file for each slice
        -N Normalize full range of input intensities to full range of output type
        -m F-L save output files in mdisplay format (multiple slices/image)
               F and L are the first and last slice for mdisplay
               The option '-m A' will use all slices
        -R Auto window input intensities to full range of output type
        -e emulate epi2bshort (but without offset artifacts!)
        -f force output type to float for Analyze files
        -F flip image top and bottom
        -V verbose operation
saves a processing file "outFile.imconvert.proc"



e.g.> imconvert -i /apd6/anmr_scans/image/foo_0004_0001_001.img -o HRa.bshort -m 1-26

This will give you a bshort to look at from which you can pick your slices, and go back and rerun imconvert
with new values in the -m option

[[THIS IS NO LONGER NEEDED/USED]]
-->mdisp
Usage: mdisp *inflies option



GRIND IT
This step is the statistical analysis on the raw functional data

-->Cproto
Cproto is an interactive program.

There is extensive help on it, but basically for CC_gr you need to input a 1 or 0 for each scan(TR) you did.
If you started out with 10 scans of rest then had 10 scans of activation:
10,0
10,1

You will need to put a finishing 0 on a new line after you finish entering.

-->CC_gr
Usage: CC_gr -i input_file -o output_file (basename) -p paradigm_file

[ -G global normalization -R normalization_ratio_file
     -F Change to Light Speed (real-time mode enabled)
     -V verbose
     -K Smoothing
     -N noise_threshold
     -Q create quicklook (.covl and .sovl) files
     -L t cutoff for slope and quicklook map
     -U upper limit of t displayed in quicklook maps
     -b bshort multi-display file (for time series)
     -G global normalization
     -R normalization_ratio_file
     -v output as volume format (may be useful for MedX) ]

The first three arguments are required.
Auto thresholding is ON by default, use -N 0 to override
Outputs a processing record: outputname.CC_gr.proc

CC_gr -h prints an extensive (out of date) help file


e.g.> CC_gr -i /apd6/.../foo_0004_0002_001.img -o run1_object -p Cproto.output -G -K -N 200 -b



DISPLAY IT
-->xds/xdd
These two programs will allow you to display your data on the UNIX machines, without, or with color respectively.

Usage:xds [-z ] [-r ] [-hqMPRI] filename
        [-A  ] 
        [-v ] [-m ] [-l ]
        [-L ] [-H ]
        [-s ] [-# ] [-e ]
         [[-s ] [-e ] [-# ] ] ...

  [-b] bilinear interpolation mode.
  [-z ] Increase image size by a factor of  in linear dimensions.
  [-r ] Make the pixels  times larger in the vertical 
direction.
  [-h] Print help information. (Same as 'h' key).
  [-q] Toggle quiet mode (don't print statistics). (Same as 'Q' key).
  -[M]|[P]|[R]|[I] Define data as complex and select mag, phase, real, 
       or imaginary. (Same as '1 D', '2 D', '3 D', and '4 D' respectively.)
  [-A ] Filename for statistical image (KS_grinder or T_grinder 
output)
  [-v ] Filename for overlay data (ascii x,y pairs) or seg .otl file.
  [-m ] Filename to load 256 ascii triples as 0-65535 rgb color map.
              Data file then must vary only [0..255], interpreted as 
colors.
  [-l ] Filename to save log data into (output of 's' command).
  [-W] Auto window and level each window individually (for disparate 
images).
  [-L ],[-H ] User-defined data limits to force image 
contrast.
              Data outside this range will be displayed as black or white.
  [-s ] Start loading at image , where n starts at 0.
  [-# ]|[-e ] Load the following file for  images or at image .
   Image stack filenames, named with appropriate extension;
  Input files must be acceptable to read_image(), or ANMR .im files.
  N.B.  The -s, -e, -# parameters apply only to SUBSEQUENT files, and until
        replaced. e.g. xds -s 0 -# 10 f1.bshort -s1 -#10 f2.bshort
        reads 20 images, but the second -#10 is redundant.
e.g.: xds run1_object.bfloat
e.g.: xdd run1_object.buchar



PRINT IT
-->overlay
This will overlay the functional correlation maps onto a HiRes EPI image.

Usage: overlay -B baseimage -O overlayimage -o outputname -[u,l,U,L,d,#,N,V]
REVISED 12/4/96 -- Please report any errors to Mark Cohen

Takes two images, (base and functional) and forms a composite
with the functional containing the upper gray scale values. The
overlay image is interpolated, if needed, to the base image size.
The output image is an eight bit Mac-compatible file

The current version shows positive and negative overlays by default
and uses pixel replication (rather than interpolation) for overlays
Note new options for slice and image.

OPTIONS:
B: baseimage (REQUIRED)
   u,l: upper & lower range for baseimage
      (default: automatic noise threshold detection)
O: overlayimage (REQUIRED)
   U,L: upper & lower range for overlay
      (defaults: half of overlay max to max)
      N.B.  -U and -L are REQUIRED for multi image sets
s: Only use positive intensities in overlay
o: Output file (REQUIRED). Basename only; type will be buchar
#: Image number to use from overlay set (counting from one)
S: Slice number to use from multi-slice base set (counting from one)
N: Image number to use from multi-image base set (counting from one)
I: Bilinear Interpolation (default is replication)
h: Prints out an extensive help file.
V: verbose option

Outputs a processing record: outputname.overlay.proc

e.g.: overlay -B HR.bshort -O run1_object.bfloat -o Someone_object -# 1 -l 0 -u 600 -L .3 -U 1.2

Then you want to pull it to a mac...



AIR IT
This step is if you see you have a lot of motion and you want to try to correct for it

-->AIR
This step will motion correct raw files, then you need to re-run through the above steps.

Usage:AIR inputname outputname numimages interplanedist threshold res referencetimepoint deleteworkingfiles firstslice lastslice refvolume
where inputname = blah_00001_00001_001, raw ANMR data, do not put .img
      outputname = outputfilename, it defaults to .bshort, so do not put it
      numimages = number of 3-D data sets in time series
      interplanedist = slicethickness (eg 4) + interslicespacing (eg 1) 
(default = 5)
      threshold = noise threshold, recommended >=160 (default)
      res = 64 for 64 x 64(default), 128 for 128 x 128, 0 no cropping
      referencetimepoint = 1 (default) to align to 1st volume, 20 to 20th 
volume, etc.
      deleteworkingfiles = y (default), n
      firstslice = 0 (default, take all slices in mdisp) or slice to start 
with mdisp
                    (eg. 2, to skip 1st slice lost in motion correction)
      lastslice = 0 (default, take all slices), or last slice to take in 
mdisp
      referencevolume = filename for external volume to align to (eg. to 
align to another run)
                    This overrides referencetimepoint

Description:  Takes raw ANMR data and outputs AIRed (v. 3.03) bshort data

Notes:
1) Make sure NOT to include '.img' or '.bshort' in 'inputname' or 
'outputname'
2) Place no periods in outputname
3) All output files will be in the CURRENT WORKING DIRECTORY (i.e. pwd).
   Do NOT specify any directory paths in 'outputname'
   Input files may have a directory specification
4) A bunch of working files are created, so you may want to create a 
working directory
   and run this script from there, so as not to clutter your directory.
5) Overwrite permission is not enabled.
6) AIR deletes all working files, except the .air files which are tarred 
into an archive.
   If you specify n for delete working files, AIR will preserve the 
resliced .bshort timeseries for each slice.
7) So as not to oeverload the machine, especially when you are going to
   align several datasets at once in the background, use the nice command 
(see example)

Example 1: If the file to be aligned is in the current directory,
         mkdir align
         cd align
         nice AIR ../test_00717_00005_00001_00001_001 testaligned 216 5
Example 2: For 100 images, 3mm/0skip slices, threshold 160, matrix 
128x128, will align to the 50th image,
                   keep slices 2-10 in the mdisp, and preserve working 
files:
         nice AIR ../blah_001 testout 100 3 160 128 50 n 2 10
Example 3: This will do the same except align to an external reference 
volume:
         nice AIR ../blah_001 testout 100 3 160 128 1 n 2 10 otherrun

A .proc file is output

e.g.: AIR /apd6/.../foo_00004_00002_001 run1_aired_object 84 5 160 64 42

This will run as long as you give it input and output and timepoints, all reast will default. reference time point is one i often change in order to AIR to the middle image (better for correction)
*You should make a new sub_directory for this, and then work out of there.



Pix
stay tuned...




this page is maintained by fred [12.1.99]