//Function: Constructor //Description: Creates pointers to data structures contained by TwoPhotonGui to set up acquisition // Sets up Vision modules TwoPhotonThread::TwoPhotonThread(ScanEngine *scanEngi, AcqEngine *acqEngi, DataFile2P *data2Pi, zStepperDriver *zStepper, AomControl *aCtrl) { scanEng = scanEngi; acqEng = acqEngi; data2P = data2Pi; zStep = *zStepper; aomCtrl = aCtrl; Point toolPos; toolPos.x=850; toolPos.y=20; //temporary scaling scaleMin1 = 0; scaleMax1 = 32767; scaleMin2 = 0; scaleMax2 = 32767; //Setup diplay and display tools using NIVision calls image1 = imaqCreateImage(IMAQ_IMAGE_RGB, 0); displayWinNum1 = 1; imaqDisplayImage(image1, displayWinNum1, 1); imaqSetWindowTitle(1, "PMT Images"); imaqSetWindowSize(1, 256, 256); posWindow1.x = 850; posWindow1.y = 300; imaqMoveWindow(1, posWindow1); imaqShowToolWindow (TRUE); imaqMoveToolWindow(toolPos); imaqSetCurrentTool (IMAQ_POLYLINE_TOOL); image2 = imaqCreateImage(IMAQ_IMAGE_U8, 0); displayWinNum2 = 2; imaqDisplayImage(image2, displayWinNum2, 1); imaqSetWindowTitle(2, "ROI Images"); imaqSetWindowSize(2, 256, 256); posWindow2.x = 850; posWindow2.y = 590; imaqMoveWindow(2, posWindow2); intScalingCoeff = 1.0; bScaleCoeffCalc = false; //Allocate memory for display arrays. imageData1 = new RGBValue[acqEng->getnumValidXSamps() * acqEng->getnumValidYSamps()]; imageData2 = new unsigned char[acqEng->getWidth() * acqEng->getRepeats()]; bContinuous = false; bLifetimeFov = false; bLinescan = false; }
int CVICALLBACK Thresholding (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { int threshold = 0; int histogram[256] = {0}; HistogramReport *report = NULL; switch (event) { case EVENT_COMMIT: GetCtrlVal (mypanel, MYPANEL_THRESHOLD_SLIDE, &threshold); imaqThreshold (destimage, sourimage, threshold, 255, TRUE, 255); imaqSetWindowTitle (1, "Picture after binaryzation"); imaqMoveWindow (1, imaqMakePoint (150, 260)); imaqDisplayImage (destimage, 1, TRUE); report = imaqHistogram (destimage, 256, 0, 255, IMAQ_IMAGE_U8); DeleteGraphPlot (mypanel, MYPANEL_MYGRAPH, -1, VAL_IMMEDIATE_DRAW); PlotY (mypanel, MYPANEL_MYGRAPH, (*report).histogram, 256, VAL_UNSIGNED_INTEGER, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1, VAL_RED); break; } return 0; }