//Function: Toggle Tools //Description: Toggles the tool bar visibility void TwoPhotonThread::toggleTools() { int visible; //Determine if tool window is visible imaqIsToolWindowVisible(&visible); //if window is visible, set to invisible; if not set to visible if(visible) imaqShowToolWindow(0); else imaqShowToolWindow(1); }
int sgl_attach_window(CameraSgl *camera, HWND attached, int left, int top, int width, int height, EventCallback callback) { camera->display_win = imaqGetSystemWindowHandle (camera->display_win_num); camera->attached_win = attached; camera->rect_show = MakeRect (top, left, height, width); //SetWindowLong( camera->display_win, GWL_STYLE, WS_CHILDWINDOW ); SetParent( camera->display_win, camera->attached_win); SetWindowLong( camera->display_win, GWL_STYLE, WS_CLIPSIBLINGS ); imaqSetWindowSize( camera->display_win_num, width, height ); // 显示工具条窗口 ToolWindowOptions twoptions; Point pos; int img_width, img_height; memset(&twoptions, 1, sizeof(twoptions)); twoptions.showZoomTool = TRUE; twoptions.showRectangleTool = TRUE; imaqSetupToolWindow (TRUE, 4, &twoptions); imaqGetWindowPos (camera->display_win_num, &pos); imaqGetWindowSize (camera->display_win_num, &img_width, &img_height); pos.x = pos.x + width; imaqMoveToolWindow (pos); imaqShowToolWindow (TRUE); // 注册工具条的回调处理 imaqSetEventCallback (callback, TRUE); return 0; }
//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 sgl_set_toolwindow_visible(CameraSgl *camera, bool32 visible) { int res; res = imaqShowToolWindow(visible); if (res) { return 0; } return -1; }