本文整理汇总了C++中LayerMRI::GetProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ LayerMRI::GetProperty方法的具体用法?C++ LayerMRI::GetProperty怎么用?C++ LayerMRI::GetProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayerMRI
的用法示例。
在下文中一共展示了LayerMRI::GetProperty方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnActiveLayerChanged
void DialogTransformVolume::OnActiveLayerChanged()
{
if ( isVisible() )
{
UpdateUI();
}
LayerMRI* layer = (LayerMRI* )MainWindow::GetMainWindow()->GetActiveLayer( "MRI" );
if (!layer)
return;
connect(layer->GetProperty(), SIGNAL(ColorMapChanged()), this, SLOT(OnActiveLayerChanged()), Qt::UniqueConnection);
LayerLandmarks* landmarks = (LayerLandmarks*)MainWindow::GetMainWindow()->GetSupplementLayer( "Landmarks" );
landmarks->SetMRIRef(layer);
if (layer->GetProperty()->GetColorMap() == LayerPropertyMRI::LUT)
ui->radioButtonNearestNeighbor->setChecked(true);
else
ui->radioButtonCubic->setChecked(true);
OnSampleMethodChanged();
}
示例2: OnSampleMethodChanged
void DialogTransformVolume::OnSampleMethodChanged()
{
LayerMRI* layer = (LayerMRI* )MainWindow::GetMainWindow()->GetActiveLayer( "MRI" );
if (layer)
{
int nMethod = SAMPLE_NEAREST;
if (ui->radioButtonTrilinear->isChecked())
nMethod = SAMPLE_TRILINEAR;
else if (ui->radioButtonCubic->isChecked())
nMethod = SAMPLE_CUBIC_BSPLINE;
layer->GetProperty()->SetResliceInterpolation(nMethod);
}
}
示例3: SaveBufferItem
void LayerVolumeBase::SaveBufferItem( UndoRedoBufferItem& item, int nPlane, int nSlice, const char* mask )
{
item.plane = nPlane;
item.slice = nSlice;
if ( nPlane >= 0 )
{
int nDim[3], nStart[3] = { 0, 0, 0 };
m_imageData->GetDimensions( nDim );
nDim[nPlane] = 1;
nStart[nPlane] = nSlice;
int nSize = nDim[0]*nDim[1]*nDim[2]*m_imageData->GetScalarSize();
item.data = new char[nSize];
memset( item.data, 0, nSize );
int n = 0;
for ( int i = nStart[0]; i < nStart[0] + nDim[0]; i++ )
{
for ( int j = nStart[1]; j < nStart[1] + nDim[1]; j++ )
{
for ( int k = nStart[2]; k < nStart[2] + nDim[2]; k++ )
{
if ( !mask || mask[n] > 0 )
{
memcpy( item.data + ( (k-nStart[2])*nDim[1]*nDim[0] + (j-nStart[1])*nDim[0] + (i-nStart[0]) ) * m_imageData->GetScalarSize(),
m_imageData->GetScalarPointer( i, j, k ),
m_imageData->GetScalarSize() );
}
n++;
}
}
}
}
else // save whole volume in cache file
{
int nDim[3];
m_imageData->GetDimensions( nDim );
int nSize = nDim[0]*nDim[1]*nDim[2]*m_imageData->GetScalarSize();
QFile file(this->GenerateCacheFileName());
if (!file.open(QIODevice::WriteOnly))
{
return;
}
file.write((char*)m_imageData->GetScalarPointer() + nSize*m_nActiveFrame, nSize);
file.close();
item.cache_filename = file.fileName();
if (this->IsTypeOf("MRI"))
{
LayerMRI* mri = qobject_cast<LayerMRI*>(this);
item.mri_settings = mri->GetProperty()->GetSettings();
}
}
}
示例4: LoadBufferItem
void LayerVolumeBase::LoadBufferItem( UndoRedoBufferItem& item, bool bIgnoreZeros )
{
if (item.plane >= 0)
{
int nDim[3], nStart[3] = { 0, 0, 0 };
m_imageData->GetDimensions( nDim );
nDim[item.plane] = 1;
nStart[item.plane] = item.slice;
for ( int i = nStart[0]; i < nStart[0] + nDim[0]; i++ )
{
for ( int j = nStart[1]; j < nStart[1] + nDim[1]; j++ )
{
for ( int k = nStart[2]; k < nStart[2] + nDim[2]; k++ )
{
double dValue = m_imageData->GetScalarComponentAsDouble( i, j, k, 0 );
memcpy( m_imageData->GetScalarPointer( i, j, k ),
item.data + ( (k-nStart[2])*nDim[1]*nDim[0] + (j-nStart[1])*nDim[0] + (i-nStart[0]) ) * m_imageData->GetScalarSize(),
m_imageData->GetScalarSize() );
if ( bIgnoreZeros )
{
if ( m_imageData->GetScalarComponentAsDouble( i, j, k, 0 ) == 0 )
{
m_imageData->SetScalarComponentFromDouble( i, j, k, 0, dValue );
}
}
}
}
}
}
else if (!item.cache_filename.isEmpty())
{
QFile file(item.cache_filename);
if (!file.open(QIODevice::ReadOnly))
{
return;
}
int nDim[3];
m_imageData->GetDimensions( nDim );
int nSize = nDim[0]*nDim[1]*nDim[2]*m_imageData->GetScalarSize();
char* p = (char*)m_imageData->GetScalarPointer() + nSize*m_nActiveFrame;
file.read(p, nSize);
file.close();
if (this->IsTypeOf("MRI"))
{
LayerMRI* mri = qobject_cast<LayerMRI*>(this);
mri->GetProperty()->RestoreSettings(item.mri_settings);
}
m_imageData->Modified();
}
}
示例5: MakeAllLayers
void LayerFCD::MakeAllLayers()
{
if (true)
{
LayerMRI* mri = m_mri_norm;
if (m_layerSource)
{
mri->SetRefVolume(m_layerSource->GetSourceVolume());
}
mri->SetName(GetName() + "_norm");
mri->SetFileName(m_fcd->mri_norm->fname);
if ( mri->CreateFromMRIData((void*)m_fcd->mri_norm) )
{
if (!m_layerSource)
{
m_layerSource = mri;
InitializeData();
}
}
else
{
cerr << "Failed to create norm layer" << endl;
delete mri;
m_mri_norm = NULL;
}
}
if (m_fcd->mri_flair)
{
LayerMRI* mri = m_mri_flair;
if (m_layerSource)
{
mri->SetRefVolume(m_layerSource->GetSourceVolume());
}
mri->SetName(GetName() + "_flair");
mri->SetFileName(m_fcd->mri_flair->fname);
if ( !mri->CreateFromMRIData((void*)m_fcd->mri_flair) )
{
delete m_mri_flair;
m_mri_flair = NULL;
}
}
else
{
delete m_mri_flair;
m_mri_flair = NULL;
}
if (m_fcd->mri_t2)
{
LayerMRI* mri = m_mri_t2;
if (m_layerSource)
{
mri->SetRefVolume(m_layerSource->GetSourceVolume());
}
mri->SetName(GetName() + "_t2");
mri->SetFileName(m_fcd->mri_t2->fname);
if ( !mri->CreateFromMRIData((void*)m_fcd->mri_t2) )
{
delete m_mri_t2;
m_mri_t2 = NULL;
}
}
else
{
delete m_mri_t2;
m_mri_t2 = NULL;
}
if (m_fcd->mri_aseg)
{
LayerMRI* mri = m_mri_aseg;
if (m_layerSource)
{
mri->SetRefVolume(m_layerSource->GetSourceVolume());
}
mri->SetName(GetName() + "_aseg");
mri->SetFileName(m_fcd->mri_aseg->fname);
if ( mri->CreateFromMRIData((void*)m_fcd->mri_aseg) )
{
mri->GetProperty()->SetColorMap(LayerPropertyMRI::LUT);
mri->SetVisible(false);
}
else
{
delete m_mri_aseg;
m_mri_aseg = NULL;
}
}
else
{
delete m_mri_aseg;
m_mri_aseg = NULL;
}
if (m_fcd->mri_thickness_difference)
{
LayerMRI* mri = m_mri_difference;
if (m_layerSource)
{
//.........这里部分代码省略.........
示例6: 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];
//.........这里部分代码省略.........
示例7: 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;
}
//.........这里部分代码省略.........