本文整理汇总了C++中mitk::datanode::Pointer::SetData方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::SetData方法的具体用法?C++ Pointer::SetData怎么用?C++ Pointer::SetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mitk::datanode::Pointer
的用法示例。
在下文中一共展示了Pointer::SetData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setUp
void setUp() override
{
fib = mitk::IOUtil::Load<mitk::FiberBundle>(GetTestDataFilePath("DiffusionImaging/Rendering/test_fibers.fib"));
MITK_INFO << fib->GetNumFibers();
node = mitk::DataNode::New();
node->SetData(fib);
}
示例2: setUp
void setUp()
{
//Create DataNode as a container for our PointSet to be tested
m_TestPointSetNode = mitk::DataNode::New();
// Create PointSetData Interactor
m_DataInteractor = mitk::PointSetDataInteractor::New();
// Load the according state machine for regular point set interaction
m_DataInteractor->LoadStateMachine("PointSet.xml");
// Set the configuration file that defines the triggers for the transitions
m_DataInteractor->SetEventConfig("PointSetConfig.xml");
// set the DataNode (which already is added to the DataStorage)
m_DataInteractor->SetDataNode(m_TestPointSetNode);
//Create new PointSet which will receive the interaction input
m_TestPointSet = mitk::PointSet::New();
m_TestPointSetNode->SetData(m_TestPointSet);
}
示例3:
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();
}
示例4: 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";
}
}