Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

plug_fourier.c File Reference

#include "afni.h"
#include "fourier_filter.c"

Go to the source code of this file.


Defines

#define IN_FOURIER_PLUGIN

Functions

char * Fourier_Main (PLUGIN_interface *)
void fourier_1D (int num, double to, double dt, float *vec)
DEFINE_PLUGIN_PROTOTYPE PLUGIN_interface * PLUGIN_init (int ncall)

Variables

char helpstring []
float low_fc
float high_fc
char * output_prefix
int autocorr
int retrend
int ignore
MCW_idcodeidc

Define Documentation

#define IN_FOURIER_PLUGIN
 

Definition at line 61 of file plug_fourier.c.


Function Documentation

void fourier_1D int    num,
double    to,
double    dt,
float *    vec
 

Definition at line 68 of file plug_fourier.c.

References dt, filter(), high_fc, ignore, low_fc, and vec.

Referenced by PLUGIN_init().

00068                                                            {
00069         filter(vec, low_fc, high_fc, num, (float)dt, ignore, TRUE, TRUE);
00070 }

char * Fourier_Main PLUGIN_interface *   
 

Definition at line 139 of file plug_fourier.c.

References autocorr, Fourier_Filter_Driver(), high_fc, ignore, low_fc, output_prefix, PLUTO_find_dset(), PLUTO_prefix_ok(), and retrend.

Referenced by PLUGIN_init().

00140 {
00141    THD_3dim_dataset *input ;
00142    char *tag;
00143 
00144 
00145    /* New call, so reinitialize variables */
00146    low_fc=0; high_fc = 0; autocorr=FALSE; retrend=FALSE; output_prefix=NULL, idc=NULL;
00147 
00148    /*--------------------------------------------------------------------*/
00149    /*----- Check inputs from AFNI to see if they are reasonable-ish -----*/
00150 
00151    if( plint == NULL )
00152       return "*************************\n"
00153              "Fourier_Main:  NULL input\n"
00154              "*************************"  ;
00155 
00156 
00157    tag = PLUTO_get_optiontag(plint) ;
00158    while( tag != NULL ){
00159 
00160         if (strcmp(tag, "Input") == 0 ) {
00161            idc  = PLUTO_get_idcode(plint) ;
00162            input = PLUTO_find_dset(idc) ;
00163            if( input == NULL )
00164               return "********************************\n"
00165                      "Fourier_Main:  bad input dataset\n"
00166                      "********************************"  ;
00167         }
00168 
00169         else if (strcmp(tag, "Preprocess") == 0) {
00170                 ignore = PLUTO_get_number(plint);
00171                 retrend = strcmp(PLUTO_get_string(plint), "No");
00172         }
00173 
00174       else if( strcmp(tag,"Output") == 0 ){
00175          output_prefix = PLUTO_get_string(plint) ;
00176          if( ! PLUTO_prefix_ok(output_prefix) )
00177             return "*************************\n"
00178                    "Fourier_Main:  bad prefix\n"
00179                    "*************************"  ;
00180       }
00181 
00182       else if( strcmp(tag,"Lowpass") == 0 ){
00183          low_fc = PLUTO_get_number(plint);
00184       }
00185 
00186       else if( strcmp(tag,"Highpass") == 0 ){
00187          high_fc = PLUTO_get_number(plint);
00188       }
00189  
00190       else if( strcmp(tag,"Autocorrelate") == 0 ){
00191          autocorr=TRUE;
00192       }
00193 
00194       tag = PLUTO_get_optiontag(plint) ;
00195    }
00196 
00197    /*------------------------------------------------------*/
00198    /*---------- At this point, the inputs are OK ----------*/
00199 
00200    if ((output_prefix == NULL) || (idc == NULL)) /* must be setting up for 1D transform */
00201       return NULL ;
00202    else 
00203       return Fourier_Filter_Driver(plint, input, low_fc, high_fc, ignore, autocorr, retrend, output_prefix);  
00204 }

DEFINE_PLUGIN_PROTOTYPE PLUGIN_interface* PLUGIN_init int    ncall
 

Definition at line 80 of file plug_fourier.c.

References ANAT_ALL_MASK, autocorr, fourier_1D(), Fourier_Main(), FUNC_ALL_MASK, helpstring, high_fc, ignore, low_fc, output_prefix, PLUTO_add_hint(), PLUTO_register_1D_function, PLUTO_set_sequence(), retrend, and yn.

