本文整理汇总了C++中LayerMRI::IsVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ LayerMRI::IsVisible方法的具体用法?C++ LayerMRI::IsVisible怎么用?C++ LayerMRI::IsVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayerMRI
的用法示例。
在下文中一共展示了LayerMRI::IsVisible方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnActionVoxelContour
void ToolWindowEdit::OnActionVoxelContour( wxCommandEvent& event )
{
MainWindow::GetMainWindowPointer()->SetAction( Interactor2DVoxelEdit::EM_Contour );
BrushProperty* bp = MainWindow::GetMainWindowPointer()->GetBrushProperty();
LayerMRI* layer = (LayerMRI*)MainWindow::GetMainWindowPointer()->GetActiveLayer( "MRI" );
if ( layer && layer->GetProperties()->GetColorMap() == LayerPropertiesMRI::LUT )
layer->GetProperties()->SetShowLabelOutline( true );
if ( !bp->GetReferenceLayer() )
{
LayerCollection* lc_mri = MainWindow::GetMainWindowPointer()->GetLayerCollection( "MRI" );
for ( int i = 0; i < lc_mri->GetNumberOfLayers(); i++ )
{
LayerMRI* mri = (LayerMRI*)lc_mri->GetLayer( i );
if ( mri->GetProperties()->GetColorMap() != LayerPropertiesMRI::LUT && mri->IsVisible() && mri != layer )
{
bp->SetReferenceLayer( mri );
break;
}
}
}
UpdateTools();
}
示例2: ProcessMouseMoveEvent
bool Interactor2D::ProcessMouseMoveEvent( wxMouseEvent& event, RenderView* renderview )
{
RenderView2D* view = ( RenderView2D* )renderview;
LayerCollectionManager* lcm = MainWindow::GetMainWindowPointer()->GetLayerCollectionManager();
if ( !lcm->HasAnyLayer() )
{
return Interactor::ProcessMouseMoveEvent( event, renderview );
}
int posX = event.GetX();
int posY = event.GetY();
if ( m_bChangeSlice )
{
double* voxelSize = lcm->GetLayerCollection( "MRI" )->GetWorldVoxelSize();
int nPlane = view->GetViewPlane();
double dPixelPer = -0.20;
double dPosDiff = ( ( (int)( dPixelPer * ( posY - m_nDownPosY ) ) ) / dPixelPer -
( (int)( dPixelPer * ( m_nMousePosY - m_nDownPosY ) ) ) / dPixelPer )
* dPixelPer * voxelSize[nPlane];
if ( lcm->OffsetSlicePosition( nPlane, dPosDiff ) )
{
m_nMousePosX = posX;
m_nMousePosY = posY;
}
}
else if ( m_bMovingCursor )
{
view->UpdateCursorRASPosition( posX, posY );
view->NeedRedraw();
}
else if ( m_bWindowLevel )
{
std::vector<Layer*> layers = lcm->GetLayerCollection( "MRI" )->GetLayers();
LayerMRI* layer = NULL;
for ( size_t i = 0; i < layers.size(); i++ )
{
layer = ( LayerMRI*)layers[i];
if ( layer->IsVisible() && layer->GetProperties()->GetColorMap() == LayerPropertiesMRI::Grayscale )
break;
}
if ( layer )
{
double scaleX = 0.002;
double scaleY = 0.002;
double w = ( posX - m_nMousePosX ) * scaleX;
double l = ( posY - m_nMousePosY ) * scaleY;
double scaleOverall = layer->GetProperties()->GetMaxValue() -
layer->GetProperties()->GetMinValue();
w *= scaleOverall;
l *= scaleOverall;
w += layer->GetProperties()->GetWindow();
l += layer->GetProperties()->GetLevel();
if ( w < 0 )
w = 0;
layer->GetProperties()->SetWindowLevel( w, l );
}
m_nMousePosX = posX;
m_nMousePosY = posY;
}
else if ( m_bSelecting )
{
view->UpdateSelection( posX, posY );
view->NeedRedraw();
}
else
{
if ( event.MiddleIsDown() || event.RightIsDown() )
{
view->UpdateAnnotation();
view->Update2DOverlay();
if ( event.RightIsDown() )
view->SendBroadcast( "Zooming", view );
}
else
view->UpdateMouseRASPosition( posX, posY );
return Interactor::ProcessMouseMoveEvent( event, renderview );
}
return false;
}
示例3: if
bool Interactor2DRegionEdit::ProcessMouseDownEvent( wxMouseEvent& event, RenderView* renderview )
{
RenderView2D* view = ( RenderView2D* )renderview;
// UpdateCursor( event, view );
if ( event.LeftDown() )
{
// if ( event.CmdDown() )
// return Interactor2D::ProcessMouseDownEvent( event, renderview );
LayerCollection* lc = MainWindow::GetMainWindowPointer()->GetLayerCollectionManager()->GetLayerCollection( "MRI" );
LayerMRI* mri = ( LayerMRI* )lc->GetActiveLayer();
if ( (!mri || !mri->IsVisible()) ) //&& ( event.CmdDown() || m_nAction == EM_Polyline ) )
{
SendBroadcast( "MRINotVisible", this );
}
else if ( !mri->IsEditable() ) //&& ( event.CmdDown() || m_nAction == EM_Polyline ) )
{
SendBroadcast( "MRINotEditable", this );
}
else
{
m_nMousePosX = event.GetX();
m_nMousePosY = event.GetY();
double ras[3];
view->MousePositionToRAS( m_nMousePosX, m_nMousePosY, ras );
if ( m_nAction == EM_Freehand ) //&& ( event.CmdDown() ) )
{
mri->SaveForUndo( view->GetViewPlane() );
if ( event.CmdDown() )
{
mri->FloodFillByRAS( ras, view->GetViewPlane(), !event.ShiftDown() );
}
else
{
m_bEditing = true;
mri->SetVoxelByRAS( ras, view->GetViewPlane(), !event.ShiftDown() );
}
}
else if ( m_nAction == EM_Fill ) //&& ( event.CmdDown() ) )
{
mri->SaveForUndo( view->GetViewPlane() );
mri->FloodFillByRAS( ras, view->GetViewPlane(), !event.ShiftDown() );
}
else if ( m_nAction == EM_Polyline )
{
m_bEditing = true;
double ras2[3];
view->GetCursor2D()->GetPosition( ras2 );
view->GetCursor2D()->SetPosition( ras );
view->GetCursor2D()->SetPosition2( ras );
if ( m_dPolylinePoints.size() > 0 )
{
mri->SetVoxelByRAS( ras, ras2, view->GetViewPlane(), !event.ShiftDown() );
}
else
{
mri->SaveForUndo( view->GetViewPlane() );
m_dPolylinePoints.push_back( ras[0] );
m_dPolylinePoints.push_back( ras[1] );
m_dPolylinePoints.push_back( ras[2] );
}
if ( view->GetCapture() == view )
view->ReleaseMouse();
view->CaptureMouse();
}
else
return Interactor2D::ProcessMouseDownEvent( event, renderview );
}
return false;
}
else if ( m_bEditing )
{
m_bEditing = false;
if ( m_nAction == EM_Polyline )
{
if ( event.MiddleDown() )
{
view->GetCursor2D()->Update();
view->NeedRedraw();
}
else if ( event.RightDown() )
{
if ( m_dPolylinePoints.size() > 0 )
{
LayerCollection* lc = MainWindow::GetMainWindowPointer()->GetLayerCollection( "MRI" );
LayerMRI* mri = ( LayerMRI* )lc->GetActiveLayer();
double ras1[3] = { m_dPolylinePoints[0], m_dPolylinePoints[1], m_dPolylinePoints[2] };
double ras2[3];
view->GetCursor2D()->GetPosition( ras2 );
view->GetCursor2D()->SetPosition2( ras2 );
view->GetCursor2D()->SetPosition( ras1 );
mri->SetVoxelByRAS( ras1, ras2, view->GetViewPlane(), !event.ShiftDown() );
}
}
}
//.........这里部分代码省略.........
示例4: ProcessMouseMoveEvent
bool Interactor2D::ProcessMouseMoveEvent( QMouseEvent* event, RenderView* renderview )
{
RenderView2D* view = ( RenderView2D* )renderview;
MainWindow* mainwnd = MainWindow::GetMainWindow();
if ( mainwnd->IsEmpty() )
{
return Interactor::ProcessMouseMoveEvent( event, renderview );
}
int posX = event->x();
int posY = event->y();
if ( m_bChangeSlice )
{
double* voxelSize = mainwnd->GetLayerCollection( "MRI" )->GetWorldVoxelSize();
int nPlane = view->GetViewPlane();
double dPixelPer = -0.25;
double dPosDiff = ( ( (int)( dPixelPer * ( posY - m_nDownPosY ) ) ) / dPixelPer -
( (int)( dPixelPer * ( m_nMousePosY - m_nDownPosY ) ) ) / dPixelPer )
* dPixelPer * voxelSize[nPlane];
if ( mainwnd->OffsetSlicePosition( nPlane, dPosDiff ) )
{
m_nMousePosX = posX;
m_nMousePosY = posY;
}
}
else if ( m_bMovingCursor )
{
view->UpdateCursorRASPosition( posX, posY );
view->RequestRedraw();
}
else if ( m_bWindowLevel )
{
QList<Layer*> layers = mainwnd->GetLayerCollection( "MRI" )->GetLayers();
LayerMRI* layer = (LayerMRI*)mainwnd->GetActiveLayer("MRI");
if (layer && (!layer->IsVisible() || layer->GetProperty()->GetColorMap() == LayerPropertyMRI::LUT))
{
layer = NULL;
}
if (layer == NULL)
{
for ( int i = 0; i < layers.size(); i++ )
{
layer = ( LayerMRI*)layers[i];
if ( layer->IsVisible() && layer->GetProperty()->GetColorMap() != LayerPropertyMRI::LUT )
{
break;
}
else
{
layer = NULL;
}
}
}
if ( layer )
{
double scaleX = 0.002;
double scaleY = 0.002;
double w = ( posX - m_nMousePosX ) * scaleX;
double l = ( posY - m_nMousePosY ) * scaleY;
double scaleOverall = layer->GetProperty()->GetMaxValue() -
layer->GetProperty()->GetMinValue();
w *= scaleOverall;
l *= scaleOverall;
switch ( layer->GetProperty()->GetColorMap() )
{
case LayerPropertyMRI::Grayscale:
w += layer->GetProperty()->GetWindow();
l += layer->GetProperty()->GetLevel();
if ( w < 0 )
{
w = 0;
}
layer->GetProperty()->SetWindowLevel(w, l);
break;
case LayerPropertyMRI::Heat:
w += layer->GetProperty()->GetHeatScaleMaxThreshold() - layer->GetProperty()->GetHeatScaleMinThreshold();
l += (layer->GetProperty()->GetHeatScaleMaxThreshold() + layer->GetProperty()->GetHeatScaleMinThreshold())/2;
if ( w < 0 )
{
w = 0;
}
layer->GetProperty()->SetHeatScale( l-w/2, l, l+w/2 );
break;
default:
w += layer->GetProperty()->GetMaxGenericThreshold() - layer->GetProperty()->GetMinGenericThreshold();
l += (layer->GetProperty()->GetMaxGenericThreshold() + layer->GetProperty()->GetMinGenericThreshold())/2;
if ( w < 0 )
{
w = 0;
}
layer->GetProperty()->SetMinMaxGenericThreshold( l-w/2, l+w/2 );
break;
}
}
m_nMousePosX = posX;
m_nMousePosY = posY;
}
//.........这里部分代码省略.........