void PanelROI::DoUpdateWidgets() { BlockAllSignals( true ); for ( int i = 0; i < ui->treeWidgetLayers->topLevelItemCount(); i++ ) { QTreeWidgetItem* item = ui->treeWidgetLayers->topLevelItem( i ); Layer* layer = qobject_cast<Layer*>( item->data(0, Qt::UserRole).value<QObject*>() ); if ( layer ) { item->setCheckState( 0, (layer->IsVisible() ? Qt::Checked : Qt::Unchecked) ); } } LayerROI* layer = GetCurrentLayer<LayerROI*>(); for ( int i = 0; i < this->allWidgets.size(); i++ ) { if ( allWidgets[i] != ui->toolbar && allWidgets[i]->parentWidget() != ui->toolbar ) { allWidgets[i]->setEnabled(layer); } } ui->lineEditFileName->clear(); if ( layer ) { ui->sliderOpacity->setValue( (int)( layer->GetProperty()->GetOpacity() * 100 ) ); ChangeDoubleSpinBoxValue( ui->doubleSpinBoxOpacity, layer->GetProperty()->GetOpacity() ); double* rgb = layer->GetProperty()->GetColor(); ui->colorPickerColor->setCurrentColor( QColor( (int)(rgb[0]*255), (int)(rgb[1]*255), (int)(rgb[2]*255) ) ); ui->lineEditFileName->setText( MyUtils::Win32PathProof(layer->GetFileName()) ); ui->lineEditFileName->setCursorPosition( ui->lineEditFileName->text().size() ); } ui->doubleSpinBoxOpacity->setEnabled( layer ); ui->colorPickerColor->setEnabled( layer ); ui->sliderOpacity->setEnabled( layer ); ui->labelColor->setEnabled( layer ); ui->labelFileName->setEnabled( layer ); ui->lineEditFileName->setEnabled( layer ); ui->labelOpacity->setEnabled( layer ); BlockAllSignals( false ); }
void PanelPointSet::DoUpdateWidgets() { BlockAllSignals( true ); LayerPointSet* layer = GetCurrentLayer<LayerPointSet*>(); for ( int i = 0; i < this->allWidgets.size(); i++ ) { if ( allWidgets[i] != ui->toolbar && allWidgets[i]->parentWidget() != ui->toolbar ) { allWidgets[i]->setEnabled(layer); } } int nColorMap = 0; bool bShowSpline = false; ui->lineEditFileName->clear(); if ( layer ) { ui->sliderOpacity->setValue( (int)( layer->GetProperty()->GetOpacity() * 100 ) ); ChangeDoubleSpinBoxValue( ui->doubleSpinBoxOpacity, layer->GetProperty()->GetOpacity() ); double* rgb = layer->GetProperty()->GetColor(); ui->colorpickerPointColor->setCurrentColor( QColor( (int)(rgb[0]*255), (int)(rgb[1]*255), (int)(rgb[2]*255) ) ); rgb = layer->GetProperty()->GetSplineColor(); ui->colorpickerSplineColor->setCurrentColor( QColor( (int)(rgb[0]*255), (int)(rgb[1]*255), (int)(rgb[2]*255) ) ); ui->lineEditFileName->setText( MyUtils::Win32PathProof(layer->GetFileName()) ); ui->lineEditFileName->setCursorPosition( ui->lineEditFileName->text().size() ); ChangeLineEditNumber( ui->lineEditRadius, layer->GetProperty()->GetRadius() ); ChangeLineEditNumber( ui->lineEditSplineRadius, layer->GetProperty()->GetSplineRadius() ); ui->labelNumberTotal->setText(QString("%1").arg(layer->GetNumberOfPoints())); ui->spinBoxGoToPoint->setRange(1, layer->GetNumberOfPoints()); nColorMap = layer->GetProperty()->GetColorMap(); double fMin = layer->GetProperty()->GetScalarMinValue(); double fMax = layer->GetProperty()->GetScalarMaxValue(); ui->sliderMin->setValue( (int)( ( layer->GetProperty()->GetHeatScaleMin() - fMin ) / ( fMax - fMin ) * 100 ) ); ui->sliderMid->setValue( (int)( ( layer->GetProperty()->GetHeatScaleMid() - fMin ) / ( fMax - fMin ) * 100 ) ); ui->sliderMax->setValue( (int)( ( layer->GetProperty()->GetHeatScaleMax() - fMin ) / ( fMax - fMin ) * 100 ) ); ui->sliderOffset->setValue( (int)( ( layer->GetProperty()->GetHeatScaleOffset() + fMax ) / ( fMax + fMax ) * 100 ) ); ChangeLineEditNumber( ui->lineEditMin, layer->GetProperty()->GetHeatScaleMin() ); ChangeLineEditNumber( ui->lineEditMid, layer->GetProperty()->GetHeatScaleMid() ); ChangeLineEditNumber( ui->lineEditMax, layer->GetProperty()->GetHeatScaleMax() ); ChangeLineEditNumber( ui->lineEditOffset, layer->GetProperty()->GetHeatScaleOffset() ); ui->comboBoxSplineColor->setCurrentIndex( nColorMap ); ui->comboBoxScalarMap->clear();; QList<Layer*> layers = MainWindow::GetMainWindow()->GetLayerCollection( "MRI" )->GetLayers(); int nSel = -1; for ( int i = 0; i < layers.size(); i++ ) { ui->comboBoxScalarMap->addItem( layers[i]->GetName(), QVariant::fromValue((QObject*)layers[i]) ); if ( layer->GetProperty()->GetScalarType() == LayerPropertyPointSet::ScalarLayer && layer->GetProperty()->GetScalarLayer() == layers[i] ) { nSel = i; } } std::vector<ScalarValues> svs = layer->GetProperty()->GetScalarSets(); for ( int i = 0; i < (int)svs.size(); i++ ) { ui->comboBoxScalarMap->addItem( svs[i].strName ); if ( layer->GetProperty()->GetScalarType() == LayerPropertyPointSet::ScalarSet && layer->GetProperty()->GetScalarSet() == i ) { nSel = i + layers.size(); } } ui->comboBoxScalarMap->addItem( "Load..." ); if ( nSel >= 0 ) { ui->comboBoxScalarMap->setCurrentIndex( nSel ); } bShowSpline = layer->GetProperty()->GetShowSpline(); ui->checkBoxShowSpline->setChecked( bShowSpline ); ui->checkBoxSnapToCenter->setChecked( layer->GetProperty()->GetSnapToVoxelCenter() ); } // MainWindow* mainWnd = MainWindow::GetMainWindowPointer(); ui->colorpickerPointColor->setEnabled( layer ); ui->comboBoxSplineColor->setEnabled( layer ); ShowWidgets( m_widgetlistSpline, bShowSpline ); ShowWidgets( m_widgetlistSolidColor, bShowSpline && layer && nColorMap == LayerPropertyPointSet::SolidColor ); ShowWidgets( m_widgetlistHeatScale, bShowSpline && layer && nColorMap == LayerPropertyPointSet::HeatScale ); BlockAllSignals( false ); }