Mat thresholdImage(ControlsWindow* controlsWindow, Mat image) { Mat hsvFrame; cvtColor(image, hsvFrame, CV_BGR2HSV); //profiler shows this is SLOW vector<Mat> channels; split(hsvFrame, channels); Mat hue = channels.at(0); Mat sat = channels.at(1); Mat val = channels.at(2); int minHue = min(controlsWindow->getMinHue(), controlsWindow->getMaxHue()); int maxHue = max(controlsWindow->getMinHue(), controlsWindow->getMaxHue()); int minSat = min(controlsWindow->getMinSat(), controlsWindow->getMaxSat()); int maxSat = max(controlsWindow->getMinSat(), controlsWindow->getMaxSat()); int minVal = min(controlsWindow->getMinVal(), controlsWindow->getMaxVal()); int maxVal = max(controlsWindow->getMinVal(), controlsWindow->getMaxVal()); Mat mask; inRange(hsvFrame, Scalar(minHue, minSat, minVal), Scalar(maxHue, maxSat, maxVal), mask); Mat newMask; threshold(mask, newMask, 0, 255, CV_THRESH_BINARY); return applyMask(image, newMask); }
void InspectorServerRequestHandlerQt::webSocketReadyRead() { Q_ASSERT(m_tcpConnection); if (!m_tcpConnection->bytesAvailable()) return; QByteArray content = m_tcpConnection->read(m_tcpConnection->bytesAvailable()); m_data.append(content); while (m_data.size() > 0) { const bool isMasked = m_data[1] & 0x80; quint64 payloadLen = m_data[1] & 0x7F; int pos = 2; if (payloadLen == 126) { payloadLen = qFromBigEndian<quint16>(*reinterpret_cast<quint16*>(m_data.mid(pos, 2).data())); pos = 4; } else if (payloadLen == 127) { payloadLen = qFromBigEndian<quint64>(*reinterpret_cast<quint64*>(m_data.mid(pos, 8).data())); pos = 8; } QByteArray payload; if (isMasked) { QByteArray maskingKey = m_data.mid(pos, 4); pos += 4; payload = applyMask(m_data.mid(pos, payloadLen), maskingKey); } else payload = m_data.mid(pos, payloadLen); // Handle fragmentation if (!(m_data[0] & 0x80)) { // Non-last fragmented payload m_fragmentedPayload.append(payload); m_data = m_data.mid(pos + payloadLen); continue; } if (!(m_data[0] & 0x0F)) { // Last fragment m_fragmentedPayload.append(payload); payload = m_fragmentedPayload; m_fragmentedPayload.clear(); } // Remove this WebSocket message from m_data (payload, start-of-frame byte, end-of-frame byte). // Truncate data before delivering message in case of re-entrancy. m_data = m_data.mid(pos + payloadLen); #if ENABLE(INSPECTOR) if (m_inspectorClient) { InspectorController* inspectorController = m_inspectorClient->m_inspectedWebPage->page->inspectorController(); inspectorController->dispatchMessageFromFrontend(QString::fromUtf8(payload)); } #endif } }
void convertImages(Arguments* args){ char** mask = NULL; TwoPoints source, dest; FILE* eyeList; char line[ FILE_LINE_LENGTH ]; char filename[MAX_FILENAME_LENGTH]; char imagename[MAX_FILENAME_LENGTH]; char suffix[MAX_FILENAME_LENGTH]; int i; scaleArgs(args, args->scale); dest.x1 = args->eyeLx; dest.y1 = args->eyeLy; dest.x2 = args->eyeRx; dest.y2 = args->eyeRy; /* Prepare file suffix encoding preprocessing settings, blank if not requested */ if (args->configSuffix) { sprintf(suffix,"_%s", imageSuffix(args)); } else { suffix[0] = '\0'; } if(args->maskType == CL_YES){ MESSAGE("Creating Mask."); mask = generateMask(args->sizeWidth, args->sizeHeight, args->ellipseX, args->ellipseY, args->ellipseA, args->ellipseB); } eyeList = fopen(args->eyeFile,"r"); DEBUG_CHECK(eyeList,"Error opening eye coordinates file"); for(i = 1;;i++){ Image pgm; Image geo; Matrix transform; fgets(line, FILE_LINE_LENGTH, eyeList); if(feof(eyeList)) break; if(sscanf(line,"%s %lf %lf %lf %lf",filename, &(source.x1), &(source.y1), &(source.x2), &(source.y2)) != 5){ printf("Error parsing line %d of eye coordinate file. Exiting...",i); exit(1); } /* shift the eye coordinates if neccessary */ source.x1 += args->shiftX; source.y1 += args->shiftY; source.x2 += args->shiftX; source.y2 += args->shiftY; sprintf(imagename,"%s\\%s.pgm",args->inputDir,filename); MESSAGE1ARG("Processing image: %s",filename); pgm = readPGMImage(imagename); if(args->histType == HIST_PRE){ DEBUG(1," Performing Pre Histogram Equalization."); histEqual(pgm,256); } if(args->preNormType == CL_YES){ DEBUG(1," Performing Pre Pixel Normalization."); ZeroMeanOneStdDev(pgm); } if(args->preEdge){ smoothImageEdge(pgm, args->preEdge); } if(args->geoType == CL_YES){ DEBUG(1," Performing Geometric Normalization."); transform = generateTransform(&source,&dest,args->reflect); geo = transformImage(pgm,args->sizeWidth,args->sizeHeight,transform); } else{ transform = makeIdentityMatrix(3); geo = transformImage(pgm,args->sizeWidth,args->sizeHeight,transform); } if(args->noise != 0.0){ DEBUG(1," Adding Gausian Noise."); gaussianNoise(geo,args->noise); } if(args->histType == HIST_POST){ DEBUG(1," Performing Post Histogram Equalization."); histEqualMask(geo,256, (const char**) mask); } if(args->nrmType == CL_YES){ DEBUG(1," Performing final value normalization and Applying Mask."); ZeroMeanOneStdDevMasked(geo, (const char **) mask); } else{ DEBUG(1," No Value Normalization. Just Applying Mask."); applyMask(geo, (const char **) mask); } if(args->postEdge){ smoothImageEdge(geo, args->postEdge); } if(args->nrmDir){ sprintf(imagename,"%s\\%s%s.nrm", args->nrmDir, filename, suffix); DEBUG_STRING(1," Saving nrm: %s",imagename); writeFeretImage(geo,imagename); } if(args->pgmDir){ sprintf(imagename,"%s\\%s%s.pgm", args->pgmDir, filename, suffix); DEBUG_STRING(1," Saving pgm: %s",imagename); writePGMImage(geo,imagename,0); } if(args->sfiDir){ sprintf(imagename,"%s\\%s%s.sfi", args->sfiDir, filename, suffix); DEBUG_STRING(1," Saving sfi: %s",imagename); writeRawImage(geo,imagename); } freeImage(geo); freeImage(pgm); freeMatrix(transform); } fclose(eyeList); }
InstrumentWindowMaskTab::InstrumentWindowMaskTab(InstrumentWindow* instrWindow): InstrumentWindowTab(instrWindow), m_activity(Select), m_hasMaskToApply(false), m_userEditing(true) { // main layout QVBoxLayout* layout=new QVBoxLayout(this); m_activeTool = new QLabel(this); layout->addWidget(m_activeTool); // Create the tool buttons m_move = new QPushButton(); m_move->setCheckable(true); m_move->setAutoExclusive(true); m_move->setIcon(QIcon(":/PickTools/zoom.png")); m_move->setToolTip("Move the instrument (Ctrl+Alt+M)"); m_move->setShortcut(QKeySequence("Ctrl+Alt+M")); m_pointer = new QPushButton(); m_pointer->setCheckable(true); m_pointer->setAutoExclusive(true); m_pointer->setIcon(QIcon(":/MaskTools/selection-edit.png")); m_pointer->setToolTip("Select and edit shapes (Ctrl+Alt+P)"); m_pointer->setShortcut(QKeySequence("Ctrl+Alt+P")); m_ellipse = new QPushButton(); m_ellipse->setCheckable(true); m_ellipse->setAutoExclusive(true); m_ellipse->setIcon(QIcon(":/MaskTools/selection-circle.png")); m_ellipse->setToolTip("Draw an ellipse (Ctrl+Alt+E)"); m_ellipse->setShortcut(QKeySequence("Ctrl+Alt+E")); m_rectangle = new QPushButton(); m_rectangle->setCheckable(true); m_rectangle->setAutoExclusive(true); m_rectangle->setIcon(QIcon(":/MaskTools/selection-box.png")); m_rectangle->setToolTip("Draw a rectangle (Ctrl+Alt+R)"); m_rectangle->setShortcut(QKeySequence("Ctrl+Alt+R")); m_ring_ellipse = new QPushButton(); m_ring_ellipse->setCheckable(true); m_ring_ellipse->setAutoExclusive(true); m_ring_ellipse->setIcon(QIcon(":/MaskTools/selection-circle-ring.png")); m_ring_ellipse->setToolTip("Draw an elliptical ring (Shift+Alt+E)"); m_ring_ellipse->setShortcut(QKeySequence("Shift+Alt+E")); m_ring_rectangle = new QPushButton(); m_ring_rectangle->setCheckable(true); m_ring_rectangle->setAutoExclusive(true); m_ring_rectangle->setIcon(QIcon(":/MaskTools/selection-box-ring.png")); m_ring_rectangle->setToolTip("Draw a rectangular ring (Shift+Alt+R)"); m_ring_rectangle->setShortcut(QKeySequence("Shift+Alt+R")); QHBoxLayout* toolBox = new QHBoxLayout(); toolBox->addWidget(m_move); toolBox->addWidget(m_pointer); toolBox->addWidget(m_ellipse); toolBox->addWidget(m_rectangle); toolBox->addWidget(m_ring_ellipse); toolBox->addWidget(m_ring_rectangle); toolBox->addStretch(); toolBox->setSpacing(2); toolBox->setMargin(0); connect(m_move,SIGNAL(clicked()),this,SLOT(setActivity())); connect(m_pointer,SIGNAL(clicked()),this,SLOT(setActivity())); connect(m_ellipse,SIGNAL(clicked()),this,SLOT(setActivity())); connect(m_rectangle,SIGNAL(clicked()),this,SLOT(setActivity())); connect(m_ring_ellipse,SIGNAL(clicked()),this,SLOT(setActivity())); connect(m_ring_rectangle,SIGNAL(clicked()),this,SLOT(setActivity())); m_move->setChecked(true); QFrame* toolGroup = new QFrame(); toolGroup->setLayout(toolBox); layout->addWidget(toolGroup); // create mask/group switch m_masking_on = new QRadioButton("Mask"); m_grouping_on = new QRadioButton("Group"); m_masking_on->setChecked(true); connect(m_masking_on,SIGNAL(toggled(bool)),this,SLOT(toggleMaskGroup(bool))); QHBoxLayout* radioLayout = new QHBoxLayout(); radioLayout->addWidget(m_masking_on); radioLayout->addWidget(m_grouping_on); radioLayout->setMargin(0); QWidget* radioGroup = new QWidget(); radioGroup->setLayout(radioLayout); layout->addWidget(radioGroup); // Create property browser /* Create property managers: they create, own properties, get and set values */ m_groupManager = new QtGroupPropertyManager(this); m_doubleManager = new QtDoublePropertyManager(this); connect(m_doubleManager,SIGNAL(propertyChanged(QtProperty*)),this,SLOT(doubleChanged(QtProperty*))); /* Create editors and assign them to the managers */ DoubleEditorFactory *doubleEditorFactory = new DoubleEditorFactory(this); m_browser = new QtTreePropertyBrowser(); m_browser->setFactoryForManager(m_doubleManager, doubleEditorFactory); layout->addWidget(m_browser); // Algorithm buttons m_apply = new QPushButton("Apply to Data"); m_apply->setToolTip("Apply current mask to the data workspace. Cannot be reverted."); connect(m_apply,SIGNAL(clicked()),this,SLOT(applyMask())); m_apply_to_view = new QPushButton("Apply to View"); m_apply_to_view->setToolTip("Apply current mask to the view."); connect(m_apply_to_view,SIGNAL(clicked()),this,SLOT(applyMaskToView())); m_clear_all = new QPushButton("Clear All"); m_clear_all->setToolTip("Clear all masking that have not been applied to the data."); connect(m_clear_all,SIGNAL(clicked()),this,SLOT(clearMask())); m_save_as_workspace_exclude = new QAction("As Mask to workspace",this); m_save_as_workspace_exclude->setToolTip("Save current mask to mask workspace."); connect(m_save_as_workspace_exclude,SIGNAL(activated()),this,SLOT(saveMaskToWorkspace())); m_save_as_workspace_include = new QAction("As ROI to workspace",this); m_save_as_workspace_include->setToolTip("Save current mask as ROI to mask workspace."); connect(m_save_as_workspace_include,SIGNAL(activated()),this,SLOT(saveInvertedMaskToWorkspace())); m_save_as_file_exclude = new QAction("As Mask to file",this); m_save_as_file_exclude->setToolTip("Save current mask to mask file."); connect(m_save_as_file_exclude,SIGNAL(activated()),this,SLOT(saveMaskToFile())); m_save_as_file_include = new QAction("As ROI to file",this); m_save_as_file_include->setToolTip("Save current mask as ROI to mask file."); connect(m_save_as_file_include,SIGNAL(activated()),this,SLOT(saveInvertedMaskToFile())); m_save_as_cal_file_exclude = new QAction("As Mask to cal file",this); m_save_as_cal_file_exclude->setToolTip("Save current mask to cal file."); connect(m_save_as_cal_file_exclude,SIGNAL(activated()),this,SLOT(saveMaskToCalFile())); m_save_as_cal_file_include = new QAction("As ROI to cal file",this); m_save_as_cal_file_include->setToolTip("Save current mask as ROI to cal file."); connect(m_save_as_cal_file_include,SIGNAL(activated()),this,SLOT(saveInvertedMaskToCalFile())); m_save_as_table_xrange_exclude = new QAction("As Mask to table", this); m_save_as_table_xrange_exclude->setToolTip("Save current mask to a table workspace with x-range. " "The name of output table workspace is 'MaskBinTable'. " "If the output table workspace has alrady exist, then " "the newly masked detectors will be added to output workspace."); connect(m_save_as_table_xrange_exclude, SIGNAL(activated()), this, SLOT(saveMaskToTable())); m_save_group_file_include = new QAction("As include group to file",this); m_save_group_file_include->setToolTip("Save current mask as include group to a file."); connect(m_save_group_file_include,SIGNAL(activated()),this,SLOT(saveIncludeGroupToFile())); m_save_group_file_exclude = new QAction("As exclude group to file",this); m_save_group_file_exclude->setToolTip("Save current mask as exclude group to a file."); connect(m_save_group_file_exclude,SIGNAL(activated()),this,SLOT(saveExcludeGroupToFile())); m_extract_to_workspace = new QAction("Extract detectors to workspace",this); m_extract_to_workspace->setToolTip("Extract detectors to workspace."); connect(m_extract_to_workspace,SIGNAL(activated()),this,SLOT(extractDetsToWorkspace())); m_sum_to_workspace = new QAction("Sum detectors to workspace",this); m_sum_to_workspace->setToolTip("Sum detectors to workspace."); connect(m_sum_to_workspace,SIGNAL(activated()),this,SLOT(sumDetsToWorkspace())); // Save button and its menus m_saveButton = new QPushButton("Apply and Save"); m_saveButton->setToolTip("Save current masking/grouping to a file or a workspace."); m_saveMask = new QMenu(this); m_saveMask->addAction(m_save_as_workspace_include); m_saveMask->addAction(m_save_as_workspace_exclude); m_saveMask->addSeparator(); m_saveMask->addAction(m_save_as_file_include); m_saveMask->addAction(m_save_as_file_exclude); m_saveMask->addSeparator(); m_saveMask->addAction(m_save_as_cal_file_include); m_saveMask->addAction(m_save_as_cal_file_exclude); m_saveMask->addSeparator(); m_saveMask->addAction(m_save_as_table_xrange_exclude); connect(m_saveMask,SIGNAL(hovered(QAction*)),this,SLOT(showSaveMenuTooltip(QAction*))); m_saveButton->setMenu(m_saveMask); m_saveGroup = new QMenu(this); m_saveGroup->addAction(m_extract_to_workspace); m_saveGroup->addAction(m_sum_to_workspace); m_saveGroup->addSeparator(); m_saveGroup->addAction(m_save_group_file_include); m_saveGroup->addAction(m_save_group_file_exclude); connect(m_saveGroup,SIGNAL(hovered(QAction*)),this,SLOT(showSaveMenuTooltip(QAction*))); QGroupBox *box = new QGroupBox("View"); QGridLayout* buttons = new QGridLayout(); buttons->addWidget(m_apply_to_view,0,0,1,2); buttons->addWidget(m_saveButton,1,0); buttons->addWidget(m_clear_all,1,1); box->setLayout(buttons); layout->addWidget(box); box = new QGroupBox("Workspace"); buttons = new QGridLayout(); buttons->addWidget(m_apply,0,0); box->setLayout(buttons); layout->addWidget(box); }
char cmd_copymove1(uchar copymode, uchar shiftPressed) { char *name; char e; FileInfo* f; char sourceFile[256]; char mask[11]; char forMask[11]; char type; uint i; if(shiftPressed) { // Копируем имя c первой панели (без пути) f = getSelNoBack(); if(!f) return 0; // Файл не выбран, выходим без ошибки unpackName(cmdLine, f->fname); } else { // Копируем путь со второй панели i = strlen(panelB.path1); if(i >= 254) return ERR_RECV_STRING; // Так как прибавим 2 символа cmdLine[0] = '/'; strcpy(cmdline+1, panelB.path1); if(i != 0) strcpy(cmdline+i+1, "/"); } // Позволяем пользователю изменить путь или имя if(!inputBox(copymode ? " kopirowatx " : " pereimenowatx/peremestitx ") && cmdline[0]!=0) return 0; // Преобразование относительного пути в абсолютный if(!absolutePath(cmdline)) return ERR_RECV_STRING; // Используется ли маска? mask[0] = 0; name = getname(cmdline); if(name[0] != 0) { // Сохраняем маску packName(mask, name); // Убираем из пути маску dropPathInt(cmdLine, 0); } else { // Если в ком строке что то есть, а имя не выделено, значит ком строка оканчивается на /. // Этот символ надо удалить if(cmdline[0] != 0 && name[0] == 0) name[-1] = 0; } // Ищем первый файл type = getFirstSelected(sourceFile); if(type == 0) return 0; // Нет выбранных файлов for(;;) { // Преобразование относительного пути в абсолютный if(!absolutePath(sourceFile)) { e = ERR_RECV_STRING; break; } // Добавляем имя packName(forMask, getname(sourceFile)); if(mask[0]) applyMask(forMask, mask); if(catPathAndUnpack(cmdline, forMask)) return ERR_RECV_STRING; // Самого в мебя не копируем и не переименовываем if(0!=strcmp(sourceFile, cmdline)) { // Выполнение операции if(copymode) { if(type==2) { e = cmd_copyFolder(sourceFile, cmdline); } else { e = cmd_copyFile(sourceFile, cmdline); } } else { // Простое окно drawWindow(" pereimenowanie/pereme}enie "); drawWindowText(0, 1, "iz:"); drawWindowText(4, 1, sourceFile); drawWindowText(0, 2, "w:"); drawWindowText(4, 2, cmdline); drawAnyKeyButton(); // Прерывание if(fs_bioskey(1) == KEY_ESC) { e = ERR_USER; break; } e = fs_move(sourceFile, cmdline); } if(e) break; } // Убираем из пути имя файла dropPathInt(cmdLine, 0); // Следующий выбранный файл type = getNextSelected(sourceFile); if(type == 0) { e=0; break; } } // конец цикла // При переносе файла надо обновить обе панели // А при копировании список файов используется под буфер getFiles(); dupFiles(1); return e; }
// ---------------------------------------------------------------------------- void STKTexture::reload(bool no_upload, uint8_t* preload_data, video::IImage* preload_img) { if (ProfileWorld::isNoGraphics()) { m_orig_size.Width = 2; m_orig_size.Height = 2; m_size = m_orig_size; m_texture_name = 1; if (preload_data) delete[] preload_data; if (preload_img) preload_img->drop(); return; } #ifndef SERVER_ONLY video::IImage* orig_img = NULL; uint8_t* data = preload_data; if (data == NULL) { orig_img = preload_img ? preload_img : irr_driver->getVideoDriver()->createImageFromFile(NamedPath); if (orig_img == NULL) { return; } if (orig_img->getDimension().Width == 0 || orig_img->getDimension().Height == 0) { orig_img->drop(); return; } orig_img = resizeImage(orig_img, &m_orig_size, &m_size); applyMask(orig_img); data = orig_img ? (uint8_t*)orig_img->lock() : NULL; } const unsigned int w = m_size.Width; const unsigned int h = m_size.Height; unsigned int format = m_single_channel ? GL_RED : GL_BGRA; unsigned int internal_format = m_single_channel ? GL_R8 : isSrgb() ? GL_SRGB8_ALPHA8 : GL_RGBA8; // GLES 2.0 specs doesn't allow GL_RGBA8 internal format #if defined(USE_GLES2) if (!CVS->isGLSL()) { internal_format = GL_RGBA; } #endif formatConversion(data, &format, w, h); if (!no_upload) { const bool reload = m_texture_name != 0; if (!reload) glGenTextures(1, &m_texture_name); glBindTexture(GL_TEXTURE_2D, m_texture_name); if (!reload) { if (m_single_channel) { glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_ONE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, GL_ONE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_ONE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_RED); } glTexImage2D(GL_TEXTURE_2D, 0, internal_format, w, h, 0, format, GL_UNSIGNED_BYTE, data); } else { glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, format, GL_UNSIGNED_BYTE, data); } if (orig_img) orig_img->unlock(); if (hasMipMaps()) glGenerateMipmap(GL_TEXTURE_2D); } m_texture_size = w * h * (m_single_channel ? 1 : 4); if (no_upload) m_texture_image = orig_img; else if (orig_img) orig_img->drop(); else delete[] data; if (!no_upload) glBindTexture(GL_TEXTURE_2D, 0); #endif // !SERVER_ONLY } // reload
InstrumentWindowMaskTab::InstrumentWindowMaskTab(InstrumentWindow* instrWindow): QFrame(instrWindow), m_instrumentWindow(instrWindow), m_activity(Select), m_userEditing(true) { m_instrumentDisplay = m_instrumentWindow->getInstrumentDisplay(); // main layout QVBoxLayout* layout=new QVBoxLayout(this); // Create the tool buttons m_move = new QPushButton(); m_move->setCheckable(true); m_move->setAutoExclusive(true); m_move->setIcon(QIcon(":/PickTools/selection-tube.png")); m_move->setToolTip("Move the instrument"); m_pointer = new QPushButton(); m_pointer->setCheckable(true); m_pointer->setAutoExclusive(true); m_pointer->setIcon(QIcon(":/MaskTools/selection-pointer.png")); m_pointer->setToolTip("Select and edit shapes"); m_ellipse = new QPushButton(); m_ellipse->setCheckable(true); m_ellipse->setAutoExclusive(true); m_ellipse->setIcon(QIcon(":/MaskTools/selection-circle.png")); m_ellipse->setToolTip("Draw an ellipse"); m_rectangle = new QPushButton(); m_rectangle->setCheckable(true); m_rectangle->setAutoExclusive(true); m_rectangle->setIcon(QIcon(":/MaskTools/selection-box.png")); m_rectangle->setToolTip("Draw a rectangle"); m_ring_ellipse = new QPushButton(); m_ring_ellipse->setCheckable(true); m_ring_ellipse->setAutoExclusive(true); m_ring_ellipse->setIcon(QIcon(":/MaskTools/selection-circle.png")); m_ring_ellipse->setToolTip("Draw an elliptical ring"); m_ring_rectangle = new QPushButton(); m_ring_rectangle->setCheckable(true); m_ring_rectangle->setAutoExclusive(true); m_ring_rectangle->setIcon(QIcon(":/MaskTools/selection-box.png")); m_ring_rectangle->setToolTip("Draw a rectangular ring "); QHBoxLayout* toolBox = new QHBoxLayout(); toolBox->addWidget(m_move); toolBox->addWidget(m_pointer); toolBox->addWidget(m_ellipse); toolBox->addWidget(m_rectangle); toolBox->addWidget(m_ring_ellipse); toolBox->addWidget(m_ring_rectangle); toolBox->addStretch(); toolBox->setSpacing(2); connect(m_move,SIGNAL(clicked()),this,SLOT(setActivity())); connect(m_pointer,SIGNAL(clicked()),this,SLOT(setActivity())); connect(m_ellipse,SIGNAL(clicked()),this,SLOT(setActivity())); connect(m_rectangle,SIGNAL(clicked()),this,SLOT(setActivity())); connect(m_ring_ellipse,SIGNAL(clicked()),this,SLOT(setActivity())); connect(m_ring_rectangle,SIGNAL(clicked()),this,SLOT(setActivity())); m_move->setChecked(true); layout->addLayout(toolBox); // Create property browser /* Create property managers: they create, own properties, get and set values */ m_groupManager = new QtGroupPropertyManager(this); m_doubleManager = new QtDoublePropertyManager(this); connect(m_doubleManager,SIGNAL(propertyChanged(QtProperty*)),this,SLOT(doubleChanged(QtProperty*))); /* Create editors and assign them to the managers */ DoubleEditorFactory *doubleEditorFactory = new DoubleEditorFactory(this); m_browser = new QtTreePropertyBrowser(); m_browser->setFactoryForManager(m_doubleManager, doubleEditorFactory); layout->addWidget(m_browser); // Algorithm buttons m_apply = new QPushButton("Apply"); connect(m_apply,SIGNAL(clicked()),this,SLOT(applyMask())); m_clear_all = new QPushButton("Clear All"); connect(m_clear_all,SIGNAL(clicked()),this,SLOT(clearMask())); m_save_as_workspace_include = new QAction("Save As Workspace (include)",this); connect(m_save_as_workspace_include,SIGNAL(activated()),this,SLOT(saveMaskToWorkspaceInclude())); m_save_as_workspace_exclude = new QAction("Save As Workspace (exclude)",this); connect(m_save_as_workspace_exclude,SIGNAL(activated()),this,SLOT(saveMaskToWorkspaceExclude())); m_save_as_file_include = new QAction("Save As File (include)",this); connect(m_save_as_file_include,SIGNAL(activated()),this,SLOT(saveMaskToFileInclude())); m_save_as_file_exclude = new QAction("Save As File (exclude)",this); connect(m_save_as_file_exclude,SIGNAL(activated()),this,SLOT(saveMaskToFileExclude())); QPushButton* saveButton = new QPushButton("Save"); QMenu* saveMenu = new QMenu(this); saveMenu->addAction(m_save_as_workspace_include); saveMenu->addAction(m_save_as_workspace_exclude); saveMenu->addAction(m_save_as_file_include); saveMenu->addAction(m_save_as_file_exclude); saveButton->setMenu(saveMenu); QGridLayout* buttons = new QGridLayout(); buttons->addWidget(m_apply,0,0); buttons->addWidget(m_clear_all,0,1); buttons->addWidget(saveButton,1,0,1,2); layout->addLayout(buttons); }