本文整理汇总了C++中LayerSurface::GetVertexIndexAtTarget方法的典型用法代码示例。如果您正苦于以下问题:C++ LayerSurface::GetVertexIndexAtTarget方法的具体用法?C++ LayerSurface::GetVertexIndexAtTarget怎么用?C++ LayerSurface::GetVertexIndexAtTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayerSurface
的用法示例。
在下文中一共展示了LayerSurface::GetVertexIndexAtTarget方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateVertex
void DialogRepositionSurface::UpdateVertex()
{
LayerSurface* surf = (LayerSurface*)MainWindow::GetMainWindow()->GetActiveLayer( "Surface" );
if (surf)
{
int nVertex = surf->GetVertexIndexAtTarget( surf->GetSlicePosition(), NULL );
if ( nVertex >= 0 )
{
ui->lineEditVertex->setText( QString::number(nVertex) );
ui->lineEditVertex2->setText(QString::number(nVertex) );
ui->lineEditVertex3->setText(QString::number(nVertex) );
OnCoordinateTypeChanged();
}
}
}
示例2: DoListenToMessage
void DialogRepositionSurface::DoListenToMessage ( std::string const iMsg, void* iData, void* sender )
{
if ( iMsg == "LayerModified" )
{
UpdateUI();
}
else if ( iMsg == "SurfaceVertexClicked" )
{
LayerSurface* surf = (LayerSurface*)MainWindow::GetMainWindowPointer()->GetActiveLayer( "Surface" );
if ( surf )
{
int nVertex = surf->GetVertexIndexAtTarget( surf->GetSlicePosition(), NULL );
if ( nVertex >= 0 )
m_textVertex->SetValue( ( wxString() << nVertex ) );
}
}
}
示例3: SurfaceVertexClicked
void RenderView3D::PickCurrentSurfaceVertex(int posX, int posY)
{
LayerCollection* lc_surface = MainWindow::GetMainWindow()->GetLayerCollection( "Surface" );
this->setToolTip("");
if ( lc_surface->IsEmpty() )
{
return;
}
vtkCellPicker* picker = vtkCellPicker::SafeDownCast( this->GetRenderWindow()->GetInteractor()->GetPicker() );
if ( picker )
{
picker->InitializePickList();
vtkPropCollection* props = GetRenderer()->GetViewProps();
if ( props )
{
props->InitTraversal();
vtkProp* prop = props->GetNextProp();
while ( prop )
{
if ( vtkActor::SafeDownCast( prop ) )
{
picker->AddPickList( prop );
}
prop = props->GetNextProp();
}
}
double pos[3];
picker->Pick( posX, rect().height() - posY, 0, GetRenderer() );
picker->GetPickPosition( pos );
vtkProp* prop = picker->GetViewProp();
Layer* layer = lc_surface->HasProp( prop );
if (layer)
{
LayerSurface* surf = (LayerSurface*)layer;
surf->SetCurrentVertex(surf->GetVertexIndexAtTarget(pos, NULL));
emit SurfaceVertexClicked();
}
}
}
示例4: SurfaceRegionSelected
//.........这里部分代码省略.........
vtkPoints* pts = vtkPolyDataMapper::SafeDownCast( m_actorSliceFrames[i]->GetMapper() )->GetInput()->GetPoints();
for ( int j = 0; j < 4; j++ )
{
double* p = pts->GetPoint( j );
this->WorldToScreen( p[0], p[1], p[2], x, y );
screen_pts[j][0] = x;
screen_pts[j][1] = y;
screen_pts[j][2] = 0;
}
int ids[4][2] = { {0, 1}, {1, 2}, {2, 3}, {3, 0} };
double dMinDist = 1000000000;
for ( int j = 0; j < 4; j++ )
{
double dist = vtkLine::DistanceToLine( screen_pt, screen_pts[ids[j][0]], screen_pts[ids[j][1]]);
if ( dist < dMinDist )
{
dMinDist = dist;
}
}
if ( dMinDist < SLICE_PICKER_PIXEL_TOLERANCE )
{
HighlightSliceFrame( i );
m_dIntersectPoint[0] = pos[0];
m_dIntersectPoint[1] = pos[1];
m_dIntersectPoint[2] = pos[2];
bFramePicked = true;
break;
}
}
}
}
if ( !bFramePicked )
{
// if ( !lc_surface->IsEmpty() && !lc_surface->HasProp( prop ) )
{
for ( int i = 0; i < 3; i++ )
{
picker->DeletePickList( m_actorSliceBoundingBox[i] );
}
picker->Pick( posX, rect().height() - posY, 0, GetRenderer() );
picker->GetPickPosition( pos );
prop = picker->GetViewProp();
}
if ( lc_mri->HasProp( prop ) || lc_roi->HasProp( prop ) )
{
if ( bCursor )
{
LayerMRI* mri = (LayerMRI*)lc_mri->HasProp( prop );
SurfaceRegion* reg = NULL;
if ( mri )
{
reg = mri->SelectSurfaceRegion( pos );
}
if ( reg )
{
RequestRedraw( true ); // force redraw
emit SurfaceRegionSelected(reg);
}
}
else
{
LayerVolumeTrack* vt = qobject_cast<LayerVolumeTrack*>(lc_mri->HasProp( prop ));
if (vt)
{
QVariantMap info = vt->GetLabelByProp(prop);
if (!info.isEmpty())
{
this->setToolTip(QString("%1 %2").arg(info["label"].toInt()).arg(info["name"].toString()));
emit VolumeTrackMouseOver(vt, info);
}
}
}
}
else if ( Layer* layer = lc_surface->HasProp( prop ) )
{
if ( bCursor )
{
lc_mri->SetCursorRASPosition( pos );
MainWindow::GetMainWindow()->SetSlicePosition( pos );
if (layer)
{
lc_surface->SetActiveLayer(layer);
LayerSurface* surf = (LayerSurface*)layer;
surf->SetCurrentVertex(surf->GetVertexIndexAtTarget(pos, NULL));
}
emit SurfaceVertexClicked();
}
else
{
lc_mri->SetCurrentRASPosition( pos );
}
}
HighlightSliceFrame( -1 );
}
}
}
示例5: UpdateAll
void InfoTreeWidget::UpdateAll()
{
this->clear();
m_editor->hide();
LayerCollection* lc_mri = MainWindow::GetMainWindow()->GetLayerCollection( "MRI" );
LayerCollection* lc_surf = MainWindow::GetMainWindow()->GetLayerCollection( "Surface" );
if ( lc_mri->IsEmpty() && lc_surf->IsEmpty())
{
return;
}
QTreeWidgetItem* item = new QTreeWidgetItem(this);
item->setText(0, "RAS");
double ras[3] = {m_dRAS[0], m_dRAS[1], m_dRAS[2]};
if (!lc_mri->IsEmpty())
{
qobject_cast<LayerMRI*>(lc_mri->GetLayer(0))->RemapPositionToRealRAS(m_dRAS, ras);
}
QVariantMap map;
item->setText(1, QString("%1, %2, %3")
.arg(ras[0], 0, 'f', 2)
.arg(ras[1], 0, 'f', 2)
.arg(ras[2], 0, 'f', 2));
map["Type"] = "RAS";
map["EditableText"] = item->text(1);
item->setData(1, Qt::UserRole, map);
for (int i = 0; i < lc_mri->GetNumberOfLayers(); i++)
{
LayerMRI* layer = (LayerMRI*)lc_mri->GetLayer(i);
int nIndex[3];
if ( layer->GetProperty()->GetShowInfo() )
{
QTreeWidgetItem* item = new QTreeWidgetItem(this);
item->setText(0, layer->GetName());
layer->RASToOriginalIndex( ras, nIndex );
double dvalue = layer->GetVoxelValue( m_dRAS );
QString editable = QString("%1, %2, %3").arg(nIndex[0]).arg(nIndex[1]).arg(nIndex[2]);
QString strg = QString("%1 \t[%2]").arg(dvalue).arg(editable);
QString labelStrg;
if (layer->IsTypeOf("PLabel"))
{
labelStrg = ((LayerPLabel*)layer)->GetLabelName(m_dRAS);
}
else
{
labelStrg = layer->GetLabelName( dvalue );
}
if (!labelStrg.isEmpty())
{
strg += " " + labelStrg;
}
item->setText(1, strg);
map.clear();
map["Type"] = "MRI";
map["EditableText"] = editable;
map["Object"] = QVariant::fromValue((QObject*)layer);
item->setData(1, Qt::UserRole, map);
}
}
for (int i = 0; i < lc_surf->GetNumberOfLayers(); i++)
{
LayerSurface* surf = (LayerSurface*)lc_surf->GetLayer(i);
if ( surf->GetProperty()->GetShowInfo() )
{
QTreeWidgetItem* item = new QTreeWidgetItem(this);
item->setText(0, surf->GetName());
double sf_pos[3];
surf->GetSurfaceRASAtTarget( m_dRAS, sf_pos );
QString editable = QString("%1, %2, %3")
.arg(sf_pos[0], 0, 'f', 2)
.arg(sf_pos[1], 0, 'f', 2)
.arg(sf_pos[2], 0, 'f', 2);
item->setText(1, QString("SurfaceRAS\t[%1]").arg(editable));
map.clear();
map["Type"] = "SurfaceRAS";
map["EditableText"] = editable;
map["Object"] = QVariant::fromValue((QObject*)surf);
item->setData(1, Qt::UserRole, map);
int nVertex = surf->GetVertexIndexAtTarget( m_dRAS, NULL );
if ( nVertex >= 0 )
{
surf->GetSurfaceRASAtVertex( nVertex, sf_pos );
QTreeWidgetItem* item = new QTreeWidgetItem(this);
item->setText(1, QString("Vertex \t%1 [%2, %3, %4]")
.arg(nVertex)
.arg(sf_pos[0], 0, 'f', 2)
.arg(sf_pos[1], 0, 'f', 2)
.arg(sf_pos[2], 0, 'f', 2));
map.clear();
map["Type"] = "SurfaceVertex";
map["EditableText"] = QString::number(nVertex);
map["Object"] = QVariant::fromValue((QObject*)surf);
item->setData(1, Qt::UserRole, map);
double vec[3];
//.........这里部分代码省略.........