当前位置: 首页>>代码示例>>C++>>正文


C++ LayerMRI类代码示例

本文整理汇总了C++中LayerMRI的典型用法代码示例。如果您正苦于以下问题:C++ LayerMRI类的具体用法?C++ LayerMRI怎么用?C++ LayerMRI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了LayerMRI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SurfaceRegionSelected

bool RenderView3D::PickSelectRegion( int nId )
{
  LayerCollection* lc_mri = MainWindow::GetMainWindow()->GetLayerCollection( "MRI" );
  LayerMRI* mri = NULL;
  for ( int i = 0; i < lc_mri->GetNumberOfLayers(); i++ )
  {
    LayerMRI* mri_temp = (LayerMRI*)lc_mri->GetLayer(i);
    if ( mri_temp->GetProperty()->GetShowAsContour() )
    {
      mri = mri_temp;
      break;
    }
  }

  if ( !mri )
  {
    return false;
  }

  SurfaceRegion* reg = mri->SelectSurfaceRegion( nId );
  if ( reg )
  {
    emit SurfaceRegionSelected(reg);
  }
  return true;
}
开发者ID:neurodebian,项目名称:freesurfer,代码行数:26,代码来源:RenderView3D.cpp

示例2: RespondTextTranslate

void DialogTransformVolume::RespondTextTranslate( int n )
{
  if ( isVisible() )
  {
    bool bOK;
    double dvalue =m_textTranslate[n]->text().toDouble(&bOK);
    if ( bOK )
    {
      LayerMRI* layer = ( LayerMRI* )MainWindow::GetMainWindow()->GetActiveLayer( "MRI" );
      if ( layer )
      {
        double pos[3];
        layer->GetTranslate( pos );
        pos[n] = dvalue;
        layer->SetTranslate( pos );
        MainWindow::GetMainWindow()->RequestRedraw();

        double* vs = layer->GetWorldVoxelSize();
        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( 1 );
      }
    }
  }
}
开发者ID:ewong718,项目名称:freesurfer,代码行数:27,代码来源:DialogTransformVolume.cpp

示例3: RespondTextRotate

void DialogTransformVolume::RespondTextRotate( int n )
{
  if ( isVisible() )
  {
    bool bOK;
    double dvalue = m_textAngle[n]->text().toDouble(&bOK);
    if ( bOK )
    {
      LayerMRI* layer = ( LayerMRI* )MainWindow::GetMainWindow()->GetActiveLayer( "MRI" );
      if ( layer )
      {
        double angle[3];
        layer->GetRotate( angle );
        angle[n] = dvalue;
        layer->SetRotate( angle, ui->radioButtonAroundCenter->isChecked() );
        MainWindow::GetMainWindow()->RequestRedraw();

        while (dvalue > 180)
          dvalue -= 360;
        while (dvalue < -180)
          dvalue += 360;

        m_sliderRotate[n]->blockSignals(true);
        m_sliderRotate[n]->setValue( (int)dvalue );
        m_sliderRotate[n]->blockSignals(false);
        UpdateUI( 1 );
      }
    }
  }
}
开发者ID:ewong718,项目名称:freesurfer,代码行数:30,代码来源:DialogTransformVolume.cpp

示例4: RespondTextScale

void DialogTransformVolume::RespondTextScale( int n )
{
  if ( isVisible() )
  {
    bool bOK;
    double dvalue = m_textScale[n]->text().toDouble(&bOK);
    if ( bOK && dvalue > 0 )
    {
      LayerMRI* layer = ( LayerMRI* )MainWindow::GetMainWindow()->GetActiveLayer( "MRI" );
      if ( layer )
      {
        double scale[3];
        layer->GetScale( scale );
        scale[n] = dvalue;
        layer->SetScale( scale );
        MainWindow::GetMainWindow()->RequestRedraw();

        m_scrollScale[n]->blockSignals(true);
        if ( dvalue >= 1 )
        {
          m_scrollScale[n]->setValue( 50 + (int)( (dvalue-1.0)*50 ) );
        }
        else
        {
          m_scrollScale[n]->setValue( 50 - (int)( (1.0-dvalue)*100 ) );
        }
        m_scrollScale[n]->blockSignals(false);
        UpdateUI( 0 );
      }
    }
  }
}
开发者ID:ewong718,项目名称:freesurfer,代码行数:32,代码来源:DialogTransformVolume.cpp

示例5: sprintf

