Differences between revisions 7 and 8
Deletions are marked like this. Additions are marked like this.
Line 14: Line 14:
----- /!\ Edit conflict! Other version: -----
Line 226: Line 227:
----- /!\ Edit conflict! Your version: -----
---------------------------------------------------------------------
---------------------------------------------------------------------
= First-Level Analysis =

The First-Level Analysis (FLA) consists of:

 * Setting up models of the task-related components
 * Setting up models of the nuisance components
 * Defining contrasts
 * Fitting the model
 * Making inferences.

In FSFAST, the FLA is done in two stages. In the first stage, the
FLA is configured (with mkanalysis-sess). This is done ONCE regardless
of how many data sets you have (you do not even need to have any data
to run the configuration).

In the second stage, you actually perform the analysis/inference with
selxavg3-sess by passing it the configuration and the session that you
want to analyze. selxavg3-sess customizes the analysis for that
session based on what it finds in the hierarchy, builds the design
matrix and performs the analysis. Breaking the FLA up into these two
stages assures that all sessions are analyzed in the same way.

In this exercise, we will configure two analyses, one assuming an HRF
and the other using a Finite Impulse Response (FIR) model. You will
then launch the analysis and view the results. The fully analyzed data
can be found in fb1-analysis-study. These exercises will be done in
fb1-preproc-study:

{{{
cd $FSFTUTDIR/fb1-preproc-study
}}}

== Configure Analysis and Contrasts I: Gamma HRF Model ==

Configuring the FLA is performed with mkanalysis-sess. When you run:
{{{
cd $FSFTUTDIR/fb1-preproc-study
mkanalysis-sess -gui
}}}

You will see the following window:

attachment:mkana-startup.gif

You will use this window to specify the input of the analysis, the
hemodynamic response model, contrasts and nuisance regressors.
The red fields are fields that you must enter before you can save
the analysis. There is a lot going on with this GUI, so we'll break it
down. Note that many of the components have "tooltips" that will show
when you pause the mouse pointer over them.

In the upper left corner is a panel called "FS-FAST Hierarchy". The
"Func Stem" is the input to the analysis. You should specify the
output from the preprocessing. For this exercise, we are going to use
the motion corrected and 5mm smoothed data. This functional volume is
called fmcsm5.nii in the hierarchy which makes its stem "fmcsm5" (i.e.,
just strip off the nii). Enter "fmcsm5" into the field. When you hit
return, it changes from red to white. Next, enter the TR (sec). For
this experiment it was 3 sec. This will be checked against the TR
found in the input nifti file. Leave INorm checked.
{{{
Func Stem = fmcsm5
TR = 3
}}}

Turn your attention to the "Noise and Nuisance Variables" panel. Low
frequency noise so prevalent in fMRI is compensated for in a
combination of three ways. Drift components are modeled with
polynomial regressors. The order can be adjusted, but leave it at 2
for now. The motion correction parameters can be used as regressors by
checking the "MC Regressors" box (do so now). Finally, the remaining noise is
modeled as time-invariant linear AR1 process when the "Temporal
Whitening" box is checked (leave it so). There is one additionally way
to compensate for noise through the use of a "Time Point Exclude
File", but we will not consider that here.
{{{
Check "MC Regressors" Box
}}}

You will specify the model of the task-related signal in the "Event
Related/Block Design" panel (leave that box checked). Choose the
number of conditions by clicking on the "NConditions" slider. This is
the number of TASK conditions (do not include the Null/Fixation
condition). In this example, we have two conditions (Odd and Even), so
set this to 2. To the right of this is the "Paradigm File". Enter
"sensory-motor.par". Note that the number of task conditions in the
paradigm file must match that specified with "NConditions". Below, you
will specify the Hemodynamic Response Model. There are three choices:
Gamma, SPM HRF, and FIR. Choose Gamma for now. If you hit the "Plot"
button it will show the Gamma and SPM HRF. As you change the Gamma
parameters (Delay, Dispersion (Tau), and Exponent (Alpha)), the Gamma
plot will change. Make sure that they are at Delay=2.25, Tau=1.25, and
Alpha=2.
{{{
Set NConditions to 2
Paradigm File = sensory-motor.par
Press "Plot" button
}}}

