Doxygen Source Code Documentation
plug_zeropad.c File Reference
#include "afni.h"
Go to the source code of this file.
Functions | |
char * | ZPAD_main (PLUGIN_interface *) |
DEFINE_PLUGIN_PROTOTYPE PLUGIN_interface * | PLUGIN_init (int ncall) |
Variables | |
char | helpstring [] |
Function Documentation
|
Definition at line 41 of file plug_zeropad.c. References ANAT_ALL_MASK, FUNC_ALL_MASK, helpstring, NUM_DSET_TYPES, PLUTO_add_hint(), PLUTO_set_runlabels(), PLUTO_set_sequence(), and ZPAD_main().
00042 { 00043 PLUGIN_interface * plint ; 00044 00045 if( ncall > 0 ) return NULL ; /* only one interface */ 00046 00047 /*-- set titles and call point --*/ 00048 00049 plint = PLUTO_new_interface( "Dset Zeropad" , 00050 "Make a Zero-Padded Copy of a Dataset" , 00051 helpstring , 00052 PLUGIN_CALL_VIA_MENU , ZPAD_main ) ; 00053 00054 PLUTO_add_hint( plint , "Copy and Zero-Pad a Dataset" ) ; 00055 00056 PLUTO_set_sequence( plint , "A:newdset:copy" ) ; 00057 00058 PLUTO_set_runlabels( plint , "Copy+Keep" , "Copy+Close" ) ; /* 04 Nov 2003 */ 00059 00060 /*-- first line of input: Dataset --*/ 00061 00062 PLUTO_add_option( plint , "Input" , "Input" , TRUE ) ; 00063 PLUTO_add_dataset(plint , "Dataset" , 00064 ANAT_ALL_MASK , FUNC_ALL_MASK , 00065 DIMEN_ALL_MASK | BRICK_ALLTYPE_MASK ) ; 00066 00067 /*-- second line of input: Prefix for output dataset --*/ 00068 00069 PLUTO_add_option( plint , "Output" , "Output" , TRUE ) ; 00070 PLUTO_add_string( plint , "Prefix" , 0,NULL , 19 ) ; 00071 00072 /*-- 3rd line of input: padding --*/ 00073 00074 PLUTO_add_option( plint , "Padding" , "Padding" , TRUE ) ; 00075 PLUTO_add_number( plint , "I" , -19 , 19 , 0 , 0 , FALSE ) ; 00076 PLUTO_add_number( plint , "S" , -19 , 19 , 0 , 0 , FALSE ) ; 00077 PLUTO_add_number( plint , "A" , -19 , 19 , 0 , 0 , FALSE ) ; 00078 PLUTO_add_number( plint , "P" , -19 , 19 , 0 , 0 , FALSE ) ; 00079 PLUTO_add_number( plint , "L" , -19 , 19 , 0 , 0 , FALSE ) ; 00080 PLUTO_add_number( plint , "R" , -19 , 19 , 0 , 0 , FALSE ) ; 00081 00082 /*-- 4th line of input: Type option --*/ 00083 00084 PLUTO_add_option( plint , "Dataset" , "Dataset" , FALSE ) ; 00085 PLUTO_add_string( plint , "Type" , NUM_DSET_TYPES,DSET_prefixstr , 0 ) ; 00086 00087 return plint ; 00088 } |
|
Definition at line 94 of file plug_zeropad.c. References ADN_func_type, ADN_none, ADN_type, DSET_delete, DSET_unload, EDIT_dset_items(), HEAD_ANAT_TYPE, HEAD_FUNC_TYPE, LAST_FUNC_TYPE, NUM_DSET_TYPES, PLUTO_add_dset(), PLUTO_find_dset(), PLUTO_prefix_ok(), PLUTO_string_index(), THD_zeropad(), THD_3dim_dataset::type, and ZPAD_PURGE. Referenced by PLUGIN_init().
00095 { 00096 char * tag , * new_prefix , * cpt ; 00097 MCW_idcode * idc ; 00098 THD_3dim_dataset * dset , * new_dset ; 00099 int ftyp=-1 , dtyp=-1 , ival ; 00100 int add_I, add_S, add_A, add_P, add_L, add_R; 00101 00102 /*--------------------------------------------------------------------*/ 00103 /*----- Check inputs from AFNI to see if they are reasonable-ish -----*/ 00104 00105 if( plint == NULL ) 00106 return "**********************\n" 00107 "ZPAD_main: NULL input\n" 00108 "**********************" ; 00109 00110 PLUTO_next_option(plint) ; 00111 idc = PLUTO_get_idcode(plint) ; 00112 dset = PLUTO_find_dset(idc) ; 00113 if( dset == NULL ) 00114 return "*****************************\n" 00115 "ZPAD_main: bad input dataset\n" 00116 "*****************************" ; 00117 00118 dtyp = dset->type ; 00119 00120 PLUTO_next_option(plint) ; 00121 new_prefix = PLUTO_get_string(plint) ; 00122 if( ! PLUTO_prefix_ok(new_prefix) ) 00123 return "**********************\n" 00124 "ZPAD_main: bad prefix\n" 00125 "**********************" ; 00126 00127 PLUTO_next_option(plint) ; 00128 add_I = PLUTO_get_number(plint) ; 00129 add_S = PLUTO_get_number(plint) ; 00130 add_A = PLUTO_get_number(plint) ; 00131 add_P = PLUTO_get_number(plint) ; 00132 add_L = PLUTO_get_number(plint) ; 00133 add_R = PLUTO_get_number(plint) ; 00134 if( add_I==0 && add_S==0 && add_P==0 && add_A==0 && add_L==0 && add_R==0 ) 00135 return "***********************\n" 00136 "ZPAD_main: no padding?!\n" 00137 "***********************" ; 00138 00139 tag = PLUTO_get_optiontag(plint) ; 00140 while( tag != NULL ){ 00141 00142 if( strcmp(tag,"Dataset") == 0 ){ 00143 cpt = PLUTO_get_string(plint) ; 00144 ftyp = PLUTO_string_index( cpt , NUM_DSET_TYPES,DSET_prefixstr ) ; 00145 if( ftyp >= 0 ){ 00146 if( ftyp <= LAST_FUNC_TYPE ){ 00147 dtyp = HEAD_FUNC_TYPE ; 00148 } else { 00149 ftyp -= (LAST_FUNC_TYPE+1) ; /* 14 Jul 1998 */ 00150 dtyp = HEAD_ANAT_TYPE ; 00151 } 00152 } 00153 } 00154 00155 tag = PLUTO_get_optiontag(plint) ; 00156 } 00157 00158 /*------------------------------------------------------*/ 00159 /*---------- At this point, the inputs are OK ----------*/ 00160 00161 /*-- make a new dataset --*/ 00162 00163 new_dset = THD_zeropad( dset , 00164 add_I, add_S, add_A, add_P, add_L, add_R, 00165 new_prefix , ZPAD_PURGE ) ; 00166 00167 if( new_dset == NULL ) 00168 return "****************************************\n" 00169 "ZPAD_main: failed to create new dataset\n" 00170 "****************************************" ; 00171 00172 DSET_unload( dset ) ; /* unload old one from memory */ 00173 00174 /*--- modify dataset, if desired ---*/ 00175 00176 if( ftyp >= 0 ) EDIT_dset_items( new_dset , 00177 ADN_type , dtyp , 00178 ADN_func_type , ftyp , 00179 ADN_none ) ; 00180 00181 ival = PLUTO_add_dset( plint , new_dset , DSET_ACTION_MAKE_CURRENT ) ; 00182 00183 if( ival ){ 00184 DSET_delete(new_dset) ; 00185 return "**********************************************\n" 00186 "ZPAD_main: failure to add new dataset to AFNI\n" 00187 "**********************************************" ; 00188 } 00189 00190 /*-- done successfully!!! --*/ 00191 00192 return NULL ; 00193 } |
Variable Documentation
|
Initial value: " Purpose: Creating a zero-padded copy of a dataset [like 3dZeropad].\n" " Inputs:\n" " Dataset = A dataset in the current session that exists in memory\n" " (not warp-on-demand).\n" " Prefix = Filename prefix to be used for the output dataset.\n" " Type = Lets you change the 'type' of the output dataset, for\n" " example from anat to func.\n" " Padding = I, S, A, P, L, R = number of planes to add (or subtract)\n" " at the Inferior, Superior, Anterior, Posterior, Left,\n" " and Right edges, respectively.\n" "\n" "Author -- RWCox - Oct 2000" Definition at line 19 of file plug_zeropad.c. Referenced by PLUGIN_init(). |