**CIGAL Reference Manual, Chapter 1 (Topics): PARADIGMS** ===== PARADIGMS -- Paradigm Overview ===== CIGAL's REALTIME command (see \L[REALTIME][2]) can be used to execute experiment paradigms under real-time control. This section describes some features of the current implementation of CIGAL for running functional MRI paradigms on the Macintosh. The PDIGMS menu (in the menu bar) can be used to access the standard paradigms currently being used at the MR Research Center at UPMC. This menu also provides several general fMRI features such as for entering scan parameters and checking the status of the analog and digital connections. A paradigm actually consists of 3 parts: the paradigm program (a CIGAL macro program such as CHECKER.IMP), a paradigm menu file (such as CHECKER.MNU), and a dialog resource (such as the "checker" DLOG and DITL entries in the file PARADIGMS.RSRC). Of these only the paradigm program is actually required, the menu file and its dialog resource are not required but do tend to make the paradigm easier to use. The paradigm program: Most paradigms are written in a standard format. This consists of the following 8 sections: 1) Code to declare data variables (note, most should be declared as GLOBAL). Many standard paradigm variables are also declared by the macro PDIGMINIT which is run when CIGAL starts up. These variables should be declared and initialized if they do not already exist or if the macro is called with 0 as the first argument. 2) Code to store the values of all important variables in a parameter file. This is executed when the first argument is 4 or 5; variable names and values are written using the DUMP command (see \L[DUMP][2]). 3) Code to create data displays if necessary. 4) A call to the PDIGMBLOCKS macro to convert the block sequence specified in the menu into tables giving the code value, block time and number of trials for each block. This step also checks to see if the paradigm is being run in PRACTICE mode, in which case the DISDAQS are ignored, or in TEST mode, in which case there are no DISDAQS and all block times are divided by 10 to run faster. 5) Code to generate data tables to be used for the individual trials. This section does most of the work of the paradigm by creating all the data necessary to specify the entire paradigm. Typically it includes some initialization steps and then a WHILE loop that makes entries appropriate for each individual block of trials. 6) A call to the READYSCAN macro to do standard steps like calculating the number of images per slice and waiting for the MR operator to finish scanner setup operations (including any prescanning). READYSCAN also allows you to call the NEAREAL menu to prepare for near real-time fMRI data analysis if that is desired. [Note: NEAREAL is not yet available] 7) The REALTIME command containing the code to be executed during the paradigm by the REALTIME processor. This code constitutes the paradigm itself, which mostly just steps through the data variables created in step 5 above. See \L[REALTIME][2] and \L[RT_PROCESSOR][6] for more on this. 8) Code to save the paradigm data, if the paradigm was run using the menu's START option (e.g. $1 == 1; TEST and PRACTICE run the paradigm but don't store any data). The data are written to a data management file using CIGAL's DMWRITE command (see \L[DMWRITE][2]). The SAVEPDDATA macro expects the paradigm name as an argument and then puts a copy of the paradigm program (e.g. the CHECKER.IMP file), a list of the paradigm's parameter settings, the REALTIME runlog, cardiac and respiratory data if collected, and a copy of the STIMREC file (created for use in AVS data analysis) into a single DM format file. The file name is specified using the scanner's study, series, and image numbers so these values must all be entered before the file is created. The paradigm menu file: The menu file is a standard CIGAL screen menu specification file. It lists the CIGAL commands that are to be executed when different fields in the displayed menu are activated. See \L[MENUS][1] for more on CIGAL menus. The DIALOG command is used to transfer values back and forth between the variables in the menu file and the displayed menu (see \L[DIALOG][3]). See \L[MENU][2] for how to load and control displayed menus. The paradigm menu resources: Typically a paradigm menu is associated with a DLOG and a DITL resource in the file PARADIGMS.RSRC. These resources are created using a resource editor such as RESEDIT (which is not part of the CIGAL package). The menu file and the menu resources should all have the same name (which currently can be no longer than 8 characters); this is usually the same as the name of the paradigm program. Once a menu file and its associated resources are created they are bound together and loaded into CIGAL's MENUS file using the MENU command (e.g. menu pdigmname 32). [Note: CIGAL will soon be able to create and edit resources directly, thus facilitating making dialog menus.] **See Also:**\\ [[jvs:cigal:manual:chapter3:dialog|DIALOG(3)]], [[jvs:cigal:manual:chapter2:dmwrite|DMWRITE(2)]], [[jvs:cigal:manual:chapter2:dump|DUMP(2)]], [[jvs:cigal:manual:chapter2:menu|MENU(2)]], [[jvs:cigal:manual:chapter1:menus|MENUS(1)]], [[jvs:cigal:manual:chapter2:realtime|REALTIME(2)]], [[jvs:cigal:manual:chapter6:rt_processor|RT_PROCESSOR(6)]] [[jvs:cigal|CIGAL Home]], [[jvs:cigal:manual|CIGAL Manual]], [[jvs:cigal:manual:chapter1|Topics List]], [[jvs:cigal:manual:help|Manual Help]]