本文整理汇总了C++中datanode::Pointer::SetProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::SetProperty方法的具体用法?C++ Pointer::SetProperty怎么用?C++ Pointer::SetProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datanode::Pointer
的用法示例。
在下文中一共展示了Pointer::SetProperty方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LevelWindow
mitk::DataNode::Pointer mitk::Tool::CreateSegmentationNode( Image* image, const std::string& organName, const mitk::Color& color )
{
if (!image) return NULL;
// decorate the datatreenode with some properties
DataNode::Pointer segmentationNode = DataNode::New();
segmentationNode->SetData( image );
// name
segmentationNode->SetProperty( "name", StringProperty::New( organName ) );
// visualization properties
segmentationNode->SetProperty( "binary", BoolProperty::New(true) );
segmentationNode->SetProperty( "color", ColorProperty::New(color) );
segmentationNode->SetProperty( "texture interpolation", BoolProperty::New(false) );
segmentationNode->SetProperty( "layer", IntProperty::New(10) );
segmentationNode->SetProperty( "levelwindow", LevelWindowProperty::New( LevelWindow(0.5, 1) ) );
segmentationNode->SetProperty( "opacity", FloatProperty::New(0.3) );
segmentationNode->SetProperty( "segmentation", BoolProperty::New(true) );
segmentationNode->SetProperty( "reslice interpolation", VtkResliceInterpolationProperty::New() ); // otherwise -> segmentation appears in 2 slices sometimes (only visual effect, not different data)
// For MITK-3M3 release, the volume of all segmentations should be shown
segmentationNode->SetProperty( "showVolume", BoolProperty::New( true ) );
return segmentationNode;
}
示例2: ConvertPeaksFromMrtrix
void QmitkOdfMaximaExtractionView::ConvertPeaksFromMrtrix()
{
if (m_ImageNodes.empty())
return;
typedef itk::Image< float, 4 > ItkImageType;
typedef itk::MrtrixPeakImageConverter< float > FilterType;
FilterType::Pointer filter = FilterType::New();
// cast to itk
mitk::Image::Pointer mitkImg = dynamic_cast<mitk::Image*>(m_ImageNodes.at(0)->GetData());
mitk::Geometry3D::Pointer geom = mitkImg->GetGeometry();
typedef mitk::ImageToItk< FilterType::InputImageType > CasterType;
CasterType::Pointer caster = CasterType::New();
caster->SetInput(mitkImg);
caster->Update();
FilterType::InputImageType::Pointer itkImg = caster->GetOutput();
filter->SetInputImage(itkImg);
filter->GenerateData();
mitk::Vector3D outImageSpacing = geom->GetSpacing();
float maxSpacing = 1;
if(outImageSpacing[0]>outImageSpacing[1] && outImageSpacing[0]>outImageSpacing[2])
maxSpacing = outImageSpacing[0];
else if (outImageSpacing[1] > outImageSpacing[2])
maxSpacing = outImageSpacing[1];
else
maxSpacing = outImageSpacing[2];
mitk::FiberBundleX::Pointer directions = filter->GetOutputFiberBundle();
directions->SetGeometry(geom);
DataNode::Pointer node = DataNode::New();
node->SetData(directions);
QString name(m_ImageNodes.at(0)->GetName().c_str());
name += "_VectorField";
node->SetName(name.toStdString().c_str());
node->SetProperty("Fiber2DSliceThickness", mitk::FloatProperty::New(maxSpacing));
node->SetProperty("Fiber2DfadeEFX", mitk::BoolProperty::New(false));
GetDataStorage()->Add(node);
typedef FilterType::DirectionImageContainerType DirectionImageContainerType;
DirectionImageContainerType::Pointer container = filter->GetDirectionImageContainer();
for (int i=0; i<container->Size(); i++)
{
ItkDirectionImage3DType::Pointer itkImg = container->GetElement(i);
mitk::Image::Pointer img = mitk::Image::New();
img->InitializeByItk( itkImg.GetPointer() );
img->SetVolume( itkImg->GetBufferPointer() );
DataNode::Pointer node = DataNode::New();
node->SetData(img);
QString name(m_ImageNodes.at(0)->GetName().c_str());
name += "_Direction";
name += QString::number(i+1);
node->SetName(name.toStdString().c_str());
GetDataStorage()->Add(node);
}
}
示例3: ThreadedUpdateSuccessful
void ShowSegmentationAsSmoothedSurface::ThreadedUpdateSuccessful()
{
DataNode::Pointer node = DataNode::New();
bool wireframe = false;
GetParameter("Wireframe", wireframe);
if (wireframe)
{
VtkRepresentationProperty *representation = dynamic_cast<VtkRepresentationProperty *>(
node->GetProperty("material.representation"));
if (representation != nullptr)
representation->SetRepresentationToWireframe();
}
node->SetProperty("opacity", FloatProperty::New(1.0));
node->SetProperty("line width", IntProperty::New(1));
node->SetProperty("scalar visibility", BoolProperty::New(false));
std::string groupNodeName = "surface";
DataNode *groupNode = GetGroupNode();
if (groupNode != nullptr)
groupNode->GetName(groupNodeName);
node->SetProperty("name", StringProperty::New(groupNodeName));
node->SetData(m_Surface);
BaseProperty *colorProperty = groupNode->GetProperty("color");
if (colorProperty != nullptr)
node->ReplaceProperty("color", colorProperty->Clone());
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 != nullptr)
m_Surface->SetProperty("organ type", organTypeProperty);
BaseProperty *visibleProperty = groupNode->GetProperty("visible");
if (visibleProperty != nullptr && syncVisibility)
node->ReplaceProperty("visible", visibleProperty->Clone());
else
node->SetProperty("visible", BoolProperty::New(showResult));
InsertBelowGroupNode(node);
Superclass::ThreadedUpdateSuccessful();
}
示例4: 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();
}
示例5: workingNode
int mitk::SegTool2D::AddContourmarker()
{
if (m_LastEventSender == NULL)
return -1;
us::ServiceReference<PlanePositionManagerService> serviceRef =
us::GetModuleContext()->GetServiceReference<PlanePositionManagerService>();
PlanePositionManagerService* service = us::GetModuleContext()->GetService(serviceRef);
unsigned int slicePosition = m_LastEventSender->GetSliceNavigationController()->GetSlice()->GetPos();
// the first geometry is needed otherwise restoring the position is not working
const mitk::PlaneGeometry* plane = dynamic_cast<const PlaneGeometry*> (dynamic_cast< const mitk::SlicedGeometry3D*>(
m_LastEventSender->GetSliceNavigationController()->GetCurrentGeometry3D())->GetPlaneGeometry(0));
unsigned int size = service->GetNumberOfPlanePositions();
unsigned int id = service->AddNewPlanePosition(plane, slicePosition);
mitk::PlanarCircle::Pointer contourMarker = mitk::PlanarCircle::New();
mitk::Point2D p1;
plane->Map(plane->GetCenter(), p1);
mitk::Point2D p2 = p1;
p2[0] -= plane->GetSpacing()[0];
p2[1] -= plane->GetSpacing()[1];
contourMarker->PlaceFigure( p1 );
contourMarker->SetCurrentControlPoint( p1 );
contourMarker->SetPlaneGeometry( const_cast<PlaneGeometry*>(plane));
std::stringstream markerStream;
mitk::DataNode* workingNode (m_ToolManager->GetWorkingData(0));
markerStream << m_Contourmarkername ;
markerStream << " ";
markerStream << id+1;
DataNode::Pointer rotatedContourNode = DataNode::New();
rotatedContourNode->SetData(contourMarker);
rotatedContourNode->SetProperty( "name", StringProperty::New(markerStream.str()) );
rotatedContourNode->SetProperty( "isContourMarker", BoolProperty::New(true));
rotatedContourNode->SetBoolProperty( "PlanarFigureInitializedWindow", true, m_LastEventSender );
rotatedContourNode->SetProperty( "includeInBoundingBox", BoolProperty::New(false));
rotatedContourNode->SetProperty( "helper object", mitk::BoolProperty::New(!m_ShowMarkerNodes));
rotatedContourNode->SetProperty( "planarfigure.drawcontrolpoints", BoolProperty::New(false));
rotatedContourNode->SetProperty( "planarfigure.drawname", BoolProperty::New(false));
rotatedContourNode->SetProperty( "planarfigure.drawoutline", BoolProperty::New(false));
rotatedContourNode->SetProperty( "planarfigure.drawshadow", BoolProperty::New(false));
if (plane)
{
if ( id == size )
{
m_ToolManager->GetDataStorage()->Add(rotatedContourNode, workingNode);
}
else
{
mitk::NodePredicateProperty::Pointer isMarker = mitk::NodePredicateProperty::New("isContourMarker", mitk::BoolProperty::New(true));
mitk::DataStorage::SetOfObjects::ConstPointer markers = m_ToolManager->GetDataStorage()->GetDerivations(workingNode,isMarker);
for ( mitk::DataStorage::SetOfObjects::const_iterator iter = markers->begin();
iter != markers->end();
++iter)
{
std::string nodeName = (*iter)->GetName();
unsigned int t = nodeName.find_last_of(" ");
unsigned int markerId = atof(nodeName.substr(t+1).c_str())-1;
if(id == markerId)
{
return id;
}
}
m_ToolManager->GetDataStorage()->Add(rotatedContourNode, workingNode);
}
}
return id;
}
示例6: GenerateDataFromDwi
//.........这里部分代码省略.........
typedef ImageToItk< MaximaExtractionFilterType::CoefficientImageType > CasterType;
CasterType::Pointer caster = CasterType::New();
caster->SetInput(img);
caster->Update();
filter->SetShCoeffImage(caster->GetOutput());
geometry = img->GetGeometry();
}
catch(itk::ExceptionObject &e)
{
MITK_INFO << "wrong image type: " << e.what();
return;
}
}
else
return;
filter->SetMaxNumPeaks(m_Controls->m_MaxNumPeaksBox->value());
filter->SetPeakThreshold(m_Controls->m_PeakThresholdBox->value());
if (!m_BinaryImageNodes.empty())
{
ItkUcharImgType::Pointer itkMaskImage = ItkUcharImgType::New();
Image::Pointer mitkMaskImg = dynamic_cast<Image*>(m_BinaryImageNodes.at(0)->GetData());
CastToItkImage<ItkUcharImgType>(mitkMaskImg, itkMaskImage);
filter->SetMaskImage(itkMaskImage);
}
switch (m_Controls->m_NormalizationBox->currentIndex())
{
case 0:
filter->SetNormalizationMethod(MaximaExtractionFilterType::NO_NORM);
break;
case 1:
filter->SetNormalizationMethod(MaximaExtractionFilterType::MAX_VEC_NORM);
break;
case 2:
filter->SetNormalizationMethod(MaximaExtractionFilterType::SINGLE_VEC_NORM);
break;
}
filter->GenerateData();
ItkUcharImgType::Pointer numDirImage = filter->GetNumDirectionsImage();
if (m_Controls->m_OutputDirectionImagesBox->isChecked())
{
typedef MaximaExtractionFilterType::ItkDirectionImageContainer ItkDirectionImageContainer;
ItkDirectionImageContainer::Pointer container = filter->GetDirectionImageContainer();
for (int i=0; i<container->Size(); i++)
{
MaximaExtractionFilterType::ItkDirectionImage::Pointer itkImg = container->GetElement(i);
mitk::Image::Pointer img = mitk::Image::New();
img->InitializeByItk( itkImg.GetPointer() );
img->SetVolume( itkImg->GetBufferPointer() );
DataNode::Pointer node = DataNode::New();
node->SetData(img);
QString name(m_ImageNodes.at(0)->GetName().c_str());
name += "_Direction";
name += QString::number(i+1);
node->SetName(name.toStdString().c_str());
GetDataStorage()->Add(node);
}
}
if (m_Controls->m_OutputNumDirectionsBox->isChecked())
{
mitk::Image::Pointer image2 = mitk::Image::New();
image2->InitializeByItk( numDirImage.GetPointer() );
image2->SetVolume( numDirImage->GetBufferPointer() );
DataNode::Pointer node = DataNode::New();
node->SetData(image2);
QString name(m_ImageNodes.at(0)->GetName().c_str());
name += "_NumDirections";
node->SetName(name.toStdString().c_str());
GetDataStorage()->Add(node);
}
if (m_Controls->m_OutputVectorFieldBox->isChecked())
{
mitk::Vector3D outImageSpacing = geometry->GetSpacing();
float minSpacing = 1;
if(outImageSpacing[0]<outImageSpacing[1] && outImageSpacing[0]<outImageSpacing[2])
minSpacing = outImageSpacing[0];
else if (outImageSpacing[1] < outImageSpacing[2])
minSpacing = outImageSpacing[1];
else
minSpacing = outImageSpacing[2];
mitk::FiberBundleX::Pointer directions = filter->GetOutputFiberBundle();
directions->SetGeometry(geometry);
DataNode::Pointer node = DataNode::New();
node->SetData(directions);
QString name(m_ImageNodes.at(0)->GetName().c_str());
name += "_VectorField";
node->SetName(name.toStdString().c_str());
node->SetProperty("Fiber2DSliceThickness", mitk::FloatProperty::New(minSpacing));
node->SetProperty("Fiber2DfadeEFX", mitk::BoolProperty::New(false));
GetDataStorage()->Add(node);
}
}
示例7: StartTensor
void QmitkOdfMaximaExtractionView::StartTensor()
{
if (m_TensorImageNodes.empty())
return;
typedef itk::DiffusionTensorPrincipalDirectionImageFilter< float, float > MaximaExtractionFilterType;
MaximaExtractionFilterType::Pointer filter = MaximaExtractionFilterType::New();
mitk::Geometry3D::Pointer geometry;
try{
TensorImage::Pointer img = dynamic_cast<TensorImage*>(m_TensorImageNodes.at(0)->GetData());
ItkTensorImage::Pointer itkImage = ItkTensorImage::New();
CastToItkImage<ItkTensorImage>(img, itkImage);
filter->SetInput(itkImage);
geometry = img->GetGeometry();
}
catch(itk::ExceptionObject &e)
{
MITK_INFO << "wrong image type: " << e.what();
throw e;
}
if (!m_BinaryImageNodes.empty())
{
ItkUcharImgType::Pointer itkMaskImage = ItkUcharImgType::New();
Image::Pointer mitkMaskImg = dynamic_cast<Image*>(m_BinaryImageNodes.at(0)->GetData());
CastToItkImage<ItkUcharImgType>(mitkMaskImg, itkMaskImage);
filter->SetMaskImage(itkMaskImage);
}
if (m_Controls->m_NormalizationBox->currentIndex()==0)
filter->SetNormalizeVectors(false);
filter->Update();
if (m_Controls->m_OutputDirectionImagesBox->isChecked())
{
MaximaExtractionFilterType::OutputImageType::Pointer itkImg = filter->GetOutput();
mitk::Image::Pointer img = mitk::Image::New();
img->InitializeByItk( itkImg.GetPointer() );
img->SetVolume( itkImg->GetBufferPointer() );
DataNode::Pointer node = DataNode::New();
node->SetData(img);
QString name(m_TensorImageNodes.at(0)->GetName().c_str());
name += "_PrincipalDirection";
node->SetName(name.toStdString().c_str());
GetDataStorage()->Add(node);
}
if (m_Controls->m_OutputNumDirectionsBox->isChecked())
{
ItkUcharImgType::Pointer numDirImage = filter->GetNumDirectionsImage();
mitk::Image::Pointer image2 = mitk::Image::New();
image2->InitializeByItk( numDirImage.GetPointer() );
image2->SetVolume( numDirImage->GetBufferPointer() );
DataNode::Pointer node2 = DataNode::New();
node2->SetData(image2);
QString name(m_TensorImageNodes.at(0)->GetName().c_str());
name += "_NumDirections";
node2->SetName(name.toStdString().c_str());
GetDataStorage()->Add(node2);
}
if (m_Controls->m_OutputVectorFieldBox->isChecked())
{
mitk::Vector3D outImageSpacing = geometry->GetSpacing();
float minSpacing = 1;
if(outImageSpacing[0]<outImageSpacing[1] && outImageSpacing[0]<outImageSpacing[2])
minSpacing = outImageSpacing[0];
else if (outImageSpacing[1] < outImageSpacing[2])
minSpacing = outImageSpacing[1];
else
minSpacing = outImageSpacing[2];
mitk::FiberBundleX::Pointer directions = filter->GetOutputFiberBundle();
directions->SetGeometry(geometry);
DataNode::Pointer node = DataNode::New();
node->SetData(directions);
QString name(m_TensorImageNodes.at(0)->GetName().c_str());
name += "_VectorField";
node->SetName(name.toStdString().c_str());
node->SetProperty("Fiber2DSliceThickness", mitk::FloatProperty::New(minSpacing));
node->SetProperty("Fiber2DfadeEFX", mitk::BoolProperty::New(false));
GetDataStorage()->Add(node);
}
}