本文整理汇总了C++中typenamefiltertype::Pointer::SetAlgorithm方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::SetAlgorithm方法的具体用法?C++ Pointer::SetAlgorithm怎么用?C++ Pointer::SetAlgorithm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类typenamefiltertype::Pointer
的用法示例。
在下文中一共展示了Pointer::SetAlgorithm方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: morphologicalGradientImageFilterITK
void MorphologicalGradientImageFilterITK::morphologicalGradientImageFilterITK() {
if (!enableProcessing_.get()) {
outport1_.setData(inport1_.getData(), false);
return;
}
typedef itk::Image<T, 3> InputImageType1;
typedef itk::Image<T, 3> OutputImageType1;
typedef T PixelType;
typename InputImageType1::Pointer p1 = voreenToITK<T>(inport1_.getData());
if(structuringElement_.get() == "binaryBall"){
shape_.setVisible(false);
typedef itk::BinaryBallStructuringElement < PixelType, 3 > KernelType;
typedef itk::MorphologicalGradientImageFilter<InputImageType1, OutputImageType1, KernelType> FilterType;
typename FilterType::Pointer filter = FilterType::New();
filter->SetInput(p1);
filter->SetAlgorithm(algorithm_.get());
KernelType structuringElement;
typename KernelType::SizeType radius;
radius[0] = radius_.get().x;
radius[1] = radius_.get().y;
radius[2] = radius_.get().z;
structuringElement.SetRadius(radius);
structuringElement.CreateStructuringElement();
filter->SetKernel(structuringElement);
observe(filter.GetPointer());
try
{
filter->Update();
}
catch (itk::ExceptionObject &e)
{
LERROR(e);
}
Volume* outputVolume1 = 0;
outputVolume1 = ITKToVoreenCopy<T>(filter->GetOutput());
if (outputVolume1) {
transferRWM(inport1_.getData(), outputVolume1);
transferTransformation(inport1_.getData(), outputVolume1);
outport1_.setData(outputVolume1);
} else
outport1_.setData(0);
}
else if(structuringElement_.get() == "binaryCross"){
shape_.setVisible(false);
typedef itk::BinaryCrossStructuringElement < PixelType, 3 > KernelType;
typedef itk::MorphologicalGradientImageFilter<InputImageType1, OutputImageType1, KernelType> FilterType;
typename FilterType::Pointer filter = FilterType::New();
filter->SetInput(p1);
filter->SetAlgorithm(algorithm_.get());
KernelType structuringElement;
typename KernelType::SizeType radius;
radius[0] = radius_.get().x;
radius[1] = radius_.get().y;
radius[2] = radius_.get().z;
structuringElement.SetRadius(radius);
structuringElement.CreateStructuringElement();
filter->SetKernel(structuringElement);
observe(filter.GetPointer());
try
{
filter->Update();
}
catch (itk::ExceptionObject &e)
{
LERROR(e);
}
Volume* outputVolume1 = 0;
outputVolume1 = ITKToVoreenCopy<T>(filter->GetOutput());
if (outputVolume1) {
transferRWM(inport1_.getData(), outputVolume1);
transferTransformation(inport1_.getData(), outputVolume1);
outport1_.setData(outputVolume1);
} else
outport1_.setData(0);
//.........这里部分代码省略.........