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


C++ LayerSurface::GetTargetAtSurfaceRAS方法代码示例

本文整理汇总了C++中LayerSurface::GetTargetAtSurfaceRAS方法的典型用法代码示例。如果您正苦于以下问题:C++ LayerSurface::GetTargetAtSurfaceRAS方法的具体用法?C++ LayerSurface::GetTargetAtSurfaceRAS怎么用?C++ LayerSurface::GetTargetAtSurfaceRAS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LayerSurface的用法示例。


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

示例1: OnFinishEditing

void PixelInfoListCtrl::OnFinishEditing( wxCommandEvent& event )
{
  LayerCollectionManager* lcm = MainWindow::GetMainWindowPointer()->GetLayerCollectionManager();
  LayerCollection* lc = MainWindow::GetMainWindowPointer()->GetLayerCollection( "MRI" );

  // see if entered text is valid
  wxArrayString sa = MyUtils::SplitString( m_textEditor->GetValue(), _(",") );
  long ptr = m_listPtr[m_nRowEdited];
  Layer* layer_ptr = (Layer*)ptr;
  if ( ptr == 1 || ( layer_ptr && layer_ptr->IsTypeOf( "MRI" ) ) )
  {
    if ( sa.Count() < 3 )
      sa = MyUtils::SplitString( m_textEditor->GetValue(), _(" ") );

    if ( sa.Count() < 3 )
    {
      cerr << "Invalid coordinate string. Make sure they are three numbers." << endl;
      return;
    }
  }

  if ( ptr == 1 ) // RAS
  {
    double ras[3];
    if ( sa[0].ToDouble( ras ) && sa[1].ToDouble( ras+1 ) && sa[2].ToDouble( ras+2 ) )
    {
      wxListItem item;
      GetColumn( 0, item );
      LayerMRI* layer = (LayerMRI*)lc->GetLayer( 0 );
      if ( layer )
        layer->RASToTarget( ras, ras );
      if ( item.GetText() == _("Cursor") )
      {
        lc->SetCursorRASPosition( ras );
        lcm->SetSlicePosition( ras );
      }
      else if ( item.GetText() == _("Mouse") )
        lc->SetCurrentRASPosition( ras );
      UpdateList();
      m_textEditor->Hide();
    }
    else
    {
      cerr << "Invalid coordinate string. Make sure they are three numbers." << endl;
    }
  }
  else if ( layer_ptr && layer_ptr->IsTypeOf( "MRI" ) ) // voxel
  {
    long x, y, z;
    if ( sa.Count() < 3 )
    {
      cerr << "Invalid voxel coordinate string. Make sure they are three numbers." << endl;
      return;
    }
    int n = sa[0].Find( wxChar('['), true );
    if ( n != wxNOT_FOUND )
      sa[0] = sa[0].Mid( n+1 );
    n = sa[2].Find( wxChar(']') );
    if ( n != wxNOT_FOUND )
      sa[2] = sa[2].Left( n );
    if ( sa[0].ToLong( &x ) && sa[1].ToLong( &y ) && sa[2].ToLong( &z ) )
    {
      int nv[3] = { x, y, z };
      double ras[3];
      wxListItem item;
      GetColumn( 0, item );
      LayerMRI* layer = (LayerMRI*)layer_ptr;
      layer->OriginalIndexToRAS( nv, ras );
      layer->RASToTarget( ras, ras );
      if ( item.GetText() == _("Cursor") )
      {
        lc->SetCursorRASPosition( ras );
        lcm->SetSlicePosition( ras );
      }
      else if ( item.GetText() == _("Mouse") )
        lc->SetCurrentRASPosition( ras );
      UpdateList();
      m_textEditor->Hide();
    }
    else
    {
      cerr << "Invalid voxel coordinate string. Make sure they are three numbers." << endl;
    }
  }  
  else if ( layer_ptr && layer_ptr->IsTypeOf( "Surface" )  ) // surface
  {
    wxString strg = m_textEditor->GetValue();
    LayerSurface* layer = (LayerSurface*)layer_ptr;
    double ras[3];
    bool bSuccess = false;
    if ( m_listValue[m_nRowEdited].Find( _("Coord") ) == 0 )  // coordinate item
    {
      sa = MyUtils::SplitString( strg, _(",") );
      if ( sa.Count() < 3 )
        sa = MyUtils::SplitString( m_textEditor->GetValue(), _(" ") );
      if ( sa.Count() >= 3 && sa[0].ToDouble( ras ) && sa[1].ToDouble( ras+1 ) && sa[2].ToDouble( ras+2 ) )
      {
        layer->GetTargetAtSurfaceRAS( ras, ras );
        bSuccess = true;
      }
//.........这里部分代码省略.........
开发者ID:CBoensel,项目名称:freesurfer,代码行数:101,代码来源:PixelInfoPanel.cpp


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