[ITK-users] Problems Using GPU Filters
Andaharoo
andx_roo at live.com
Wed Sep 13 21:46:57 EDT 2017
I pulled the latest branch on github and this issue is still present on all
my systems. Here is a clear example of code that does not work.
typedef itk::GPUImage<unsigned char, 3> GPUImage;
typedef itk::Image<unsigned char, 3> Image;
// Read image with VTK
vtkSmartPointer<vtkPNGReader> reader = vtkSmartPointer<vtkPNGReader>::New();
reader->SetFileName("test.png");
reader->Update();
// Convert VTK to ITK
typedef itk::VTKImageToImageFilter<Image> VtkToItkFilter;
VtkToItkFilter::Pointer vtkToItkFilter = VtkToItkFilter::New();
vtkToItkFilter->SetInput(cast->GetOutput());
vtkToItkFilter->Update();
// GPU Binary Thresholding
typedef itk::GPUBinaryThresholdImageFilter<Image, GPUImage>
GPUBinaryThresholdFilterType;
GPUBinaryThresholdFilterType::Pointer binaryThresholdFilter =
GPUBinaryThresholdFilterType::New();
binaryThresholdFilter->SetInput(vtkToItkFilter->GetOutput());
binaryThresholdFilter->SetLowerThreshold(150.0);
binaryThresholdFilter->SetUpperThreshold(250.0);
binaryThresholdFilter->SetOutsideValue(0);
binaryThresholdFilter->SetInsideValue(355.0);
binaryThresholdFilter->Update();
GPU Gradient Anisotropic is the only gpu filter that works in this example.
Probably because it's the only in place gpu filter. I've tried replacing
"<Image>" with "<GPUImage>" as well.
With the <Image, GPUImage> scenario I get read access violation as
GPUDataManager is null. Expect when using gpu gradient anisotropic.
With <GPUImage, GPUImage> and <GPUImage> on the conversion filter, the
conversion filter fails to generate data.
And as stated in earlier messages, if I first use gpu gradient anisotropic
(only gpu filter that works after vtktoitk) I can then successfully apply
gpu binary thresholding.
I'd look further into the issue but I'm not really sure where gpu images
even get allocated so it would be hard for me to debug. Perhaps I can write
my own gpu filters using gradient anisotropic as reference.
--
Sent from: http://itk-insight-users.2283740.n2.nabble.com/
More information about the Insight-users
mailing list