void RenderView3D::DeleteCurrentSelectRegion()
{
  LayerMRI* mri = (LayerMRI*)MainWindow::GetMainWindow()->GetActiveLayer( "MRI" );
  if ( mri )
  {
    SurfaceRegion* reg = mri->GetCurrentSurfaceRegion();
    if ( mri->DeleteCurrentSurfaceRegion() )
    {
      emit SurfaceRegionRemoved(reg);
    }
  }
}
bool Interactor3DMeasure::ProcessMouseDownEvent( wxMouseEvent& event, RenderView* renderview )
{
  RenderView3D* view = ( RenderView3D* )renderview;

  bool ret = Interactor3D::ProcessMouseDownEvent( event, renderview );

  if ( m_nAction == MM_SurfaceRegion && !Interactor3D::IsInAction() && event.LeftDown() )
  {
    if ( event.CmdDown() && !event.ShiftDown() )
    {
      if ( view->InitializeSelectRegion( event.GetX(), event.GetY() ) )
      {
        m_bSelectRegion = true;
        return false;   // do not pass down the event
      }
    }
    else if ( event.CmdDown() && event.ShiftDown() )
    {
      LayerMRI* mri = (LayerMRI*)MainWindow::GetMainWindowPointer()->GetActiveLayer( "MRI" );
      if ( mri && mri->GetCurrentSurfaceRegion() )
      {
        mri->GetCurrentSurfaceRegion()->ResetOutline();
        m_bSelectRegion = true;
        return false;
      }
    }
    else if ( !event.CmdDown() && event.ShiftDown() )
    {
      LayerMRI* mri = (LayerMRI*)MainWindow::GetMainWindowPointer()->GetActiveLayer( "MRI" );
      if ( mri && mri->GetCurrentSurfaceRegion() )
      {
        if ( mri->GetCurrentSurfaceRegion()->DeleteCell( view, event.GetX(), event.GetY() ) )
          view->NeedRedraw();
        return false;
      }
    }
  }
   
  return ret;
}