At this point, you have specified the model of the BOLD signal
including HRF, nuisance, and noise. The GUI should look like the image
below:

attachment:mkana-gamma-precon.gif

Now you are ready to specify contrasts. A contrast is an instantiation
of a hypothesis and is represented by a contrast matrix (i.e., a linear
summation of the regression coefficients). Contrasts are managed
through a separate GUI accessed through the "Contrast" list box. When
you click on "Add Contrast", you will see the following screen:
{{{
Click on "Add Contrast"
}}}

attachment:mkcon-gam-startup.gif

There are several things going on here, but the most important is the
list of conditions in the middle of the GUI (i.e., "Condition 1",
"Condition 2") shown as green, red, and black radio buttons.

 * Green indicates an "active" condition.
 * Red means a "control" condition
 * Black means to ignore the condition in the contrast.

Active conditions are given a weight of +1; controls are given -1;
ignores get 0. The weight is given to the right of the buttons. All
contrasts are implicitly computed against the Null or Fixation
condition. If you want to test the null hypothesis that Condition 1 is
no different than the Null condition, then you would make Condition 1
active and ignore the rest. To test the null hypothesis that Condition
1 is no different than Condition 2, then you would make Condition 1
active and Condition 2 control.

For this exercise, we are going to test four NULL hypotheses:

 * Odd == Fixation (odd-v-0)
 * Even == Fixation (even-v-0)
 * Odd == Even (odd-v-even)
 * Odd+Even == Fixation (odd+even)

The last one tests whether the average of the responses to odd and
even are different than fixation. Remember that, according to the
Paradigm File, Condition 1 is Odd, and Condition 2 is Even. When "Add
Contrast" is clicked, "Condition 1" will be active and Condition 2
will be ignored. This corresponds to our first contrast, so there is
nothing we need to do except give the contrast a name. You should give
your contrasts meaningful but terse names. Specify "odd-v-0" for this
contrast. Hit the "Done/Save" button. You will now see "odd-v-0"
appear in the Contrast list box in the mkanalyiss GUI.

Click on "Add Contrast" again to bring up the contrast GUI
again. This time, click on the green button next to Condition 2 (see
its weight change from 0 to 1). Then click on the black button next
to Condition 1 (see weight change from 1 to 0). Change the name to
"even-v-0", then click Done/Save. "even-v-0" will appear in the list
box.

Click on "Add Contrast" again, and click the red button next to
Condition 2 (see its weight change from 0 to -1). Change the name to
"odd-v-even", then click Done/Save.

Click on "Add Contrast" one more time, and click the green button next to
Condition 2 (see its weight change from 0 to +1). Change the name to
"odd+even", then click Done/Save.

You can go back and view and/or edit an contrast by clicking on it in
the list box.

The last thing you have to do is to give your analysis a name. Like
the contrasts, it should be terse but descriptive. It cannot have any
spaces or blanks. Specify "sm-gamma-fwhm5" (sm = sensory-motor, gamma
= Gamma HRF, and fwhm5 for the input). The interface should now look
like:

attachment:mkana-gamma-done.gif

Hit the "Save" button, then "Quit".

After you hit Quit, control will be returned to the shell that you ran
mkanalysis-sess from. If you type "ls", you will see a new folder
called "sm-gamma-fwhm5". If you "ls sm-gamma-fwhm5", you will see
analysis.info, analysis.cfg, odd-v-0.mat, even-v-0.mat,
odd-v-even.mat, odd+even.mat. Your configuration is stored in these
files. You can browse/edit your configuration by running:

{{{
mkanalysis-sess -gui -analysis sm-gamma-fwhm5
}}}

== Configure Analysis and Contrasts II: FIR HRF Model ==

Now we are going to use a Finit Impulse Response (FIR) to model the
hemodynamic response. The FIR does not make any assumptions about the
shape of the HRF but is also less interpretable. Again, run

{{{
mkanalysis-sess -gui
}}}

Set the Func Stem, TR, NConditions, and Paradigm File as above, but
now click on the "FIR" checkbox. This will enable the "Total Time
Window", "PreStim", and "TER" entry boxes. The Time Window is the
window within which we will estimate the HRF. Given that the task is
15 sec long and the rest is 15 sec, let's choose 27 sec. The PreStim
is the amount of time before stimulus onset to start estimating the
HRF. A non-zero PreStim gives us an idea of what the baseline is at
stimulus onset. Set it to 6.

