本文整理汇总了C++中mitk::datanode::Pointer::GetData方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::GetData方法的具体用法?C++ Pointer::GetData怎么用?C++ Pointer::GetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mitk::datanode::Pointer
的用法示例。
在下文中一共展示了Pointer::GetData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
bool QmitkDataStorageTableModel::DataNodeCompareFunction::operator()(const mitk::DataNode::Pointer &_Left,
const mitk::DataNode::Pointer &_Right) const
{
switch (m_CompareCriteria)
{
case CompareByClassName:
if (m_CompareOperator == Less)
return (_Left->GetData()->GetNameOfClass() < _Right->GetData()->GetNameOfClass());
else
return (_Left->GetData()->GetNameOfClass() > _Right->GetData()->GetNameOfClass());
break;
case CompareByVisibility:
{
bool _LeftVisibility = false;
bool _RightVisibility = false;
_Left->GetVisibility(_LeftVisibility, nullptr);
_Right->GetVisibility(_RightVisibility, nullptr);
if (m_CompareOperator == Less)
return (_LeftVisibility < _RightVisibility);
else
return (_LeftVisibility > _RightVisibility);
}
break;
// CompareByName:
default:
if (m_CompareOperator == Less)
return (_Left->GetName() < _Right->GetName());
else
return (_Left->GetName() > _Right->GetName());
break;
}
}
示例2: foreach
foreach( mitk::DataNode::Pointer node, nodes )
{
if( node.IsNotNull() && dynamic_cast< mitk::TubeGraph* >(node->GetData()) )
{
m_Controls.activeGraphComboBox->SetSelectedNode(node);
m_ActiveTubeGraph = dynamic_cast< mitk::TubeGraph* >(node->GetData());
m_ActiveProperty = dynamic_cast<mitk::TubeGraphProperty*>(m_ActiveTubeGraph->GetProperty( "Tube Graph.Visualization Information" ).GetPointer());
this->UpdateActiveTubeGraphInInteractors();
this->UpdateLabelGroups();
this->UpdateAnnotation();
}
}
示例3: SetToolTipSurface
void QmitkNavigationToolCreationAdvancedWidget::SetToolTipSurface( bool cone, mitk::DataNode::Pointer node /*= NULL*/ )
{
m_ToolTipSurface = NULL;
if(cone)
{
m_ToolTipSurface = mitk::Surface::New();
vtkConeSource *vtkData = vtkConeSource::New();
vtkData->SetAngle(5.0);
vtkData->SetResolution(50);
vtkData->SetHeight(6.0f);
vtkData->SetRadius(2.0f);
vtkData->SetCenter(0.0, 0.0, 0.0);
vtkData->Update();
m_ToolTipSurface->SetVtkPolyData(vtkData->GetOutput());
vtkData->Delete();
m_SurfaceNodeName ="";
}
else if(!cone && node.IsNotNull())
{
m_ToolTipSurface = dynamic_cast<mitk::Surface*>(node->GetData());
m_SurfaceNodeName = node->GetName();
}
}
示例4: receive
void MaskingItem::receive(mitk::DataNode::Pointer node)
{
if(!node)
{
setEnabled(false);
emit this->setStatus(false);
return;
}
bool isMasking = false;
node->GetBoolProperty("masking", isMasking);
mitk::LabelSetImage* labelSetImage = dynamic_cast<mitk::LabelSetImage*>(node->GetData());
if(isMasking && !labelSetImage)
{
setEnabled(true);
this->m_node = node;
this->createNewMask(node);
emit this->setStatus(true);
}
else if(isMasking && labelSetImage)
{
setEnabled(true);
this->m_node = node;
this->initNode(node);
emit this->setStatus(true);
}
else
{
setEnabled(false);
deactivateTool();
emit this->setStatus(false);
}
}
示例5: mitkThrow
bool mitk::NodeDisplacementFilter::AddNode( mitk::DataNode::Pointer node )
{
// Consistency Checks
if (node.IsNull())
{
MITK_WARN("NodeDisplacementFilter")
<< "Null Node passed to NodeDisplacementFilter. Ignoring Node....";
return false;
}
if (node->GetData() == 0)
{
MITK_WARN("NodeDisplacementFilter")
<< "Empty Node passed to NodeDisplacementFilter. Ignoring Node....";
return false;
}
if(m_SelectedInput == -1)
{
MITK_ERROR("NodeDisplacementFilter")
<< "Cannot add nodes before input Stream was selected";
mitkThrow() << "Cannot add nodes before input Stream was selected";
}
this->Update(); // make sure we are working on current data
mitk::NavigationData::Pointer reference = this->GetOutput(m_SelectedInput);
if (! reference->IsDataValid())
{
MITK_WARN("NodeDisplacementFilter")
<< "Cannot add node while selected tool is not tracked. Ignoring Node....";
return false;
}
// find transformation and add node
mitk::AffineTransform3D::Pointer inverseAffineTransform = mitk::AffineTransform3D::New();
if ( ! reference->GetAffineTransform3D()->GetInverse(inverseAffineTransform) )
{
MITK_ERROR("NodeDisplacementFilter")
<< "Could not get the inverse transformation of the navigation data transformation.";
mitkThrow() << "Could not get the inverse transformation of the navigation data transformation.";
}
inverseAffineTransform->Compose(node->GetData()->GetGeometry()->GetIndexToWorldTransform(), true);
m_Transforms.push_back(inverseAffineTransform);
m_Nodes.push_back(node);
return true;
}
示例6: foreach
// iterate all selected objects, adjust warning visibility
foreach( mitk::DataNode::Pointer node, nodes )
{
if( node.IsNotNull() && dynamic_cast<mitk::Image*>(node->GetData()) )
{
m_Controls.labelWarning->setVisible( false );
m_Controls.buttonPerformImageProcessing->setEnabled( true );
return;
}
}
示例7: GetImage
// Helper function to get an image from a data node.
static mitk::Image::Pointer GetImage(mitk::DataNode::Pointer dataNode)
{
if (dataNode.IsNull())
mitkThrow();
mitk::Image::Pointer image = dynamic_cast<mitk::Image*>(dataNode->GetData());
if (image.IsNull())
mitkThrow();
return image;
}
示例8: SetData
void QmitkSliceWidget::SetData(mitk::DataNode::Pointer node, mitk::SliceNavigationController::ViewDirection view)
{
mitk::Image::Pointer image = dynamic_cast<mitk::Image *>(node->GetData());
if (image.IsNull())
{
MITK_WARN << "QmitkSliceWidget data is not an image!";
return;
}
m_SlicedGeometry = image->GetSlicedGeometry();
this->InitWidget(view);
}
示例9:
void mitk::USZonesInteractor::UpdateSurface(mitk::DataNode::Pointer dataNode)
{
if (!dataNode->GetData())
{
MITK_WARN("USZonesInteractor")("DataInteractor")
<< "Cannot update surface for node as no data is set to the node.";
return;
}
mitk::Point3D origin = dataNode->GetData()->GetGeometry()->GetOrigin();
float radius;
if (!dataNode->GetFloatProperty(DATANODE_PROPERTY_SIZE, radius))
{
MITK_WARN("USZonesInteractor")("DataInteractor")
<< "Cannut update surface for node as no radius is specified in the node properties.";
return;
}
mitk::Surface::Pointer zone = mitk::Surface::New();
// create a vtk sphere with given radius
vtkSphereSource *vtkData = vtkSphereSource::New();
vtkData->SetRadius(radius);
vtkData->SetCenter(0, 0, 0);
vtkData->SetPhiResolution(20);
vtkData->SetThetaResolution(20);
vtkData->Update();
zone->SetVtkPolyData(vtkData->GetOutput());
vtkData->Delete();
// set vtk sphere and origin to data node (origin must be set
// again, because of the new sphere set as data)
dataNode->SetData(zone);
dataNode->GetData()->GetGeometry()->SetOrigin(origin);
// update the RenderWindow to show the changed surface
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
示例10: renderingHelper
void Color3D()
{
mitk::FiberBundle::Pointer fib = dynamic_cast<mitk::FiberBundle*>(node->GetData());
fib->SetFiberColors(255, 255, 255);
mitk::RenderingTestHelper renderingHelper(640, 480);
renderingHelper.AddNodeToStorage(node);
renderingHelper.SetMapperIDToRender3D();
renderingHelper.GetVtkRenderer()->SetBackground(0.0, 0.0, 0.0);
renderingHelper.SaveReferenceScreenShot(mitk::IOUtil::GetTempPath()+"fib_color_3D.png");
mitk::Image::Pointer test_image = mitk::IOUtil::Load<mitk::Image>(mitk::IOUtil::GetTempPath()+"fib_color_3D.png");
mitk::Image::Pointer ref_image = mitk::IOUtil::Load<mitk::Image>(GetTestDataFilePath("DiffusionImaging/Rendering/fib_color_3D.png"));
MITK_ASSERT_EQUAL(test_image, ref_image, "Check if images are equal.");
}
示例11: OnToolLoaded
void QmitkIGTTrackingLabView::OnToolLoaded(int index, mitk::DataNode::Pointer toolNode)
{
if(m_Source.IsNull() || m_Visualizer.IsNull())
return;
mitk::DataStorage* ds = this->GetDefaultDataStorage();
if(ds == NULL)
{
QMessageBox::warning(NULL,"DataStorage Access Error", "Could not access DataStorage. Loaded tool representation can not be shown!");
return;
}
mitk::NavigationData::Pointer tempND = m_Source->GetOutput(index);
if(tempND.IsNull())
return;
// try to find DataNode for tool in DataStorage
const char* toolName = tempND->GetName();
mitk::DataNode::Pointer tempNode = ds->GetNamedNode(toolName);
if(tempNode.IsNull())
{
tempNode = mitk::DataNode::New(); // create new node, if none was found
ds->Add(tempNode);
}
tempNode->SetData(toolNode->GetData());
tempNode->SetName(toolNode->GetName());
m_PSRecToolSelectionComboBox->setItemText(index,toolNode->GetName().c_str());
m_VirtualViewToolSelectionWidget->ChangeToolName(index, QString(toolNode->GetName().c_str()));
m_PermanentRegistrationToolSelectionWidget->ChangeToolName(index, QString(toolNode->GetName().c_str()));
m_Visualizer->SetRepresentationObject(index, tempNode->GetData());
m_Visualizer->Update();
tempNode->Modified();
this->GlobalReinit();
}
示例12: if
mitk::NavigationTool::Pointer mitk::NavigationToolReader::ConvertDataNodeToNavigationTool(mitk::DataNode::Pointer node, std::string toolPath)
{
mitk::NavigationTool::Pointer returnValue = mitk::NavigationTool::New();
//DateTreeNode with Name and Surface
mitk::DataNode::Pointer newNode = mitk::DataNode::New();
newNode->SetName(node->GetName());
newNode->SetData(node->GetData());
returnValue->SetDataNode(newNode);
//Identifier
std::string identifier;
node->GetStringProperty("identifier",identifier);
returnValue->SetIdentifier(identifier);
//Serial Number
std::string serial;
node->GetStringProperty("serial number",serial);
returnValue->SetSerialNumber(serial);
//Tracking Device
int device_type;
node->GetIntProperty("tracking device type",device_type);
returnValue->SetTrackingDeviceType(static_cast<mitk::TrackingDeviceType>(device_type));
//Tool Type
int type;
node->GetIntProperty("tracking tool type",type);
returnValue->SetType(static_cast<mitk::NavigationTool::NavigationToolType>(type));
//Calibration File Name
std::string calibration_filename;
node->GetStringProperty("toolfileName",calibration_filename);
if (calibration_filename=="none")
{
returnValue->SetCalibrationFile("none");
}
else
{
std::string calibration_filename_with_path = toolPath + Poco::Path::separator() + calibration_filename;
returnValue->SetCalibrationFile(calibration_filename_with_path);
}
//Tool Landmarks
mitk::PointSet::Pointer ToolRegLandmarks = mitk::PointSet::New();
mitk::PointSet::Pointer ToolCalLandmarks = mitk::PointSet::New();
std::string RegLandmarksString;
std::string CalLandmarksString;
node->GetStringProperty("ToolRegistrationLandmarks",RegLandmarksString);
node->GetStringProperty("ToolCalibrationLandmarks",CalLandmarksString);
ToolRegLandmarks = ConvertStringToPointSet(RegLandmarksString);
ToolCalLandmarks = ConvertStringToPointSet(CalLandmarksString);
returnValue->SetToolRegistrationLandmarks(ToolRegLandmarks);
returnValue->SetToolCalibrationLandmarks(ToolCalLandmarks);
//Tool Tip
std::string toolTipPositionString;
std::string toolTipOrientationString;
bool positionSet = node->GetStringProperty("ToolTipPosition",toolTipPositionString);
bool orientationSet = node->GetStringProperty("ToolTipOrientation",toolTipOrientationString);
if(positionSet && orientationSet) //only define tooltip if it is set
{
returnValue->SetToolTipPosition(ConvertStringToPoint(toolTipPositionString));
returnValue->SetToolTipOrientation(ConvertStringToQuaternion(toolTipOrientationString));
}
else if(positionSet != orientationSet)
{
MITK_WARN << "Tooltip definition incomplete: position and orientation have to be set! Skipping tooltip definition.";
}
return returnValue;
}
示例13: foreach
foreach ( mitk::DataNode::Pointer referenceNode, selectedNodes )
{
if (referenceNode.IsNotNull())
{
mitk::LabelSetImage::Pointer referenceImage = dynamic_cast<mitk::LabelSetImage*>( referenceNode->GetData() );
assert(referenceImage);
if(referenceImage->GetNumberOfLabels() <= 1)
{
QMessageBox::information(nullptr, "Create LabelSetImage Preset", "Could not create a LabelSetImage preset.\nNo Labels defined!\n");\
return;
}
std::string sName = referenceNode->GetName();
QString qName;
qName.sprintf("%s.lsetp",sName.c_str());
QString filename = QFileDialog::getSaveFileName( nullptr,"save file dialog",QString(),"LabelSet Preset(*.lsetp)");
if ( filename.isEmpty() )
return;
std::string fileName = filename.toStdString();
bool wasSaved = mitk::LabelSetIOHelper::SaveLabelSetImagePreset(fileName,referenceImage);
if(!wasSaved)
{
QMessageBox::information(nullptr, "Create LabelSetImage Preset", "Could not save a LabelSetImage preset as Xml.\n");\
return;
}
}
}
示例14: writeAccess
foreach ( mitk::DataNode::Pointer node, selectedNodes )
{
if (node)
{
mitk::Image::Pointer image = dynamic_cast<mitk::Image*>( node->GetData() );
if (image.IsNull()) return;
mitk::ProgressBar::GetInstance()->AddStepsToDo(10);
mitk::ProgressBar::GetInstance()->Progress(2);
qApp->processEvents();
mitk::AutoCropImageFilter::Pointer cropFilter = mitk::AutoCropImageFilter::New();
cropFilter->SetInput( image );
cropFilter->SetBackgroundValue( 0 );
cropFilter->SetMarginFactor(1.5);
try
{
cropFilter->Update();
image = cropFilter->GetOutput();
if (image.IsNotNull())
{
if (image->GetDimension() == 4)
{
MITK_INFO << "4D AUTOCROP DOES NOT WORK AT THE MOMENT";
throw "4D AUTOCROP DOES NOT WORK AT THE MOMENT";
unsigned int timesteps = image->GetDimension(3);
for (unsigned int i = 0; i < timesteps; i++)
{
mitk::ImageTimeSelector::Pointer imageTimeSelector = mitk::ImageTimeSelector::New();
imageTimeSelector->SetInput(image);
imageTimeSelector->SetTimeNr(i);
imageTimeSelector->UpdateLargestPossibleRegion();
// We split a long nested code line into separate calls for debugging:
mitk::ImageSource::OutputImageType *_3dSlice = imageTimeSelector->GetOutput();
mitk::Image::Pointer _cropped3dSlice = this->IncreaseCroppedImageSize(_3dSlice);
// +++ BUG +++ BUG +++ BUG +++ BUG +++ BUG +++ BUG +++ BUG +++
{
mitk::ImageWriteAccessor writeAccess(_cropped3dSlice);
void *_data = writeAccess.GetData();
// <ToBeRemoved>
// We write some stripes into the image
if ((i & 1) == 0)
{
int depth = _cropped3dSlice->GetDimension(2);
int height = _cropped3dSlice->GetDimension(1);
int width = _cropped3dSlice->GetDimension(0);
for (int z = 0; z < depth; ++z)
for (int y = 0; y < height; ++y)
for (int x = 0; x < width; ++x)
reinterpret_cast<unsigned char *>(_data)[(width * height * z) + (width * y) + x] = x & 1;
}
// </ToBeRemoved>
image->SetVolume(_data, i);
}
}
node->SetData( image ); // bug fix 3145
}
else
{
node->SetData( this->IncreaseCroppedImageSize(image) ); // bug fix 3145
}
// Reinit node
mitk::RenderingManager::GetInstance()->InitializeViews(
node->GetData()->GetTimeGeometry(), mitk::RenderingManager::REQUEST_UPDATE_ALL, true );
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
}
catch(...)
{
MITK_ERROR << "Cropping image failed...";
}
mitk::ProgressBar::GetInstance()->Progress(8);
}
else
{
MITK_INFO << " a nullptr node selected";
}
}
示例15: foreach
foreach ( mitk::DataNode::Pointer referenceNode, selectedNodes )
{
if (referenceNode.IsNull()) return;
mitk::LabelSetImage::Pointer referenceImage = dynamic_cast<mitk::LabelSetImage*>( referenceNode->GetData() );
assert(referenceImage);
std::string sName = referenceNode->GetName();
QString qName;
qName.sprintf("%s.lsetp",sName.c_str());
QString filename = QFileDialog::getOpenFileName(nullptr,"Load file",QString(),"LabelSet Preset(*.lsetp)");
if ( filename.isEmpty() )
return;
std::string fileName = filename.toStdString();
mitk::LabelSetIOHelper::LoadLabelSetImagePreset(fileName, referenceImage);
}