本文整理汇总了C++中datanode::Pointer::GetPointer方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::GetPointer方法的具体用法?C++ Pointer::GetPointer怎么用?C++ Pointer::GetPointer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datanode::Pointer
的用法示例。
在下文中一共展示了Pointer::GetPointer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPointerParameter
DataNode *SegmentationSink::GetGroupNode()
{
DataNode::Pointer groupNode;
GetPointerParameter("Group node", groupNode);
return groupNode.GetPointer();
}
示例2: error
bool mitk::SceneReaderV1::LoadScene( TiXmlDocument& document, const std::string& workingDirectory, DataStorage* storage )
{
assert(storage);
bool error(false);
// TODO prepare to detect errors (such as cycles) from wrongly written or edited xml files
// iterate all nodes
// first level nodes should be <node> elements
for( TiXmlElement* element = document.FirstChildElement("node"); element != NULL; element = element->NextSiblingElement("node") )
{
// 1. if there is a <data type="..." file="..."> element,
// - construct a name for the appropriate serializer
// - try to instantiate this serializer via itk object factory
// - if serializer could be created, use it to read the file into a BaseData object
// - if successful, call the new node's SetData(..)
DataNode::Pointer node = LoadBaseDataFromDataTag( element->FirstChildElement("data"), workingDirectory, error );
// 2. check child nodes
const char* uida = element->Attribute("UID");
std::string uid("");
if (uida)
{
uid = uida;
m_NodeForID[uid] = node.GetPointer();
m_IDForNode[ node.GetPointer() ] = uid;
}
else
{
MITK_ERROR << "No UID found for current node. Node will have no parents.";
error = true;
}
// remember node for later adding to DataStorage
m_Nodes.insert( std::make_pair( node, std::list<std::string>() ) );
// 3. if there are <source> elements, remember parent objects
for( TiXmlElement* source = element->FirstChildElement("source"); source != NULL; source = source->NextSiblingElement("source") )
{
const char* sourceUID = source->Attribute("UID");
if (sourceUID)
{
m_Nodes[node].push_back( std::string(sourceUID) );
}
}
// 5. if there are <properties> nodes,
// - instantiate the appropriate PropertyListDeSerializer
// - use them to construct PropertyList objects
// - add these properties to the node (if necessary, use renderwindow name)
bool success = DecorateNodeWithProperties(node, element, workingDirectory);
if (!success)
{
MITK_ERROR << "Could not load properties for node.";
error = true;
}
} // end for all <node>
// remove all unknown parent UIDs
for (NodesAndParentsMapType::iterator nodesIter = m_Nodes.begin();
nodesIter != m_Nodes.end();
++nodesIter)
{
for (std::list<std::string>::iterator parentsIter = nodesIter->second.begin();
parentsIter != nodesIter->second.end();)
{
if (m_NodeForID.find( *parentsIter ) == m_NodeForID.end())
{
parentsIter = nodesIter->second.erase( parentsIter );
MITK_WARN << "Found a DataNode with unknown parents. Will add it to DataStorage without any parent objects.";
error = true;
}
else
{
++parentsIter;
}
}
}
// repeat
// for all created nodes
unsigned int lastMapSize(0);
while ( lastMapSize != m_Nodes.size()) // this is to prevent infinite loops; each iteration must at least add one node to DataStorage
{
lastMapSize = m_Nodes.size();
for (NodesAndParentsMapType::iterator nodesIter = m_Nodes.begin();
nodesIter != m_Nodes.end();
++nodesIter)
{
bool addNow(true);
// if any parent node is not yet in DataStorage, skip node for now and check later
for (std::list<std::string>::iterator parentsIter = nodesIter->second.begin();
parentsIter != nodesIter->second.end();
++parentsIter)
{
if ( !storage->Exists( m_NodeForID[ *parentsIter ] ) )
{
//.........这里部分代码省略.........