void Region2DLine::UpdateStats()
{
  char ch[1000];
  sprintf( ch, "%.2f mm", sqrt(vtkMath::Distance2BetweenPoints( m_dPt1, m_dPt2 )) );
  m_strShortStats = ch;
  m_actorText->SetInput( ch );

  LayerMRI* layer = m_view->GetFirstNonLabelVolume();
  if ( layer )
  {
    double* values = NULL;
    int* indices = NULL;
    int count = 0;
    layer->GetVoxelsOnLine( m_dPt1, m_dPt2, m_view->GetViewPlane(), indices, values, &count );
    char ch[1000];
    m_strsLongStats.clear();
    for ( int i = 0; i < count; i++ )
    {
      sprintf( ch, "[%d, %d, %d]  %.2f", indices[i*3], indices[i*3+1], indices[i*3+2], values[i] );
      m_strsLongStats.push_back( ch );
    }
    delete[] indices;
    delete[] values;
  }

  Region2D::UpdateStats();
}
开发者ID:CBoensel,项目名称:freesurfer,代码行数:27,代码来源:Region2DLine.cpp

示例6: OnFrameChanged

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);
  }
}
开发者ID:ewong718,项目名称:freesurfer,代码行数:8,代码来源:WindowTimeCourse.cpp

示例7:

void RenderView3D::CloseSelectRegion()
{
  LayerMRI* mri = (LayerMRI*)MainWindow::GetMainWindow()->GetActiveLayer( "MRI" );
  if ( mri )
  {
    mri->CloseSurfaceRegion();
  }
}
开发者ID:neurodebian,项目名称:freesurfer,代码行数:8,代码来源:RenderView3D.cpp

示例8: OnRestore

void DialogTransformVolume::OnRestore()
{
  LayerMRI* layer = ( LayerMRI* )MainWindow::GetMainWindow()->GetActiveLayer( "MRI" );
  if ( layer )
  {
    layer->Restore();
    UpdateUI();
  }
  LayerLandmarks* landmarks = (LayerLandmarks*)MainWindow::GetMainWindow()->GetSupplementLayer("Landmarks");
  landmarks->Restore();
}
开发者ID:ewong718,项目名称:freesurfer,代码行数:11,代码来源:DialogTransformVolume.cpp

示例9: SurfaceRegionRemoved

void RenderView3D::DeleteCurrentSelectRegion()
{
  LayerMRI* mri = (LayerMRI*)MainWindow::GetMainWindow()->GetActiveLayer( "MRI" );
  if ( mri )
  {
    SurfaceRegion* reg = mri->GetCurrentSurfaceRegion();
    if ( mri->DeleteCurrentSurfaceRegion() )
    {
      emit SurfaceRegionRemoved(reg);
    }
  }
}
开发者ID:neurodebian,项目名称:freesurfer,代码行数:12,代码来源:RenderView3D.cpp

示例10: OnSampleMethodChanged

void DialogTransformVolume::OnSampleMethodChanged()
{
  LayerMRI* layer = (LayerMRI* )MainWindow::GetMainWindow()->GetActiveLayer( "MRI" );
  if (layer)
  {
    int nMethod = SAMPLE_NEAREST;
    if (ui->radioButtonTrilinear->isChecked())
      nMethod = SAMPLE_TRILINEAR;
    else if (ui->radioButtonCubic->isChecked())
      nMethod = SAMPLE_CUBIC_BSPLINE;
    layer->GetProperty()->SetResliceInterpolation(nMethod);
  }
}
开发者ID:ewong718,项目名称:freesurfer,代码行数:13,代码来源:DialogTransformVolume.cpp

示例11: memset

void LayerVolumeBase::SaveBufferItem( UndoRedoBufferItem& item, int nPlane, int nSlice, const char* mask )
{
  item.plane = nPlane;
  item.slice = nSlice;
  if ( nPlane >= 0 )
  {
    int nDim[3], nStart[3] = { 0, 0, 0 };
    m_imageData->GetDimensions( nDim );
    nDim[nPlane] = 1;
    nStart[nPlane] = nSlice;
    int nSize = nDim[0]*nDim[1]*nDim[2]*m_imageData->GetScalarSize();
    item.data = new char[nSize];
    memset( item.data, 0, nSize );
    int n = 0;
    for ( int i = nStart[0]; i < nStart[0] + nDim[0]; i++ )
    {
      for ( int j = nStart[1]; j < nStart[1] + nDim[1]; j++ )
      {
        for ( int k = nStart[2]; k < nStart[2] + nDim[2]; k++ )
        {
          if ( !mask || mask[n] > 0 )
          {
            memcpy( item.data + ( (k-nStart[2])*nDim[1]*nDim[0] + (j-nStart[1])*nDim[0] + (i-nStart[0]) ) * m_imageData->GetScalarSize(),
                    m_imageData->GetScalarPointer( i, j, k ),
                    m_imageData->GetScalarSize() );
          }
          n++;
        }
      }
    }
  }
  else    // save whole volume in cache file
  {
    int nDim[3];
    m_imageData->GetDimensions( nDim );
    int nSize = nDim[0]*nDim[1]*nDim[2]*m_imageData->GetScalarSize();
    QFile file(this->GenerateCacheFileName());
    if (!file.open(QIODevice::WriteOnly))
    {
      return;
    }
    file.write((char*)m_imageData->GetScalarPointer() + nSize*m_nActiveFrame, nSize);
    file.close();
    item.cache_filename = file.fileName();
    if (this->IsTypeOf("MRI"))
    {
      LayerMRI* mri = qobject_cast<LayerMRI*>(this);
      item.mri_settings = mri->GetProperty()->GetSettings();
    }
  }
}
开发者ID:ewong718,项目名称:freesurfer,代码行数:51,代码来源:LayerVolumeBase.cpp

