void DialogTransformVolume::OnActiveLayerChanged()
{
  if ( isVisible() )
  {
    UpdateUI();
  }
  LayerMRI* layer = (LayerMRI* )MainWindow::GetMainWindow()->GetActiveLayer( "MRI" );
  if (!layer)
    return;
  connect(layer->GetProperty(), SIGNAL(ColorMapChanged()), this, SLOT(OnActiveLayerChanged()), Qt::UniqueConnection);
  LayerLandmarks* landmarks = (LayerLandmarks*)MainWindow::GetMainWindow()->GetSupplementLayer( "Landmarks" );
  landmarks->SetMRIRef(layer);
  if (layer->GetProperty()->GetColorMap() == LayerPropertyMRI::LUT)
    ui->radioButtonNearestNeighbor->setChecked(true);
  else
    ui->radioButtonCubic->setChecked(true);
  OnSampleMethodChanged();
}
예제 #2
0
LayerFCD::LayerFCD(LayerMRI* layerMRI, 
                   QObject *parent) : LayerVolumeBase(parent),
  m_fcd(NULL),
  m_mri_difference(NULL)
{
  m_strTypeNames.push_back( "FCD" );
  m_sPrimaryType = "FCD";
  mProperty = new LayerPropertyFCD(this);
  for ( int i = 0; i < 3; i++ )
  {
    m_dSlicePosition[i] = 0;
    m_sliceActor2D[i] = vtkSmartPointer<vtkImageActor>::New();
    m_sliceActor3D[i] = vtkSmartPointer<vtkImageActor>::New();
    m_sliceActor2D[i]->InterpolateOff();
    m_sliceActor3D[i]->InterpolateOff();
  }

  mProperty = new LayerPropertyFCD( this );

  m_layerSource = layerMRI;
  if (m_layerSource)
  {
    InitializeData();
  }

  LayerPropertyFCD* p = GetProperty();
  connect( p, SIGNAL(ColorMapChanged()), this, SLOT(UpdateColorMap()) );
  connect( p, SIGNAL(OpacityChanged(double)), this, SLOT(UpdateOpacity()) );
  connect( p, SIGNAL(ThicknessThresholdChanged(double)), 
           this, SLOT(Recompute()));
  connect( p, SIGNAL(SigmaChanged(double)), this, SLOT(Recompute()));
  connect( p, SIGNAL(MinAreaChanged(int)), this, SLOT(Recompute()));

  // pre allocate MRIs & surfaces
  m_mri_norm = new LayerMRI(NULL);
  m_mri_flair = new LayerMRI(NULL);
  m_mri_t2 = new LayerMRI(NULL);
  m_mri_aseg = new LayerMRI(NULL);
  m_mri_difference = new LayerMRI(NULL);
  connect(m_mri_norm, SIGNAL(destroyed()), 
          this, SLOT(OnLayerDestroyed()), Qt::UniqueConnection);
  connect(m_mri_flair, SIGNAL(destroyed()), 
          this, SLOT(OnLayerDestroyed()), Qt::UniqueConnection);
  connect(m_mri_t2, SIGNAL(destroyed()), 
          this, SLOT(OnLayerDestroyed()), Qt::UniqueConnection);
  connect(m_mri_aseg, SIGNAL(destroyed()), 
          this, SLOT(OnLayerDestroyed()), Qt::UniqueConnection);
  connect(m_mri_difference, SIGNAL(destroyed()),
          this, SLOT(OnLayerDestroyed()), Qt::UniqueConnection);

  m_surf_lh = new LayerSurface(NULL);
  m_surf_rh = new LayerSurface(NULL);
  connect(m_surf_lh, SIGNAL(destroyed()),
          this, SLOT(OnLayerDestroyed()), Qt::UniqueConnection);
  connect(m_surf_rh, SIGNAL(destroyed()),
          this, SLOT(OnLayerDestroyed()), Qt::UniqueConnection);
  m_surf_lh_pial = new LayerSurface(NULL);
  m_surf_rh_pial = new LayerSurface(NULL);
  connect(m_surf_lh_pial, SIGNAL(destroyed()),
          this, SLOT(OnLayerDestroyed()), Qt::UniqueConnection);
  connect(m_surf_rh_pial, SIGNAL(destroyed()),
          this, SLOT(OnLayerDestroyed()), Qt::UniqueConnection);

  m_surf_lh_sphere_d1 = new LayerSurface(NULL);
  m_surf_rh_sphere_d1 = new LayerSurface(NULL);
  connect(m_surf_lh_sphere_d1, SIGNAL(destroyed()),
          this, SLOT(OnLayerDestroyed()), Qt::UniqueConnection);
  connect(m_surf_rh_sphere_d1, SIGNAL(destroyed()),
          this, SLOT(OnLayerDestroyed()), Qt::UniqueConnection);

  m_worker = new LayerFCDWorkerThread(this);
  connect(m_worker, SIGNAL(started()), this, SIGNAL(StatusChanged()));
  connect(m_worker, SIGNAL(finished()), this, SIGNAL(StatusChanged()));
  connect(m_worker, SIGNAL(terminated()), this, SIGNAL(StatusChanged()));
}
예제 #3
0
LayerSurface::LayerSurface( LayerMRI* ref, QObject* parent ) : LayerEditable( parent ),
  m_surfaceSource( NULL ),
  m_bResampleToRAS( true ),
  m_volumeRef( ref ),
  m_nActiveOverlay( -1 ),
  m_nActiveAnnotation( -1 ),
  m_nActiveLabel( -1 ),
  m_bUndoable( false ),
  m_bVector2DPendingUpdate( true ),
  m_bLoadAll(false)
{
  m_strTypeNames.push_back( "Surface" );

  // create property before actors!
  mProperty = new LayerPropertySurface( this );

  for ( int i = 0; i < 3; i++ )
  {
    // m_nSliceNumber[i] = 0;
    m_sliceActor2D[i] = vtkActor::New();
    m_sliceActor3D[i] = vtkActor::New();
    m_vectorActor2D[i] = vtkActor::New();
  }

// m_mainActor = vtkLODActor::New();
  m_mainActor = vtkSmartPointer<vtkActor>::New();
  m_mainActor->GetProperty()->SetEdgeColor( 0.75, 0.75, 0.75 );
  mLowResFilter = vtkSmartPointer<vtkDecimatePro>::New();
  mLowResFilter->SetTargetReduction( 0.9 );
// mMediumResFilter = vtkSmartPointer<vtkDecimatePro>::New();
// mMediumResFilter->SetTargetReduction( 0.9 );

  m_vectorActor = vtkSmartPointer<vtkActor>::New();
  m_vectorActor->GetProperty()->SetColor( GetProperty()->GetVectorColor() );
  m_vectorActor->GetProperty()->SetPointSize( GetProperty()->GetVectorPointSize() );
  m_vectorActor->PickableOff();

  for ( int i = 0; i < 3; i++ )
  {
    m_vectorActor2D[i]->GetProperty()->SetColor( GetProperty()->GetVectorColor() );
    m_vectorActor2D[i]->GetProperty()->SetPointSize( GetProperty()->GetVectorPointSize() );
    m_vectorActor2D[i]->PickableOff();
  }

  m_vertexActor = vtkSmartPointer<vtkActor>::New();
  m_vertexActor->GetProperty()->SetRepresentationToPoints();
  m_vertexActor->VisibilityOff();

  m_wireframeActor = vtkSmartPointer<vtkActor>::New();
  m_wireframeActor->VisibilityOff();

  LayerPropertySurface* p = GetProperty();
  connect( p, SIGNAL(ColorMapChanged()), this, SLOT(UpdateColorMap()) ),
           connect( p, SIGNAL(OpacityChanged(double)), this, SLOT(UpdateOpacity()) );
  connect( p, SIGNAL(EdgeThicknessChanged(int)), this, SLOT(UpdateEdgeThickness()) );
  connect( p, SIGNAL(VectorPointSizeChanged(int)), this, SLOT(UpdateVectorPointSize()) );
  connect( p, SIGNAL(RenderModeChanged(int)), this, SLOT(UpdateRenderMode()) );
  connect( p, SIGNAL(VertexRenderChanged()), this, SLOT(UpdateVertexRender()) );
  connect( p, SIGNAL(MeshRenderChanged()), this, SLOT(UpdateMeshRender()) );
  connect( p, SIGNAL(PositionChanged()), this, SLOT(UpdateActorPositions()) );
}