本文整理汇总了C++中DataStorage::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ DataStorage::Add方法的具体用法?C++ DataStorage::Add怎么用?C++ DataStorage::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataStorage
的用法示例。
在下文中一共展示了DataStorage::Add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void mitk::PickingTool::Activated()
{
DataStorage* dataStorage = this->GetDataStorage();
m_WorkingData = this->GetWorkingData();
//add to datastorage and enable interaction
if (!dataStorage->Exists(m_PointSetNode))
dataStorage->Add(m_PointSetNode, m_WorkingData);
// now add result to data tree
dataStorage->Add(m_ResultNode, m_WorkingData);
}
示例2: if
void mitk::PickingTool::OnPointAdded()
{
if (m_WorkingData != this->GetWorkingData())
{
DataStorage *dataStorage = this->GetDataStorage();
if (dataStorage->Exists(m_PointSetNode))
{
dataStorage->Remove(m_PointSetNode);
dataStorage->Add(m_PointSetNode, this->GetWorkingData());
}
if (dataStorage->Exists(m_ResultNode))
{
dataStorage->Remove(m_ResultNode);
dataStorage->Add(m_ResultNode, this->GetWorkingData());
}
m_WorkingData = this->GetWorkingData();
}
// Perform region growing/picking
int timeStep =
mitk::BaseRenderer::GetInstance(mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget1"))->GetTimeStep();
mitk::PointSet::PointType seedPoint = m_PointSet->GetPointSet(timeStep)->GetPoints()->Begin().Value();
// as we want to pick a region from our segmentation image use the working data from ToolManager
mitk::Image::Pointer orgImage = dynamic_cast<mitk::Image *>(m_ToolManager->GetWorkingData(0)->GetData());
if (orgImage.IsNotNull())
{
if (orgImage->GetDimension() == 4)
{ // there may be 4D segmentation data even though we currently don't support that
mitk::ImageTimeSelector::Pointer timeSelector = mitk::ImageTimeSelector::New();
timeSelector->SetInput(orgImage);
timeSelector->SetTimeNr(timeStep);
timeSelector->UpdateLargestPossibleRegion();
mitk::Image *timedImage = timeSelector->GetOutput();
AccessByItk_2(timedImage, StartRegionGrowing, timedImage->GetGeometry(), seedPoint);
}
else if (orgImage->GetDimension() == 3)
{
AccessByItk_2(orgImage, StartRegionGrowing, orgImage->GetGeometry(), seedPoint);
}
this->m_PointSet->Clear();
}
}
示例3:
DataStorage::SetOfObjects::Pointer AbstractFileReader::Read(DataStorage& ds)
{
DataStorage::SetOfObjects::Pointer result = DataStorage::SetOfObjects::New();
std::vector<BaseData::Pointer> data = this->Read();
for (std::vector<BaseData::Pointer>::iterator iter = data.begin();
iter != data.end(); ++iter)
{
mitk::DataNode::Pointer node = mitk::DataNode::New();
node->SetData(*iter);
this->SetDefaultDataNodeProperties(node, this->GetInputLocation());
ds.Add(node);
result->InsertElement(result->Size(), node);
}
return result;
}
示例4: Read
int CoreDataNodeReader::Read(const std::string &fileName, DataStorage &storage)
{
mitk::DataNodeFactory::Pointer nodeReader = mitk::DataNodeFactory::New();
// the ITK Nrrd file reader cannot handle '/' in file path on Win 64bit
std::string name(fileName);
std::replace(name.begin(), name.end(), '\\', '/');
nodeReader->SetFileName(name);
nodeReader->Update();
int n = 0;
for ( unsigned int i = 0 ; i < nodeReader->GetNumberOfOutputs( ); ++i )
{
mitk::DataNode::Pointer node;
node = nodeReader->GetOutput(i);
if ( node->GetData() != NULL )
{
storage.Add(node);
++n;
}
}
return n;
}