Set up the same contrasts as you did above, then name the analysis
"sm-fir-fwhm5", hit Save, then Quit.
----- /!\ End of edit conflict -----

The first step in first-level analysis is the creation of an "analysis". The analysis is a collection of information about how you want to analyze the functional data. This includes the specification of the input data, event types, event schedules, hemodynamic model, nuisance regressors, etc. This program only configures the analysis; it does not analyze the data.Setting up analysis is only done ONCE, and then it is applied to any and all sessions.

The First-Level Analysis (FLA) consists of:

  • Setting up models of the task-related components
  • Setting up models of the nuisance components
  • Defining contrasts

Configuring the FLA is performed with mkanalysis-sess -gui

Please visit First-Level Analysis on FsFastTutorial for details.


/!\ Edit conflict! Other version:




First-Level Analysis

The First-Level Analysis (FLA) consists of:

  • Setting up models of the task-related components
  • Setting up models of the nuisance components
  • Defining contrasts
  • Fitting the model
  • Making inferences.

In FSFAST, the FLA is done in two stages. In the first stage, the FLA is configured (with mkanalysis-sess). This is done ONCE regardless of how many data sets you have (you do not even need to have any data to run the configuration).

In the second stage, you actually perform the analysis/inference with selxavg3-sess by passing it the configuration and the session that you want to analyze. selxavg3-sess customizes the analysis for that session based on what it finds in the hierarchy, builds the design matrix and performs the analysis. Breaking the FLA up into these two stages assures that all sessions are analyzed in the same way.

In this exercise, we will configure two analyses, one assuming an HRF and the other using a Finite Impulse Response (FIR) model. You will then launch the analysis and view the results. The fully analyzed data can be found in fb1-analysis-study. These exercises will be done in fb1-preproc-study:

cd $FSFTUTDIR/fb1-preproc-study

Configure Analysis and Contrasts I: Gamma HRF Model

Configuring the FLA is performed with mkanalysis-sess. When you run:

cd $FSFTUTDIR/fb1-preproc-study
mkanalysis-sess -gui

You will see the following window:

attachment:mkana-startup.gif

You will use this window to specify the input of the analysis, the hemodynamic response model, contrasts and nuisance regressors. The red fields are fields that you must enter before you can save the analysis. There is a lot going on with this GUI, so we'll break it down. Note that many of the components have "tooltips" that will show when you pause the mouse pointer over them.

In the upper left corner is a panel called "FS-FAST Hierarchy". The "Func Stem" is the input to the analysis. You should specify the output from the preprocessing. For this exercise, we are going to use the motion corrected and 5mm smoothed data. This functional volume is called fmcsm5.nii in the hierarchy which makes its stem "fmcsm5" (i.e., just strip off the nii). Enter "fmcsm5" into the field. When you hit return, it changes from red to white. Next, enter the TR (sec). For this experiment it was 3 sec. This will be checked against the TR found in the input nifti file. Leave INorm checked.

Func Stem = fmcsm5
TR = 3

Turn your attention to the "Noise and Nuisance Variables" panel. Low frequency noise so prevalent in fMRI is compensated for in a combination of three ways. Drift components are modeled with polynomial regressors. The order can be adjusted, but leave it at 2 for now. The motion correction parameters can be used as regressors by checking the "MC Regressors" box (do so now). Finally, the remaining noise is modeled as time-invariant linear AR1 process when the "Temporal Whitening" box is checked (leave it so). There is one additionally way to compensate for noise through the use of a "Time Point Exclude File", but we will not consider that here.

Check "MC Regressors" Box

You will specify the model of the task-related signal in the "Event Related/Block Design" panel (leave that box checked). Choose the number of conditions by clicking on the "NConditions" slider. This is the number of TASK conditions (do not include the Null/Fixation condition). In this example, we have two conditions (Odd and Even), so set this to 2. To the right of this is the "Paradigm File". Enter "sensory-motor.par". Note that the number of task conditions in the paradigm file must match that specified with "NConditions". Below, you will specify the Hemodynamic Response Model. There are three choices: Gamma, SPM HRF, and FIR. Choose Gamma for now. If you hit the "Plot" button it will show the Gamma and SPM HRF. As you change the Gamma parameters (Delay, Dispersion (Tau), and Exponent (Alpha)), the Gamma plot will change. Make sure that they are at Delay=2.25, Tau=1.25, and Alpha=2.

