本文整理汇总了C++中LayerMRI类的典型用法代码示例。如果您正苦于以下问题:C++ LayerMRI类的具体用法?C++ LayerMRI怎么用?C++ LayerMRI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LayerMRI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SurfaceRegionSelected
bool RenderView3D::PickSelectRegion( int nId )
{
LayerCollection* lc_mri = MainWindow::GetMainWindow()->GetLayerCollection( "MRI" );
LayerMRI* mri = NULL;
for ( int i = 0; i < lc_mri->GetNumberOfLayers(); i++ )
{
LayerMRI* mri_temp = (LayerMRI*)lc_mri->GetLayer(i);
if ( mri_temp->GetProperty()->GetShowAsContour() )
{
mri = mri_temp;
break;
}
}
if ( !mri )
{
return false;
}
SurfaceRegion* reg = mri->SelectSurfaceRegion( nId );
if ( reg )
{
emit SurfaceRegionSelected(reg);
}
return true;
}
示例2: RespondTextTranslate
void DialogTransformVolume::RespondTextTranslate( int n )
{
if ( isVisible() )
{
bool bOK;
double dvalue =m_textTranslate[n]->text().toDouble(&bOK);
if ( bOK )
{
LayerMRI* layer = ( LayerMRI* )MainWindow::GetMainWindow()->GetActiveLayer( "MRI" );
if ( layer )
{
double pos[3];
layer->GetTranslate( pos );
pos[n] = dvalue;
layer->SetTranslate( pos );
MainWindow::GetMainWindow()->RequestRedraw();
double* vs = layer->GetWorldVoxelSize();
int range = m_scrollTranslate[n]->maximum();
m_scrollTranslate[n]->blockSignals(true);
m_scrollTranslate[n]->setValue(range/2 + (int)( pos[n] / vs[n] ) );
m_scrollTranslate[n]->blockSignals(false);
UpdateUI( 1 );
}
}
}
}
示例3: RespondTextRotate
void DialogTransformVolume::RespondTextRotate( int n )
{
if ( isVisible() )
{
bool bOK;
double dvalue = m_textAngle[n]->text().toDouble(&bOK);
if ( bOK )
{
LayerMRI* layer = ( LayerMRI* )MainWindow::GetMainWindow()->GetActiveLayer( "MRI" );
if ( layer )
{
double angle[3];
layer->GetRotate( angle );
angle[n] = dvalue;
layer->SetRotate( angle, ui->radioButtonAroundCenter->isChecked() );
MainWindow::GetMainWindow()->RequestRedraw();
while (dvalue > 180)
dvalue -= 360;
while (dvalue < -180)
dvalue += 360;
m_sliderRotate[n]->blockSignals(true);
m_sliderRotate[n]->setValue( (int)dvalue );
m_sliderRotate[n]->blockSignals(false);
UpdateUI( 1 );
}
}
}
}
示例4: RespondTextScale
void DialogTransformVolume::RespondTextScale( int n )
{
if ( isVisible() )
{
bool bOK;
double dvalue = m_textScale[n]->text().toDouble(&bOK);
if ( bOK && dvalue > 0 )
{
LayerMRI* layer = ( LayerMRI* )MainWindow::GetMainWindow()->GetActiveLayer( "MRI" );
if ( layer )
{
double scale[3];
layer->GetScale( scale );
scale[n] = dvalue;
layer->SetScale( scale );
MainWindow::GetMainWindow()->RequestRedraw();
m_scrollScale[n]->blockSignals(true);
if ( dvalue >= 1 )
{
m_scrollScale[n]->setValue( 50 + (int)( (dvalue-1.0)*50 ) );
}
else
{
m_scrollScale[n]->setValue( 50 - (int)( (1.0-dvalue)*100 ) );
}
m_scrollScale[n]->blockSignals(false);
UpdateUI( 0 );
}
}
}
}
示例5: 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();
}
示例6: OnFrameChanged
void WindowTimeCourse::OnFrameChanged(int frame)
{
LayerMRI* layer = qobject_cast<LayerMRI*>(MainWindow::GetMainWindow()->GetActiveLayer("MRI"));
if (layer && frame != layer->GetActiveFrame() && frame < layer->GetNumberOfFrames())
{
layer->SetActiveFrame(frame);
}
}
示例7:
void RenderView3D::CloseSelectRegion()
{
LayerMRI* mri = (LayerMRI*)MainWindow::GetMainWindow()->GetActiveLayer( "MRI" );
if ( mri )
{
mri->CloseSurfaceRegion();
}
}
示例8: OnRestore
void DialogTransformVolume::OnRestore()
{
LayerMRI* layer = ( LayerMRI* )MainWindow::GetMainWindow()->GetActiveLayer( "MRI" );
if ( layer )
{
layer->Restore();
UpdateUI();
}
LayerLandmarks* landmarks = (LayerLandmarks*)MainWindow::GetMainWindow()->GetSupplementLayer("Landmarks");
landmarks->Restore();
}
示例9: SurfaceRegionRemoved
void RenderView3D::DeleteCurrentSelectRegion()
{
LayerMRI* mri = (LayerMRI*)MainWindow::GetMainWindow()->GetActiveLayer( "MRI" );
if ( mri )
{
SurfaceRegion* reg = mri->GetCurrentSurfaceRegion();
if ( mri->DeleteCurrentSurfaceRegion() )
{
emit SurfaceRegionRemoved(reg);
}
}
}
示例10: 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);
}
}
示例11: memset
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();
}
}
}
示例12: memcpy
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();
}
}
示例13: RespondSliderRotate
void DialogTransformVolume::RespondSliderRotate( int n )
{
if ( isVisible() )
{
LayerMRI* layer = ( LayerMRI* )MainWindow::GetMainWindow()->GetActiveLayer( "MRI" );
if ( layer )
{
double angle[3];
layer->GetRotate( angle );
angle[n] = m_sliderRotate[n]->value();
layer->SetRotate( angle, ui->radioButtonAroundCenter->isChecked() );
MainWindow::GetMainWindow()->RequestRedraw();
ChangeLineEditNumber(m_textAngle[n], angle[n] );
UpdateUI( 1 );
}
}
}
示例14: OnCheckBoxFlip
void DialogTransformVolume::OnCheckBoxFlip()
{
if (isVisible())
{
LayerMRI* layer = ( LayerMRI* )MainWindow::GetMainWindow()->GetActiveLayer( "MRI" );
if ( layer )
{
bool flip[3];
layer->GetFlip(flip);
flip[0] = ui->checkBoxFlipX->isChecked();
flip[1] = ui->checkBoxFlipY->isChecked();
flip[2] = ui->checkBoxFlipZ->isChecked();
layer->SetFlip(flip);
MainWindow::GetMainWindow()->RequestRedraw();
}
}
}
示例15: UpdateUI
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();
}