コード例 #1
0
ファイル: contactlistproxymodel.cpp プロジェクト: caotic/psi
void ContactListProxyModel::setSourceModel(QAbstractItemModel* model)
{
	Q_ASSERT(dynamic_cast<ContactListModel*>(model));
	QSortFilterProxyModel::setSourceModel(model);
	connect(model, SIGNAL(showOfflineChanged()), SLOT(filterParametersChanged()));
	connect(model, SIGNAL(showSelfChanged()), SLOT(filterParametersChanged()));
	connect(model, SIGNAL(showSelfChanged()), SLOT(filterParametersChanged()));
	connect(model, SIGNAL(showTransportsChanged()), SLOT(filterParametersChanged()));
}
コード例 #2
0
void FilterDockWidget::onItemClicked(QListWidgetItem* clickedItem) {
  if (_availableFilters) {
    std::shared_ptr<ImageFilterPluginInterface> filter = NULL;
    if (_settingsPanel) {
      _layout->removeWidget(_settingsPanel);
      _settingsPanel->hide();
      _settingsPanel->setParent(NULL);
      _settingsPanel = NULL;
    }
    stopProgressTracking();
    if (clickedItem && clickedItem != _currentSelection) {
      if (_currentSelection) {
        std::shared_ptr<ImageFilterPluginInterface> filter = _currentSelection->data(Qt::UserRole).value<std::shared_ptr<ImageFilterPluginInterface> >();
        filter->setProgressMonitor(NULL);
        filter->disconnect(SIGNAL(filterParametersChanged()));
      }
      _currentSelection = clickedItem;
      filter = _currentSelection->data(Qt::UserRole).value<std::shared_ptr<ImageFilterPluginInterface> >();
      filter->setProgressMonitor(_monitor);
      _settingsPanel = filter->getSettingsPanel();        
      _layout->addWidget(_settingsPanel);
      QObject::connect(filter.get(), SIGNAL(filterParametersChanged()), this, SLOT(onFilterParametersChanged()));
    }
    else if (clickedItem && clickedItem == _currentSelection) {
      _availableFilters->clearSelection();
      std::shared_ptr<ImageFilterPluginInterface> filter = _currentSelection->data(Qt::UserRole).value<std::shared_ptr<ImageFilterPluginInterface> >();
      filter->setProgressMonitor(NULL);
      filter->disconnect(SIGNAL(filterParametersChanged()));
      _currentSelection = NULL;
    }
    if (_currentSelection) {
      _autoUpdateCheckBox->setEnabled(true);
      if (_autoUpdateCheckBox->isChecked()) {
        _applyFilter->setEnabled(false);
      }
      else {
        _applyFilter->setEnabled(true);
      }
    }
    else {
      _applyFilter->setEnabled(false);
      _autoUpdateCheckBox->setEnabled(false);
    }
    emit changeCurrentFilter(filter);
  }
}
コード例 #3
0
void ColorDeconvolutionFilterPlugin::revertStainToDefault() {
  if (_filter) {
    ColorDeconvolutionFilter<double>* filter = dynamic_cast<ColorDeconvolutionFilter<double>* >(_filter.get());
    if (filter) {
      filter->revertToDefaultStain();
      updateSettingsPanelFromFilter();
      emit filterParametersChanged();
    }
  }
}
コード例 #4
0
void NucleiDetectionFilterPlugin::updateFilterFromSettingsPanel() {
  NucleiDetectionFilter<double>* filter = dynamic_cast<NucleiDetectionFilter<double>* >(_filter.get());
  if (_settingsPanel && filter) {
    filter->cancel();
    _mutex.lock();
    QDoubleSpinBox* stain1R = _settingsPanel->findChild<QDoubleSpinBox*>("Stain1RSpinBox");
    QDoubleSpinBox* stain1G = _settingsPanel->findChild<QDoubleSpinBox*>("Stain1GSpinBox");
    QDoubleSpinBox* stain1B = _settingsPanel->findChild<QDoubleSpinBox*>("Stain1BSpinBox");
    QDoubleSpinBox* stain2R = _settingsPanel->findChild<QDoubleSpinBox*>("Stain2RSpinBox");
    QDoubleSpinBox* stain2G = _settingsPanel->findChild<QDoubleSpinBox*>("Stain2GSpinBox");
    QDoubleSpinBox* stain2B = _settingsPanel->findChild<QDoubleSpinBox*>("Stain2BSpinBox");
    QDoubleSpinBox* stain3R = _settingsPanel->findChild<QDoubleSpinBox*>("Stain3RSpinBox");
    QDoubleSpinBox* stain3G = _settingsPanel->findChild<QDoubleSpinBox*>("Stain3GSpinBox");
    QDoubleSpinBox* stain3B = _settingsPanel->findChild<QDoubleSpinBox*>("Stain3BSpinBox");
    QDoubleSpinBox* rThreshold = _settingsPanel->findChild<QDoubleSpinBox*>("RThreshold");
    QDoubleSpinBox* gThreshold = _settingsPanel->findChild<QDoubleSpinBox*>("GThreshold");
    QDoubleSpinBox* bThreshold = _settingsPanel->findChild<QDoubleSpinBox*>("BThreshold");
    QDoubleSpinBox* globalThreshold = _settingsPanel->findChild<QDoubleSpinBox*>("GlobalThreshold");
    QDoubleSpinBox* maxRadius = _settingsPanel->findChild<QDoubleSpinBox*>("MaxRadiusSpinBox");
    QDoubleSpinBox* minRadius = _settingsPanel->findChild<QDoubleSpinBox*>("MinRadiusSpinBox");
    QDoubleSpinBox* stepRadius = _settingsPanel->findChild<QDoubleSpinBox*>("StepRadiusSpinBox");
    QDoubleSpinBox* alpha = _settingsPanel->findChild<QDoubleSpinBox*>("AlphaSpinBox");
    QDoubleSpinBox* beta = _settingsPanel->findChild<QDoubleSpinBox*>("BetaSpinBox");
    QDoubleSpinBox* hMaximaThreshold = _settingsPanel->findChild<QDoubleSpinBox*>("HMaximaThresholdSpinBox");
    QLabel* nrDetectedNuclei = _settingsPanel->findChild<QLabel*>("NrOfDetectedNucleiValueLabel");
    filter->getColorDeconvolutionFilter()->setGlobalDensityThreshold(globalThreshold->value());
    std::vector<double> rgbThresholds;
    rgbThresholds.push_back(rThreshold->value());
    rgbThresholds.push_back(gThreshold->value());
    rgbThresholds.push_back(bThreshold->value());
    filter->getColorDeconvolutionFilter()->setRGBDensityThresholds(rgbThresholds);
    std::vector<std::vector<double> > stains(3, std::vector<double>(3, 0));
    stains[0][0] = stain1R->value();
    stains[0][1] = stain1G->value();
    stains[0][2] = stain1B->value();
    stains[1][0] = stain2R->value();
    stains[1][1] = stain2G->value();
    stains[1][2] = stain2B->value();
    stains[2][0] = stain3R->value();
    stains[2][1] = stain3G->value();
    stains[2][2] = stain3B->value();
    filter->getColorDeconvolutionFilter()->setStain(stains[0], stains[1], stains[2]);
    filter->setBeta(beta->value());
    filter->setAlpha(alpha->value());
    filter->setHMaximaThreshold(hMaximaThreshold->value());
    filter->setMaximumRadius(maxRadius->value());
    filter->setMinimumRadius(minRadius->value());
    filter->setRadiusStep(stepRadius->value());
    _mutex.unlock();
    emit filterParametersChanged();
  }
}
コード例 #5
0
void ColorDeconvolutionFilterPlugin::updateFilterFromSettingsPanel() {
  ColorDeconvolutionFilter<double>* filter = dynamic_cast<ColorDeconvolutionFilter<double>* >(_filter.get());
  if (_settingsPanel && filter) {
    QDoubleSpinBox* stain1R = _settingsPanel->findChild<QDoubleSpinBox*>("Stain1RSpinBox");
    QDoubleSpinBox* stain1G = _settingsPanel->findChild<QDoubleSpinBox*>("Stain1GSpinBox");
    QDoubleSpinBox* stain1B = _settingsPanel->findChild<QDoubleSpinBox*>("Stain1BSpinBox");
    QDoubleSpinBox* stain2R = _settingsPanel->findChild<QDoubleSpinBox*>("Stain2RSpinBox");
    QDoubleSpinBox* stain2G = _settingsPanel->findChild<QDoubleSpinBox*>("Stain2GSpinBox");
    QDoubleSpinBox* stain2B = _settingsPanel->findChild<QDoubleSpinBox*>("Stain2BSpinBox");
    QDoubleSpinBox* stain3R = _settingsPanel->findChild<QDoubleSpinBox*>("Stain3RSpinBox");
    QDoubleSpinBox* stain3G = _settingsPanel->findChild<QDoubleSpinBox*>("Stain3GSpinBox");
    QDoubleSpinBox* stain3B = _settingsPanel->findChild<QDoubleSpinBox*>("Stain3BSpinBox");
    QDoubleSpinBox* rThreshold = _settingsPanel->findChild<QDoubleSpinBox*>("RThreshold");
    QDoubleSpinBox* gThreshold = _settingsPanel->findChild<QDoubleSpinBox*>("GThreshold");
    QDoubleSpinBox* bThreshold = _settingsPanel->findChild<QDoubleSpinBox*>("BThreshold");
    QDoubleSpinBox* globalThreshold = _settingsPanel->findChild<QDoubleSpinBox*>("GlobalThreshold");
    QComboBox* outputStain = _settingsPanel->findChild<QComboBox*>("OutputStainComboBox");
    filter->setGlobalDensityThreshold(globalThreshold->value());
    std::vector<double> rgbThresholds;
    rgbThresholds.push_back(rThreshold->value());
    rgbThresholds.push_back(gThreshold->value());
    rgbThresholds.push_back(bThreshold->value());
    filter->setRGBDensityThresholds(rgbThresholds);
    std::vector<std::vector<double> > stains(3, std::vector<double>(3, 0));
    stains[0][0] = stain1R->value();
    stains[0][1] = stain1G->value();
    stains[0][2] = stain1B->value();
    stains[1][0] = stain2R->value();
    stains[1][1] = stain2G->value();
    stains[1][2] = stain2B->value();
    stains[2][0] = stain3R->value();
    stains[2][1] = stain3G->value();
    stains[2][2] = stain3B->value();
    filter->setStain(stains[0], stains[1], stains[2]);
    filter->setOutputStain(outputStain->currentIndex());
    emit filterParametersChanged();
  }
}