void DialogRepositionSurface::UpdateIntensity()
{
  LayerMRI* mri = (LayerMRI*)MainWindow::GetMainWindow()->GetTopVisibleLayer("MRI");
  LayerSurface* surf = (LayerSurface*)MainWindow::GetMainWindow()->GetActiveLayer( "Surface" );
  if (mri && surf)
  {
    double ras[3], surf_ras[3];
    mri->GetSlicePosition(ras);
    surf->GetSurfaceRASAtTarget(ras, surf_ras);
    mri->RemapPositionToRealRAS(ras, ras);
    double val = mri->GetSampledVoxelValueByRAS(ras);
    if (val >= 0)
    {
      ui->lineEditTarget->setText(QString::number(val, 'f', 2));
      OnCoordinateTypeChanged();
    }
    ui->lineEditTargetX->setText(QString::number(surf_ras[0], 'f', 2));
    ui->lineEditTargetY->setText(QString::number(surf_ras[1], 'f', 2));
    ui->lineEditTargetZ->setText(QString::number(surf_ras[2], 'f', 2));
  }
}
Exemplo n.º 2
0
void ToolWindowEdit::OnEditContourValue( wxCommandEvent& event )
{
  double value;
  if ( m_editContourValue->GetValue().ToDouble( &value ) && value > 0 )
  {
    BrushProperty* bp = MainWindow::GetMainWindowPointer()->GetBrushProperty();
    LayerMRI* mri = (LayerMRI*)bp->GetReferenceLayer();
    for ( int i = 0; i < 3; i++ )
    {
      RenderView2D* view = ( RenderView2D* )MainWindow::GetMainWindowPointer()->GetRenderView( i );
      Contour2D* c2d = view->GetContour2D();
      if ( c2d->GetInputImage() )
        c2d->SetContourValue( value );
      else if ( mri )
      {
        c2d->SetInput( mri->GetSliceImageData( view->GetViewPlane() ), value, mri->GetSlicePosition()[i], mri->GetActiveFrame() ); 
        c2d->SetVisible( true );
      }
    }
    UpdateTools();
  }
}
void DialogTransformVolume::OnButtonCenterToCursor()
{
  if ( isVisible() )
  {
    LayerMRI* layer = ( LayerMRI* )MainWindow::GetMainWindow()->GetActiveLayer( "MRI" );
    if ( layer )
    {
      double pos[3];
      layer->GetSlicePosition(pos);
      layer->SetTranslateByCenterPosition( pos );
      MainWindow::GetMainWindow()->RequestRedraw();

      double* vs = layer->GetWorldVoxelSize();
      for (int n = 0; n < 3; n++)
      {
        int range = m_scrollTranslate[n]->maximum();
        m_scrollTranslate[n]->blockSignals(true);
        m_scrollTranslate[n]->setValue(range/2 + (int)( pos[n] / vs[n] ) );
        m_scrollTranslate[n]->blockSignals(false);
      }
      UpdateUI( 0 );
    }
  }
}