void DialogRepositionSurface::OnApply()
{
  LayerSurface* surf = (LayerSurface*)MainWindow::GetMainWindow()->GetActiveLayer("Surface");
  LayerMRI* mri = (LayerMRI*)MainWindow::GetMainWindow()->GetActiveLayer("MRI");
  QString msg;
  if ( !surf )
    msg = "No active surface found.";
  else if ( !mri && ui->tabWidget->currentIndex() == 0)
    msg = "No active volume found.";

  if (!msg.isEmpty())
  {
    QMessageBox::warning(this, "Error", msg);
    return;
  }

  if (ValidateAll())
  {
    ui->pushButtonApply->setDisabled(true);
    if (ui->tabWidget->currentIndex() == 0)
    {
      if (ui->comboBoxTarget->currentIndex() == 0)
      {
        surf->RepositionSurface(mri, GetVertex(),
                                GetIntensity(),
                                GetNeighborSize(),
                                GetSigma(),
                                GetFlags());
      }
      else
      {
        double pos[3];
        GetCoordinate(pos);
        surf->RepositionSurface( mri, GetVertex(),
                                       pos,
                                       GetNeighborSize(),
                                       GetSigma(),
                                       GetFlags());
      }
    }
    else if (ui->tabWidget->currentIndex() == 1)
    {
      double pos[3];
      GetCoordinate(pos);
      surf->RepositionVertex(GetVertex(), pos);
    }
    else
    {
      surf->RepositionSmoothSurface(GetVertex(), GetNeighborSize(), GetSmoothingSteps());
    }
    UpdateUI();
    ui->pushButtonApply->setDisabled(false);
    QTimer::singleShot(0, MainWindow::GetMainWindow(), SIGNAL(SlicePositionChanged()));
  }
}
Example #2
0
string
Edge::ToGraphViz(long unsigned int rank,vector<string> loops, long unsigned int write,GraphPrinterOptions op){
ostringstream result;
result<< op.sigma<<"( "+GetVariableName() 
      +GetIndex()->Generate_C_Code()+")   =   "<<PrintOperation(write,GetSigma()->GetIndex(),op);
result<<"\\n  IF \\n "<<GetCondition()->Generate_C_Code();
return result.str();
}
Example #3
0
string
Edge::Print_str(std::string indent)   {
ostringstream s;
s<<""<<indent<<" Var ="<<variable;
s<<""<<indent<<" Index="<<indent<<GetIndex()->Print_str();
s<<""<<indent<<" Validity ="<<indent<<GetCondition()->Print_str();
s<<""<<indent<<" Sigma ="<<indent<<GetSigma()->Print_str();
return s.str();
};
void DialogRepositionSurface::OnApply( wxCommandEvent& event )
{
  LayerSurface* surf = (LayerSurface*)MainWindow::GetMainWindowPointer()->GetActiveLayer( "Surface" );
  LayerMRI* mri = (LayerMRI*)MainWindow::GetMainWindowPointer()->GetActiveLayer( "MRI" );
  wxString msg;
  if ( !surf )
    msg = _("No active surface found.");
  else if ( !mri )
    msg = _("No active volume found." );
  
  if ( !msg.IsEmpty() )
  {
    wxMessageDialog dlg( this, msg, _("Error"), wxOK );
    dlg.ShowModal();
    return;
  }
  if ( ValidateAll() )
  {
    if ( m_choiceTarget->GetCurrentSelection() == 0 )
    {
      surf->RepositionSurface( mri, GetVertex(), 
                           GetIntensity(),
                           GetNeighborSize(),
                           GetSigma() );
    }
    else
    {
      double pos[3];
      GetCoordinate( pos );
      surf->RepositionSurface( mri, GetVertex(), 
                               pos,
                               GetNeighborSize(),
                               GetSigma() );
    }
    UpdateUI();
  }
}