Set NConditions to 2
Paradigm File = sensory-motor.par
Press "Plot" button

At this point, you have specified the model of the BOLD signal including HRF, nuisance, and noise. The GUI should look like the image below:

attachment:mkana-gamma-precon.gif

Now you are ready to specify contrasts. A contrast is an instantiation of a hypothesis and is represented by a contrast matrix (i.e., a linear summation of the regression coefficients). Contrasts are managed through a separate GUI accessed through the "Contrast" list box. When you click on "Add Contrast", you will see the following screen:

Click on "Add Contrast"

attachment:mkcon-gam-startup.gif

There are several things going on here, but the most important is the list of conditions in the middle of the GUI (i.e., "Condition 1", "Condition 2") shown as green, red, and black radio buttons.

  • Green indicates an "active" condition.
  • Red means a "control" condition
  • Black means to ignore the condition in the contrast.

Active conditions are given a weight of +1; controls are given -1; ignores get 0. The weight is given to the right of the buttons. All contrasts are implicitly computed against the Null or Fixation condition. If you want to test the null hypothesis that Condition 1 is no different than the Null condition, then you would make Condition 1 active and ignore the rest. To test the null hypothesis that Condition 1 is no different than Condition 2, then you would make Condition 1 active and Condition 2 control.

For this exercise, we are going to test four NULL hypotheses:

  • Odd == Fixation (odd-v-0)
  • Even == Fixation (even-v-0)
  • Odd == Even (odd-v-even)
  • Odd+Even == Fixation (odd+even)

The last one tests whether the average of the responses to odd and even are different than fixation. Remember that, according to the Paradigm File, Condition 1 is Odd, and Condition 2 is Even. When "Add Contrast" is clicked, "Condition 1" will be active and Condition 2 will be ignored. This corresponds to our first contrast, so there is nothing we need to do except give the contrast a name. You should give your contrasts meaningful but terse names. Specify "odd-v-0" for this contrast. Hit the "Done/Save" button. You will now see "odd-v-0" appear in the Contrast list box in the mkanalyiss GUI.

Click on "Add Contrast" again to bring up the contrast GUI again. This time, click on the green button next to Condition 2 (see its weight change from 0 to 1). Then click on the black button next to Condition 1 (see weight change from 1 to 0). Change the name to "even-v-0", then click Done/Save. "even-v-0" will appear in the list box.

Click on "Add Contrast" again, and click the red button next to Condition 2 (see its weight change from 0 to -1). Change the name to "odd-v-even", then click Done/Save.

Click on "Add Contrast" one more time, and click the green button next to Condition 2 (see its weight change from 0 to +1). Change the name to "odd+even", then click Done/Save.

You can go back and view and/or edit an contrast by clicking on it in the list box.

The last thing you have to do is to give your analysis a name. Like the contrasts, it should be terse but descriptive. It cannot have any spaces or blanks. Specify "sm-gamma-fwhm5" (sm = sensory-motor, gamma = Gamma HRF, and fwhm5 for the input). The interface should now look like:

attachment:mkana-gamma-done.gif

Hit the "Save" button, then "Quit".

After you hit Quit, control will be returned to the shell that you ran mkanalysis-sess from. If you type "ls", you will see a new folder called "sm-gamma-fwhm5". If you "ls sm-gamma-fwhm5", you will see analysis.info, analysis.cfg, odd-v-0.mat, even-v-0.mat, odd-v-even.mat, odd+even.mat. Your configuration is stored in these files. You can browse/edit your configuration by running:

mkanalysis-sess -gui -analysis sm-gamma-fwhm5

Configure Analysis and Contrasts II: FIR HRF Model

Now we are going to use a Finit Impulse Response (FIR) to model the hemodynamic response. The FIR does not make any assumptions about the shape of the HRF but is also less interpretable. Again, run

mkanalysis-sess -gui

