Im2D_U_INT1 Window_Maker(SpatioTempImage aIm, Pt2di aCtrPt, int aSzW) { //cout << "Creating Window for " << aCtrPt << endl; Im2D_U_INT1 aWindow(1 + 2 * aSzW, 1 + 2 * aSzW, 0); float aWSum = 0; for (int i = -aSzW; i <= aSzW; i++) { vector<float> aLine; for (int j = -aSzW; j <= aSzW; j++) { aWindow.data()[i + aSzW][j + aSzW] =(unsigned char) aIm.RChan.data()[aCtrPt.y + j][aCtrPt.x + i]; aWSum = aWSum + aIm.RChan.data()[aCtrPt.y + j][aCtrPt.x + i]; } } //cout << "Normalization" << endl; //Normalization /* for (int i = 0; i < aWindow.sz().x ; i++) { for (int j = 0; j < aWindow.sz().y; j++) { aWindow.data()[i][j] = aWindow.data()[i][j] / aWSum; } } */ //cout << aWindow << endl; return aWindow; }
int ascanf_getstring ( ASCB_ARGLIST ) { ASCB_FRAME_SHORT ascanf_Function *s1= NULL, *ret= NULL, *title= NULL, *msg= NULL; ascanf_Function *af= NULL; static ascanf_Function AF= {NULL}; static char *AFname= "GetString-Static-StringPointer"; int take_usage, maxlen= -1; FILE *fp= NULL; af= &AF; if( af->name ){ double oa= af->own_address; xfree(af->usage); memset( af, 0, sizeof(ascanf_Function) ); af->own_address= oa; } else{ af->usage= NULL; af->type= _ascanf_variable; af->internal= True; af->name= AFname; take_ascanf_address(af); } af->name= AFname; af->type= _ascanf_variable; af->internal= True; ascanf_arg_error= 0; if( ascanf_arguments> 0 ){ if( !(s1= parse_ascanf_address(args[0], _ascanf_variable, "ascanf_getstring", (int) ascanf_verbose, &take_usage )) || !take_usage ){ fprintf( StdErr, " (warning: 1st argument is not a valid stringpointer)== " ); ret= s1= NULL; maxlen= (int) args[0]; } else{ ret= s1; maxlen= ret->value; } } if( ascanf_arguments> 1 ){ if( !(msg= parse_ascanf_address(args[1], 0, "ascanf_getstring", (int) ascanf_verbose, NULL )) || (msg->type== _ascanf_procedure || msg->type== _ascanf_function || !msg->usage ) ){ fprintf( StdErr, " (warning: message (2nd) argument is not a valid string)== " ); if( msg && msg->fp ){ fp= msg->fp; } msg= NULL; } else if( msg && msg->fp ){ fp= msg->fp; } } if( !fp && ascanf_arguments> 2 ){ if( !(title= parse_ascanf_address(args[2], 0, "ascanf_getstring", (int) ascanf_verbose, NULL )) || (title->type== _ascanf_procedure || title->type== _ascanf_function || !title->usage ) ){ fprintf( StdErr, " (warning: title (3rd) argument is not a valid string)== " ); title= NULL; } } if( ret ){ af= ret; } af->is_address= af->take_address= True; af->is_usage= af->take_usage= True; if( !ascanf_SyntaxCheck ){ LocalWin *wi= aWindow(ActiveWin); if( maxlen> 0 && (wi || fp) ){ ALLOCA( buf, char, maxlen, blen ); char *nbuf; if( fp ){ xfree( af->usage ); if( (nbuf= fgets( buf, maxlen-1, fp )) ){ af->usage= strdup(nbuf); } else{ af->value= 0; } } else{ if( s1 && s1->usage ){ strncpy( buf, s1->usage, maxlen-1 ); buf[maxlen-1]= '\0'; } else{ buf[0]= '\0'; } if( wi && (nbuf= xtb_input_dialog( wi->window, buf, (*buf)? strlen(buf)* 1.5 : 80, maxlen, (msg)? parse_codes(msg->usage) : "Please enter a string", (title)? parse_codes(title->usage) :parse_codes( "#x01Request"), /* should this one be modal??? */ False, NULL, NULL, "Files", SimpleFileDialog_h_ptr, "Edit", SimpleEdit_h_ptr )) ){ xfree( af->usage ); if( ret ){ ret->usage= strdup(nbuf); } else{ af->usage= strdup(nbuf); } if( nbuf!= buf ){ xfree(nbuf); } } else{ af->value= 0; } } } else{ ascanf_emsg= "invalid max. string length or no active window!"; ascanf_arg_error= True; } } *result= af->own_address; return(!ascanf_arg_error); }