Пример #1
0
void DialogTransformVolume::UpdateLandmarkColors()
{
  LayerLandmarks* landmarks = (LayerLandmarks*)MainWindow::GetMainWindow()
                              ->GetSupplementLayer("Landmarks");
  for (int i = 0; i < m_colorPickerLandmark.size(); i++)
  {
    if (qobject_cast<QtColorPicker*>(sender()) == m_colorPickerLandmark[i])
    {
      landmarks->SetLandmarkColor(i, m_colorPickerLandmark[i]->currentColor());
      break;
    }
  }
  QList<QColor> colors;
  for (int i = 0; i < m_colorPickerLandmark.size(); i++)
    colors << landmarks->GetLandmark(i).color;
  foreach (QComboBox* cbox, m_comboLandmark)
  {
    for (int i = 0; i < m_colorPickerLandmark.size(); i++)
      cbox->setItemIcon(i, MakeIcon(colors[i], 12));
  }
}
Пример #2
0
DialogTransformVolume::DialogTransformVolume(QWidget *parent) :
  QDialog(parent),
  UIUpdateHelper(),
  ui(new Ui::DialogTransformVolume)
{
  ui->setupUi(this);
  ui->groupBoxLandmarks->hide();
  ui->pushButtonApply->hide();

  QButtonGroup* bg = new QButtonGroup(this);
  bg->addButton(ui->radioButtonRotateLandmarks);
  bg->addButton(ui->radioButtonRotateManual);
  bg->setExclusive(true);

  m_checkRotate[0] = ui->checkBoxRotateX;
  m_checkRotate[1] = ui->checkBoxRotateY;
  m_checkRotate[2] = ui->checkBoxRotateZ;
  m_comboRotate[0] = ui->comboBoxRotateX;
  m_comboRotate[1] = ui->comboBoxRotateY;
  m_comboRotate[2] = ui->comboBoxRotateZ;
  m_sliderRotate[0] = ui->horizontalSliderRotateX;
  m_sliderRotate[1] = ui->horizontalSliderRotateY;
  m_sliderRotate[2] = ui->horizontalSliderRotateZ;
  m_textAngle[0] = ui->lineEditRotateX;
  m_textAngle[1] = ui->lineEditRotateY;
  m_textAngle[2] = ui->lineEditRotateZ;
  m_scrollTranslate[0] = ui->scrollBarTranslateX;
  m_scrollTranslate[1] = ui->scrollBarTranslateY;
  m_scrollTranslate[2] = ui->scrollBarTranslateZ;
  m_textTranslate[0] = ui->lineEditTranslateX;
  m_textTranslate[1] = ui->lineEditTranslateY;
  m_textTranslate[2] = ui->lineEditTranslateZ;
  m_scrollScale[0] = ui->scrollBarScaleX;
  m_scrollScale[1] = ui->scrollBarScaleY;
  m_scrollScale[2] = ui->scrollBarScaleZ;
  m_textScale[0] = ui->lineEditScaleX;
  m_textScale[1] = ui->lineEditScaleY;
  m_textScale[2] = ui->lineEditScaleZ;
  m_btnPickLandmark << ui->pushButtonLandmarkPick1
                    << ui->pushButtonLandmarkPick2
                    << ui->pushButtonLandmarkPick3
                    << ui->pushButtonLandmarkPick4;
  m_colorPickerLandmark << ui->colorPickerLandmark1
                        << ui->colorPickerLandmark2
                        << ui->colorPickerLandmark3
                        << ui->colorPickerLandmark4;
  m_comboLandmark << ui->comboBoxAxis11
                  << ui->comboBoxAxis12
                  << ui->comboBoxAxis21
                  << ui->comboBoxAxis22;

  for (int i = 0; i < 3; i++)
  {
    m_checkRotate[i]->hide();
    m_comboRotate[i]->hide();
  }

  connect(MainWindow::GetMainWindow()->GetLayerCollection("MRI"), SIGNAL(ActiveLayerChanged(Layer*)),
          this, SLOT(OnActiveLayerChanged()));
  connect(ui->pushButtonSaveVolumeAs, SIGNAL(clicked()),
          MainWindow::GetMainWindow(), SLOT(SaveVolumeAs()));

  LayerLandmarks* landmarks = (LayerLandmarks*)MainWindow::GetMainWindow()
                              ->GetSupplementLayer("Landmarks");
  landmarks->SetLandmarkColor(0, Qt::red);
  landmarks->SetLandmarkColor(1, Qt::green);
  landmarks->SetLandmarkColor(2, Qt::blue);
  landmarks->SetLandmarkColor(3, Qt::yellow);
  for (int i = 0; i < m_colorPickerLandmark.size(); i++)
    m_colorPickerLandmark[i]->setCurrentColor(landmarks->GetLandmark(i).color);
  UpdateLandmarkColors();
}