Set the Func Stem, TR, NConditions, and Paradigm File as above, but now click on the "FIR" checkbox. This will enable the "Total Time Window", "PreStim", and "TER" entry boxes. The Time Window is the window within which we will estimate the HRF. Given that the task is 15 sec long and the rest is 15 sec, let's choose 27 sec. The PreStim is the amount of time before stimulus onset to start estimating the HRF. A non-zero PreStim gives us an idea of what the baseline is at stimulus onset. Set it to 6.

Set up the same contrasts as you did above, then name the analysis "sm-fir-fwhm5", hit Save, then Quit.


/!\ Edit conflict! Your version:




First-Level Analysis

The First-Level Analysis (FLA) consists of:

  • Setting up models of the task-related components
  • Setting up models of the nuisance components
  • Defining contrasts
  • Fitting the model
  • Making inferences.

In FSFAST, the FLA is done in two stages. In the first stage, the FLA is configured (with mkanalysis-sess). This is done ONCE regardless of how many data sets you have (you do not even need to have any data to run the configuration).

In the second stage, you actually perform the analysis/inference with selxavg3-sess by passing it the configuration and the session that you want to analyze. selxavg3-sess customizes the analysis for that session based on what it finds in the hierarchy, builds the design matrix and performs the analysis. Breaking the FLA up into these two stages assures that all sessions are analyzed in the same way.

In this exercise, we will configure two analyses, one assuming an HRF and the other using a Finite Impulse Response (FIR) model. You will then launch the analysis and view the results. The fully analyzed data can be found in fb1-analysis-study. These exercises will be done in fb1-preproc-study:

cd $FSFTUTDIR/fb1-preproc-study

Configure Analysis and Contrasts I: Gamma HRF Model

Configuring the FLA is performed with mkanalysis-sess. When you run:

cd $FSFTUTDIR/fb1-preproc-study
mkanalysis-sess -gui

You will see the following window:

attachment:mkana-startup.gif

You will use this window to specify the input of the analysis, the hemodynamic response model, contrasts and nuisance regressors. The red fields are fields that you must enter before you can save the analysis. There is a lot going on with this GUI, so we'll break it down. Note that many of the components have "tooltips" that will show when you pause the mouse pointer over them.

In the upper left corner is a panel called "FS-FAST Hierarchy". The "Func Stem" is the input to the analysis. You should specify the output from the preprocessing. For this exercise, we are going to use the motion corrected and 5mm smoothed data. This functional volume is called fmcsm5.nii in the hierarchy which makes its stem "fmcsm5" (i.e., just strip off the nii). Enter "fmcsm5" into the field. When you hit return, it changes from red to white. Next, enter the TR (sec). For this experiment it was 3 sec. This will be checked against the TR found in the input nifti file. Leave INorm checked.

Func Stem = fmcsm5
TR = 3

Turn your attention to the "Noise and Nuisance Variables" panel. Low frequency noise so prevalent in fMRI is compensated for in a combination of three ways. Drift components are modeled with polynomial regressors. The order can be adjusted, but leave it at 2 for now. The motion correction parameters can be used as regressors by checking the "MC Regressors" box (do so now). Finally, the remaining noise is modeled as time-invariant linear AR1 process when the "Temporal Whitening" box is checked (leave it so). There is one additionally way to compensate for noise through the use of a "Time Point Exclude File", but we will not consider that here.

Check "MC Regressors" Box

You will specify the model of the task-related signal in the "Event Related/Block Design" panel (leave that box checked). Choose the number of conditions by clicking on the "NConditions" slider. This is the number of TASK conditions (do not include the Null/Fixation condition). In this example, we have two conditions (Odd and Even), so set this to 2. To the right of this is the "Paradigm File". Enter "sensory-motor.par". Note that the number of task conditions in the paradigm file must match that specified with "NConditions". Below, you will specify the Hemodynamic Response Model. There are three choices: Gamma, SPM HRF, and FIR. Choose Gamma for now. If you hit the "Plot" button it will show the Gamma and SPM HRF. As you change the Gamma parameters (Delay, Dispersion (Tau), and Exponent (Alpha)), the Gamma plot will change. Make sure that they are at Delay=2.25, Tau=1.25, and Alpha=2.

Set NConditions to 2
Paradigm File = sensory-motor.par
Press "Plot" button

At this point, you have specified the model of the BOLD signal including HRF, nuisance, and noise. The GUI should look like the image below:

attachment:mkana-gamma-precon.gif

