static void gst_niimaqsrc_release_buffer (gpointer data) { GstNiImaqSrc *src = GST_NIIMAQSRC (data); imgSessionReleaseBuffer (src->sid); }
void AcquireThreadBasler::BaslerAcquire (void) { sprintf_s(intfName, "img0");//img0 Basler///img3 Atmel imgInterfaceOpen (intfName, &Iid); imgSessionOpen (Iid, &Sid); AcqWinWidth = globalOptions->IMAGEWIDTH; AcqWinHeight = globalOptions->IMAGEHEIGHT; imgSetAttribute2 (Sid, IMG_ATTR_ROI_WIDTH, AcqWinWidth); imgSetAttribute2 (Sid, IMG_ATTR_ROI_HEIGHT, AcqWinHeight); imgSessionTriggerConfigure2(Sid, IMG_SIGNAL_EXTERNAL, 0, IMG_TRIG_POLAR_ACTIVEH, 5000, IMG_TRIG_ACTION_BUFFER); for(int i=0; i<NUM_RING_BUFFERS; i++) ImaqBuffers[i] = NULL; // Setup and launch the ring acquisition imgRingSetup (Sid, NUM_RING_BUFFERS, (void**)ImaqBuffers, 0, TRUE); uInt32 currBufNum; //Infinite Loop //Temporarily we have incorporated an infinite loop. Stop the program execution by closing the program. //Threads can also be suspended and resumed via the start/stop buttons while (true) { DataFramePos = RawData; //Reset the DataFramePos pointer to the beginning, pointed to by RawData if (globalOptions->volumeReady < 1) { for (int framenum=0; framenum < globalOptions->NumFramesPerVol; framenum++) { if (breakLoop) break; imgSessionExamineBuffer2 (Sid, IMG_CURRENT_BUFFER , &currBufNum, (void**)&ImaqBuffer); if (!ImaqBuffer) { //Check if Basler Camera is on and properly connected printf("ERROR: Basler Camera is either off, or miscommunication with framegrabber.\n Exiting Program...\n"); Sleep(2000); exit(1); } memcpy(DataFramePos, ImaqBuffer, AcqWinHeight*AcqWinWidth*sizeof(unsigned short)); DataFramePos = &DataFramePos[AcqWinHeight*AcqWinWidth]; imgSessionReleaseBuffer (Sid); if(!globalOptions->bVolumeScan) DataFramePos = RawData; } if (breakLoop) { breakLoop = false; //Reset the breakLoop flag after each time } else { globalOptions->volumeReady++; } } else { if(globalOptions->saveVolumeflag == true) { fwrite(DataFramePos,2,AcqWinWidth*AcqWinHeight*globalOptions->NumFramesPerVol,globalOptions->fid); globalOptions->saveVolumeflag =false; fclose(globalOptions->fid); ScanThrPtr->InitializeSyncAndScan(); } globalOptions->volumeReady = 0; } } }