本文整理汇总了C++中datanode::Pointer::SetName方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::SetName方法的具体用法?C++ Pointer::SetName怎么用?C++ Pointer::SetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datanode::Pointer
的用法示例。
在下文中一共展示了Pointer::SetName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2: StartMaximaExtraction
void QmitkOdfMaximaExtractionView::StartMaximaExtraction()
{
typedef itk::FiniteDiffOdfMaximaExtractionFilter< float, shOrder, 20242 > MaximaExtractionFilterType;
typename MaximaExtractionFilterType::Pointer filter = MaximaExtractionFilterType::New();
mitk::Geometry3D::Pointer geometry;
try{
Image::Pointer img = dynamic_cast<Image*>(m_ImageNodes.at(0)->GetData());
typedef ImageToItk< typename MaximaExtractionFilterType::CoefficientImageType > CasterType;
typename CasterType::Pointer caster = CasterType::New();
caster->SetInput(img);
caster->Update();
filter->SetInput(caster->GetOutput());
geometry = img->GetGeometry();
}
catch(itk::ExceptionObject &e)
{
MITK_INFO << "wrong image type: " << e.what();
throw;
}
filter->SetAngularThreshold(cos((float)m_Controls->m_AngularThreshold->value()*M_PI/180));
filter->SetClusteringThreshold(cos((float)m_Controls->m_ClusteringAngleBox->value()*M_PI/180));
filter->SetMaxNumPeaks(m_Controls->m_MaxNumPeaksBox->value());
filter->SetPeakThreshold(m_Controls->m_PeakThresholdBox->value());
filter->SetAbsolutePeakThreshold(m_Controls->m_AbsoluteThresholdBox->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->Update();
if (m_Controls->m_OutputDirectionImagesBox->isChecked())
{
typedef typename MaximaExtractionFilterType::ItkDirectionImageContainer ItkDirectionImageContainer;
typename ItkDirectionImageContainer::Pointer container = filter->GetDirectionImageContainer();
for (int i=0; i<container->Size(); i++)
{
typename 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())
{
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_ImageNodes.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_ImageNodes.at(0)->GetName().c_str());
//.........这里部分代码省略.........
示例3: ConvertPeaksFromFsl
void QmitkOdfMaximaExtractionView::ConvertPeaksFromFsl()
{
if (m_ImageNodes.empty())
return;
typedef itk::Image< float, 4 > ItkImageType;
typedef itk::FslPeakImageConverter< float > FilterType;
FilterType::Pointer filter = FilterType::New();
FilterType::InputType::Pointer inputVec = FilterType::InputType::New();
mitk::Geometry3D::Pointer geom;
for (int i=0; i<m_ImageNodes.size(); i++)
{
mitk::Image::Pointer mitkImg = dynamic_cast<mitk::Image*>(m_ImageNodes.at(i)->GetData());
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();
inputVec->InsertElement(inputVec->Size(), itkImg);
}
filter->SetInputImages(inputVec);
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);
node->SetName("FSL_VectorField");
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(i)->GetName().c_str());
name += "_Direction";
name += QString::number(i+1);
node->SetName(name.toStdString().c_str());
GetDataStorage()->Add(node);
}
}