本文整理汇总了C++中DataNode::SetProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ DataNode::SetProperty方法的具体用法?C++ DataNode::SetProperty怎么用?C++ DataNode::SetProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataNode
的用法示例。
在下文中一共展示了DataNode::SetProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ThreadedUpdateFunction
bool CalculateSegmentationVolume::ThreadedUpdateFunction()
{
// get image
Image::Pointer image;
GetPointerParameter("Input", image);
AccessFixedDimensionByItk(image.GetPointer(),
ItkImageProcessing,
3); // some magic to call the correctly templated function (we only do 3D images here!)
// consider single voxel volume
Vector3D spacing = image->GetSlicedGeometry()->GetSpacing(); // spacing in mm
float volumeML = (ScalarType)m_Volume * spacing[0] * spacing[1] * spacing[2] / 1000.0; // convert to ml
DataNode *groupNode = GetGroupNode();
if (groupNode)
{
groupNode->SetProperty("volume", FloatProperty::New(volumeML));
groupNode->SetProperty("centerOfMass", Vector3DProperty::New(m_CenterOfMass));
groupNode->SetProperty("boundingBoxMinimum", Vector3DProperty::New(m_MinIndexOfBoundingBox));
groupNode->SetProperty("boundingBoxMaximum", Vector3DProperty::New(m_MaxIndexOfBoundingBox));
groupNode->SetProperty("showVolume", BoolProperty::New(true));
}
return true;
}
示例2: ThreadedUpdateSuccessful
void ShowSegmentationAsSmoothedSurface::ThreadedUpdateSuccessful()
{
DataNode::Pointer node = LookForPointerTargetBelowGroupNode("Surface representation");
bool addToTree = node.IsNull();
if (addToTree)
{
node = DataNode::New();
bool wireframe = false;
GetParameter("Wireframe", wireframe);
if (wireframe)
{
VtkRepresentationProperty *representation = dynamic_cast<VtkRepresentationProperty *>(
node->GetProperty("material.representation"));
if (representation != NULL)
representation->SetRepresentationToWireframe();
}
node->SetProperty("opacity", FloatProperty::New(1.0));
node->SetProperty("line width", IntProperty::New(1));
node->SetProperty("scalar visibility", BoolProperty::New(false));
UIDGenerator uidGenerator("Surface_");
node->SetProperty("FILENAME", StringProperty::New(uidGenerator.GetUID() + ".vtk"));
std::string groupNodeName = "surface";
DataNode *groupNode = GetGroupNode();
if (groupNode != NULL)
groupNode->GetName(groupNodeName);
node->SetProperty("name", StringProperty::New(groupNodeName));
}
node->SetData(m_Surface);
if (addToTree)
{
DataNode* groupNode = GetGroupNode();
if (groupNode != NULL)
{
groupNode->SetProperty("Surface representation", SmartPointerProperty::New(node));
BaseProperty *colorProperty = groupNode->GetProperty("color");
if (colorProperty != NULL)
node->ReplaceProperty("color", colorProperty);
else
node->SetProperty("color", ColorProperty::New(1.0f, 0.0f, 0.0f));
bool showResult = true;
GetParameter("Show result", showResult);
bool syncVisibility = false;
GetParameter("Sync visibility", syncVisibility);
Image::Pointer image;
GetPointerParameter("Input", image);
BaseProperty *organTypeProperty = image->GetProperty("organ type");
if (organTypeProperty != NULL)
m_Surface->SetProperty("organ type", organTypeProperty);
BaseProperty *visibleProperty = groupNode->GetProperty("visible");
if (visibleProperty != NULL && syncVisibility)
node->ReplaceProperty("visible", visibleProperty);
else
node->SetProperty("visible", BoolProperty::New(showResult));
}
InsertBelowGroupNode(node);
}
Superclass::ThreadedUpdateSuccessful();
}