void WindowTimeCourse::OnFrameChanged(int frame)
{
  LayerMRI* layer = qobject_cast<LayerMRI*>(MainWindow::GetMainWindow()->GetActiveLayer("MRI"));
  if (layer && frame != layer->GetActiveFrame() && frame < layer->GetNumberOfFrames())
  {
    layer->SetActiveFrame(frame);
  }
}
void WindowTimeCourse::UpdateData()
{
  LayerMRI* layer = qobject_cast<LayerMRI*>(MainWindow::GetMainWindow()->GetActiveLayer("MRI"));
  if (layer && layer->GetNumberOfFrames() > 1)
  {
    double ras[3];
    int n[3];
    MainWindow::GetMainWindow()->GetLayerCollection("MRI")->GetSlicePosition(ras);
    layer->RemapPositionToRealRAS(ras, ras);
    layer->RASToOriginalIndex(ras, n);
    QList<double> data;
    for (int i = 0; i < layer->GetNumberOfFrames(); i++)
      data <<  layer->GetVoxelValueByOriginalIndex(n[0], n[1], n[2], i);
    FSVolume* vol = layer->GetSourceVolume();
    ui->widgetPlot->SetTimeCourseData(data, vol->GetMinValue(), vol->GetMaxValue(), layer->GetTR());
    ui->widgetPlot->SetCurrentFrame(layer->GetActiveFrame());
  }
}
Beispiel #3
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();
  }
}