Now you are ready to specify contrasts. A contrast is an instantiation of a hypothesis and is represented by a contrast matrix (i.e., a linear summation of the regression coefficients). Contrasts are managed through a separate GUI accessed through the "Contrast" list box. When you click on "Add Contrast", you will see the following screen:

Click on "Add Contrast"

attachment:mkcon-gam-startup.gif

There are several things going on here, but the most important is the list of conditions in the middle of the GUI (i.e., "Condition 1", "Condition 2") shown as green, red, and black radio buttons.

  • Green indicates an "active" condition.
  • Red means a "control" condition
  • Black means to ignore the condition in the contrast.

Active conditions are given a weight of +1; controls are given -1; ignores get 0. The weight is given to the right of the buttons. All contrasts are implicitly computed against the Null or Fixation condition. If you want to test the null hypothesis that Condition 1 is no different than the Null condition, then you would make Condition 1 active and ignore the rest. To test the null hypothesis that Condition 1 is no different than Condition 2, then you would make Condition 1 active and Condition 2 control.

For this exercise, we are going to test four NULL hypotheses:

  • Odd == Fixation (odd-v-0)
  • Even == Fixation (even-v-0)
  • Odd == Even (odd-v-even)
  • Odd+Even == Fixation (odd+even)

The last one tests whether the average of the responses to odd and even are different than fixation. Remember that, according to the Paradigm File, Condition 1 is Odd, and Condition 2 is Even. When "Add Contrast" is clicked, "Condition 1" will be active and Condition 2 will be ignored. This corresponds to our first contrast, so there is nothing we need to do except give the contrast a name. You should give your contrasts meaningful but terse names. Specify "odd-v-0" for this contrast. Hit the "Done/Save" button. You will now see "odd-v-0" appear in the Contrast list box in the mkanalyiss GUI.

Click on "Add Contrast" again to bring up the contrast GUI again. This time, click on the green button next to Condition 2 (see its weight change from 0 to 1). Then click on the black button next to Condition 1 (see weight change from 1 to 0). Change the name to "even-v-0", then click Done/Save. "even-v-0" will appear in the list box.

Click on "Add Contrast" again, and click the red button next to Condition 2 (see its weight change from 0 to -1). Change the name to "odd-v-even", then click Done/Save.

Click on "Add Contrast" one more time, and click the green button next to Condition 2 (see its weight change from 0 to +1). Change the name to "odd+even", then click Done/Save.

You can go back and view and/or edit an contrast by clicking on it in the list box.

The last thing you have to do is to give your analysis a name. Like the contrasts, it should be terse but descriptive. It cannot have any spaces or blanks. Specify "sm-gamma-fwhm5" (sm = sensory-motor, gamma = Gamma HRF, and fwhm5 for the input). The interface should now look like:

attachment:mkana-gamma-done.gif

Hit the "Save" button, then "Quit".

After you hit Quit, control will be returned to the shell that you ran mkanalysis-sess from. If you type "ls", you will see a new folder called "sm-gamma-fwhm5". If you "ls sm-gamma-fwhm5", you will see analysis.info, analysis.cfg, odd-v-0.mat, even-v-0.mat, odd-v-even.mat, odd+even.mat. Your configuration is stored in these files. You can browse/edit your configuration by running:

mkanalysis-sess -gui -analysis sm-gamma-fwhm5

Configure Analysis and Contrasts II: FIR HRF Model

Now we are going to use a Finit Impulse Response (FIR) to model the hemodynamic response. The FIR does not make any assumptions about the shape of the HRF but is also less interpretable. Again, run

mkanalysis-sess -gui

Set the Func Stem, TR, NConditions, and Paradigm File as above, but now click on the "FIR" checkbox. This will enable the "Total Time Window", "PreStim", and "TER" entry boxes. The Time Window is the window within which we will estimate the HRF. Given that the task is 15 sec long and the rest is 15 sec, let's choose 27 sec. The PreStim is the amount of time before stimulus onset to start estimating the HRF. A non-zero PreStim gives us an idea of what the baseline is at stimulus onset. Set it to 6.

Set up the same contrasts as you did above, then name the analysis "sm-fir-fwhm5", hit Save, then Quit.


/!\ End of edit conflict


FsFastFirstLevelAnalysis (last edited 2008-04-29 11:45:47 by localhost)