本文整理汇总了C++中LayerMRI::GetVoxelsOnLine方法的典型用法代码示例。如果您正苦于以下问题:C++ LayerMRI::GetVoxelsOnLine方法的具体用法?C++ LayerMRI::GetVoxelsOnLine怎么用?C++ LayerMRI::GetVoxelsOnLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayerMRI
的用法示例。
在下文中一共展示了LayerMRI::GetVoxelsOnLine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: sqrt
void Region2DPolyline::UpdateStats()
{
if ( m_worldPts.size() < 2 )
{
return;
}
double dist = 0;
char ch[1000];
LayerMRI* layer = m_view->GetFirstNonLabelVolume();
m_strsLongStats.clear();
if ( m_bSpline )
{
vtkSmartPointer<vtkPoints> pts = vtkSmartPointer<vtkPoints>::New();
for ( size_t i = 0; i < m_worldPts.size(); i++ )
{
pts->InsertNextPoint( m_worldPts[i].pos );
}
vtkSmartPointer<vtkParametricSpline> spline = vtkSmartPointer<vtkParametricSpline>::New();
spline->SetPoints( pts );
int nSteps = 100;
double* values = NULL;
int* indices = NULL;
for ( int i = 0; i < nSteps; i++ )
{
double pt1[3], pt2[3], u[3], du[9];
double uvalue = ((double)i)/nSteps;
u[0] = u[1] = u[2] = uvalue;
spline->Evaluate( u, pt1, du );
uvalue = (i+1.0)/nSteps;
u[0] = u[1] = u[2] = uvalue;
spline->Evaluate( u, pt2, du );
dist += sqrt( vtkMath::Distance2BetweenPoints( pt1, pt2 ) );
int count = 0;
if ( layer )
{
layer->GetVoxelsOnLine( pt1, pt2, m_view->GetViewPlane(), indices, values, &count );
for ( int j = 0; j < (i==nSteps-1?count:count-1); j++ )
{
sprintf( ch, "[%d, %d, %d] %.2f", indices[j*3], indices[j*3+1], indices[j*3+2], values[j] );
m_strsLongStats.push_back( ch );
}
delete[] values;
delete[] indices;
}
}
}
else
{
double* values = NULL;
int* indices = NULL;
for ( size_t i = 1; i < m_worldPts.size(); i++ )
{
dist += sqrt( vtkMath::Distance2BetweenPoints( m_worldPts[i-1].pos, m_worldPts[i].pos ) );
int count = 0;
if ( layer )
{
layer->GetVoxelsOnLine( m_worldPts[i-1].pos, m_worldPts[i].pos, m_view->GetViewPlane(), indices, values, &count );
for ( int j = 0; j < (i==m_worldPts.size()-1?count:count-1); j++ )
{
sprintf( ch, "[%d, %d, %d] %.2f", indices[j*3], indices[j*3+1], indices[j*3+2], values[j] );
m_strsLongStats.push_back( ch );
}
delete[] values;
delete[] indices;
}
}
}
sprintf( ch, "%.2f mm", dist );
m_strShortStats = ch;
m_actorText->SetInput( ch );
Region2D::UpdateStats();
}