/* * Sets up data recording and video recording * Will record video if exp->RECORDVID is 1 * and record data if exp->RECORDDATA is 1 * */ int SetupRecording(Experiment* exp) { printf("About to setup recording\n"); char* DataFileName; if (exp->RECORDDATA) { if (exp->dirname == NULL || exp->outfname == NULL) printf("exp->dirname or exp->outfname is NULL!\n"); /** Setup Writing and Write Out Comments **/ exp->DataWriter = SetUpWriteToDisk(exp->dirname,exp->outfname, exp->Worm->MemStorage); /** We should Quit Now if any of the data Writing is not working **/ if (exp->DataWriter->error < 0 ) return -1; /** Write the Command Line argument Out for reference **/ WriteOutCommandLineArguments(exp->DataWriter, exp->argc, exp->argv); /** Write out the default grid size for non-protocol based illumination **/ WriteOutDefaultGridSize(exp->DataWriter, exp->Params); /** Write the Protocol Out for reference **/ if (exp->pflag) { WriteProtocol(exp->p, exp->DataWriter->fs); } BeginToWriteOutFrames(exp->DataWriter); printf("Initialized data recording\n"); DestroyFilename(&DataFileName); } /** Set Up Video Recording **/ char* MovieFileName; char* HUDSFileName; if (exp->RECORDVID) { if (exp->dirname == NULL || exp->outfname == NULL) printf("exp->dirname or exp->outfname is NULL!\n"); MovieFileName = CreateFileName(exp->dirname, exp->outfname, ".avi"); HUDSFileName = CreateFileName(exp->dirname, exp->outfname, "_HUDS.avi"); exp->Vid = cvCreateVideoWriter(MovieFileName, CV_FOURCC('M','J','P','G'), 30, cvSize(NSIZEX / 2, NSIZEY / 2), 0); exp->VidHUDS = cvCreateVideoWriter(HUDSFileName, CV_FOURCC('M','J','P','G'), 30, cvSize(NSIZEX / 2, NSIZEY / 2), 0); if (exp->Vid ==NULL ) printf("\tERROR in SetupRecording! exp->Vid is NULL\n"); if (exp->VidHUDS ==NULL ) printf("\tERROR in SetupRecording! exp->VidHUDS is NULL\n"); DestroyFilename(&MovieFileName); DestroyFilename(&HUDSFileName); printf("Initialized video recording\n"); } return 0; }
logical ErrorHandle :: DisplayMessage (Error *error_obj ) { char string[129]; char string1[10]; char buffer[sizeof(message.text)+1]; ProcessInfo *procinfo; BEGINSEQ if ( TestSysVariable("SUPRESS_ERRORS","YES") ) LEAVESEQ procinfo = ThreadEntry::GetCurProcInfo(); if ( procinfo ) WriteProtocol(error_obj,procinfo->GetProtocolFile()); if ( error_obj ) message.SetData(error_obj); if ( !gui_message ) { if ( TestSysVariable("NO_CONSOLE_MESSAGES","YES") ) LEAVESEQ puts(gvtxbts(buffer,message.text,StringLength(message.text,sizeof(message.text)))); LEAVESEQ } if ( gui_message != YES ) // temporary enabled gui_message = NO; #ifndef __unix__ int type = MB_OK | MB_TOPMOST; if ( error_obj ) switch ( error_obj->type ) { case 'D' : type = MB_OKCANCEL; case 'M' : type |= MB_ICONQUESTION; break; case 'S' : case 'I' : type |= MB_ICONINFORMATION; break; case 'W' : type |= MB_ICONWARNING; break; default : type |= MB_ICONERROR; } else type = MB_ICONERROR; gvtxbts(string,message.component,19); strcat(string," "); strcat(string,gvtxbts(string1,message.error_code,4)); MessageBox(NULL, message.text, string, type); #else if // hier fehlt noch der XWIN-Teil #endif RECOVER ENDSEQ return(NO); }
/* * Write everything out to its own seperate YAML file * */ void WriteProtocolToYAML(Protocol* myP){ /** Open file for writing **/ printf("We are about to write out a protocol. Here is some info about the protocol.:\n"); printf("The protocol has %d steps.\n",myP->Steps->total); CvFileStorage* fs=cvOpenFileStorage(myP->Filename,myP->memory,CV_STORAGE_WRITE); if (fs==0){ printf("fs is zero! Could you have specified the wrong directory?\n"); return; } printf("Writing to %s\n",myP->Filename); /** Write out Generic comments **/ cvWriteComment(fs, "Illumination Protocol:",0); cvWriteComment(fs, "Generated by the IlluminationWormProtocol Library \nmade by [email protected]",0); cvWriteComment(fs, "\nSoftware Version Information:",0); cvWriteComment(fs, build_git_sha,0); cvWriteComment(fs, build_git_time,0); cvWriteComment(fs, "\n",0); printf("wrote comments\n"); WriteProtocol(myP,fs); cvReleaseFileStorage(&fs); }