示例12: memcpy

void LayerVolumeBase::LoadBufferItem( UndoRedoBufferItem& item, bool bIgnoreZeros )
{
  if (item.plane >= 0)
  {
    int nDim[3], nStart[3] = { 0, 0, 0 };
    m_imageData->GetDimensions( nDim );
    nDim[item.plane] = 1;
    nStart[item.plane] = item.slice;
    for ( int i = nStart[0]; i < nStart[0] + nDim[0]; i++ )
    {
      for ( int j = nStart[1]; j < nStart[1] + nDim[1]; j++ )
      {
        for ( int k = nStart[2]; k < nStart[2] + nDim[2]; k++ )
        {
          double dValue = m_imageData->GetScalarComponentAsDouble( i, j, k, 0 );
          memcpy( m_imageData->GetScalarPointer( i, j, k ),
                  item.data + ( (k-nStart[2])*nDim[1]*nDim[0] + (j-nStart[1])*nDim[0] + (i-nStart[0]) ) * m_imageData->GetScalarSize(),
                  m_imageData->GetScalarSize() );
          if ( bIgnoreZeros )
          {
            if ( m_imageData->GetScalarComponentAsDouble( i, j, k, 0 ) == 0 )
            {
              m_imageData->SetScalarComponentFromDouble( i, j, k, 0, dValue );
            }
          }
        }
      }
    }
  }
  else if (!item.cache_filename.isEmpty())
  {
    QFile file(item.cache_filename);
    if (!file.open(QIODevice::ReadOnly))
    {
      return;
    }
    int nDim[3];
    m_imageData->GetDimensions( nDim );
    int nSize = nDim[0]*nDim[1]*nDim[2]*m_imageData->GetScalarSize();
    char* p = (char*)m_imageData->GetScalarPointer() + nSize*m_nActiveFrame;
    file.read(p, nSize);
    file.close();
    if (this->IsTypeOf("MRI"))
    {
      LayerMRI* mri = qobject_cast<LayerMRI*>(this);
      mri->GetProperty()->RestoreSettings(item.mri_settings);
    }
    m_imageData->Modified();
  }
}
开发者ID:ewong718,项目名称:freesurfer,代码行数:50,代码来源:LayerVolumeBase.cpp

示例13: RespondSliderRotate

void DialogTransformVolume::RespondSliderRotate( int n )
{
  if ( isVisible() )
  {
    LayerMRI* layer = ( LayerMRI* )MainWindow::GetMainWindow()->GetActiveLayer( "MRI" );
    if ( layer )
    {
      double angle[3];
      layer->GetRotate( angle );
      angle[n] = m_sliderRotate[n]->value();
      layer->SetRotate( angle, ui->radioButtonAroundCenter->isChecked() );
      MainWindow::GetMainWindow()->RequestRedraw();
      ChangeLineEditNumber(m_textAngle[n], angle[n] );
      UpdateUI( 1 );
    }
  }
}
开发者ID:ewong718,项目名称:freesurfer,代码行数:17,代码来源:DialogTransformVolume.cpp

示例14: OnCheckBoxFlip

void DialogTransformVolume::OnCheckBoxFlip()
{
  if (isVisible())
  {
    LayerMRI* layer = ( LayerMRI* )MainWindow::GetMainWindow()->GetActiveLayer( "MRI" );
    if ( layer )
    {
      bool flip[3];
      layer->GetFlip(flip);
      flip[0] = ui->checkBoxFlipX->isChecked();
      flip[1] = ui->checkBoxFlipY->isChecked();
      flip[2] = ui->checkBoxFlipZ->isChecked();
      layer->SetFlip(flip);
      MainWindow::GetMainWindow()->RequestRedraw();
    }
  }
}
开发者ID:neurodebian,项目名称:freesurfer,代码行数:17,代码来源:DialogTransformVolume.cpp

示例15: UpdateUI

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();
}
开发者ID:neurodebian,项目名称:freesurfer,代码行数:18,代码来源:DialogTransformVolume.cpp


注:本文中的LayerMRI类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。