00081 {
00082    PLUGIN_interface * plint ;
00083    static char *yn[2] = {"No", "Yes"};
00084 
00085    if( ncall > 0 ) return NULL ;  /* only one interface */
00086 
00087    /*-- set titles and call point --*/
00088 
00089    /* Initialize variables so we can be a 1D transformer*/
00090    low_fc=0; high_fc = 0; ignore=1; autocorr=FALSE; retrend=FALSE; output_prefix=NULL; idc=NULL;
00091    PLUTO_register_1D_function( "Fourier", fourier_1D );
00092 
00093 
00094    plint = PLUTO_new_interface( "Fourier Stuff" , "Filtering, autocorrelation and other stuff done with FFTs" , helpstring ,
00095                                  PLUGIN_CALL_VIA_MENU , Fourier_Main  ) ;
00096 
00097    PLUTO_add_hint( plint , "Filtering, autocorrelation and other stuff done with FFTs" ) ;
00098 
00099    PLUTO_set_sequence( plint , "z:Ross" ) ;
00100    /*-- first line of input: Dataset --*/
00101 
00102    PLUTO_add_option( plint , "Input" , "Input" , FALSE ) ;
00103    PLUTO_add_dataset(plint , "Dataset" ,
00104                                     ANAT_ALL_MASK , FUNC_ALL_MASK ,
00105                                     DIMEN_4D_MASK | BRICK_ALLREAL_MASK ) ;
00106 
00107    /*-- second line of input: Prefix for output dataset --*/
00108 
00109    PLUTO_add_option( plint , "Output" , "Output" , FALSE ) ;
00110    PLUTO_add_string( plint , "Prefix" , 0, NULL , 19 ) ;
00111 
00112    /*-- third line of input: Preprocessing --*/
00113 
00114    PLUTO_add_option( plint , "Preprocess" , "Preprocess" , TRUE ) ;
00115    PLUTO_add_number( plint , "Ignore" ,  0, 10,  0, 1 , FALSE) ;
00116    PLUTO_add_string( plint, "Re-trend", 2, yn, 0); 
00117 
00118    /*-- fourth line of input: Lowpass option --*/
00119 
00120    PLUTO_add_option( plint , "Lowpass" , "Lowpass" , FALSE ) ;
00121    PLUTO_add_number( plint , "Fc" ,  0, 5000,  3, 0 , TRUE) ;
00122 
00123    /*-- fifth line of input: Highass option --*/
00124 
00125    PLUTO_add_option( plint , "Highpass" , "Highpass" , FALSE ) ;
00126    PLUTO_add_number( plint , "Fc" ,  0, 5000,  3, 0 , TRUE) ;
00127 
00128    /*-- sixt line of input: Autocorrelation option --*/
00129 /*
00130    PLUTO_add_option( plint , "Autocorrelate" , "Autocorrelate" , FALSE ) ;
00131  */
00132    return plint ;
00133 }

Variable Documentation

int autocorr [static]
 

Definition at line 54 of file plug_fourier.c.

Referenced by Fourier_Main(), and PLUGIN_init().

char helpstring[] [static]
 

Initial value:

   " Purpose: Do some common FFT manipulations of 3d+time data\n"
   " Inputs:\n"
   " Dataset = A 3d+time dataset in memory.\n"
   " Outputs:\n"
   " Prefix = Filename prefix to be usedfor the output dataset.\n"
   " Parameters:\n"
   " Preprocess: Data manipulations before/after filtering\n"
   "  Ignore: ignore the first n datapoints.  After filtering\n"
   "   these points are set to the value of the n+1th point\n"
   "   such that the timeseries is the same length\n"
   "  A linear trend is removed before any filtering is performed.\n"
   "   Setting retrend to 'Yes' restores this trend after filtering\n" 
   "   This is always yes for the 1D transform version\n"
   " Lowpass: Perform a low pass filtering of the data.\n"
   "  Fc is the frequency cutoff (in Hz).  Note that this is\n"
   "   typically a very small number.\n"
   " Highpass: Perform a high pass filtering of the data.\n"
   "  Fc is the frequency cutoff (in Hz).  Note that this is\n"
   "   typically a very small number.\n\n"
   " With appropriate combination of lowpass and highpass, a\n"
   "  bandpass (f_high < f_low) or notch (f_high > f_low)\n"
   "  filter can be made.\n"
   " Note that if multiple operations are chosen, they are performed\n"
   "  in the order listed.\n\n"
   " IMPORTANT: This plugin also sets the parameters for the 1D \n"
   "  transform named Fourier.  Thus, it is not necessary to have\n"
   "  an input and output.\n\n"
   " BY- T. Ross and K. Heimerl 8/99\n"

Definition at line 18 of file plug_fourier.c.

Referenced by PLUGIN_init().

float high_fc [static]
 

Definition at line 52 of file plug_fourier.c.

Referenced by fourier_1D(), Fourier_Main(), and PLUGIN_init().

MCW_idcode* idc [static]
 

Definition at line 55 of file plug_fourier.c.

int ignore [static]
 

Definition at line 54 of file plug_fourier.c.

Referenced by fourier_1D(), Fourier_Main(), and PLUGIN_init().

float low_fc [static]
 

Definition at line 52 of file plug_fourier.c.

Referenced by fourier_1D(), Fourier_Main(), and PLUGIN_init().

char* output_prefix [static]
 

Definition at line 53 of file plug_fourier.c.

Referenced by Fourier_Main(), and PLUGIN_init().

int retrend [static]
 

Definition at line 54 of file plug_fourier.c.

Referenced by Fourier_Main(), and PLUGIN_init().

 

Powered by Plone

This site conforms to the following standards: