[ITK] [ITK-users] Downcasting GPU Filters
Andaharoo
andx_roo at live.com
Tue Aug 1 00:50:06 EDT 2017
Hi,
I'm trying to store GPU filters in an array of ImageToImageFilters but they
don't seem to be connecting right. However, the
GPUGradientAnisotropicImageFilter works fine. I did notice it's one of the
only gpu filters that keeps the TParentImageFilter template parameter at
default. Another thing I noticed, Applying the gpu anisotropic and then
successively applying another gpu filter works. These filters failed:
GPUBinaryThresholdImageFilter
GPUDiscreteGaussianImageFilter
GPUMeanImageFilter
I'm using vtk and itk and have created a class to let me store vtk image
filters, itk filters, and itk gpu filters in a single array adding
conversion filters when needed. So I call addFilter and it adds the filter
connecting it to the last filter in the array or input image and adding
conversion filters if need be. It works fine with cpu itk filters and vtk
filters but not with all the gpu filters.
One of the problems I faced was that I couldn't SetInput with a GPU filter
downcasted to ImageToImageFilter. It had to be a GPUImageToImageFilter for
the SetInput to work. So I overloaded addFilter with a GPUImageToImageFilter
parameter to set the input and then downcast to ImageToImageFilter. I'd
create and add a filter like so (psuedo):
GPUGradientAnisotropicFilter filter
Set filter parameters
filterSeries->addFilter(filter as GPUImageToImageFilter)
Then addFilter would essentially just set the input to the output of the
last filter then downcast to ImageToImageFilter to store it.
As for the error. GPUImageDataManager never gets allocated and thus it
breaks.
It throws a read access violation on line 97 of itkSmartPointer.h
Here's part of the stack frame:
itk::SmartPointer<itk::GPUImageDataManager<itk::GPUImage<float,3> >
>::GetPointer() Line 97
itk::GPUImage<float,3>::GetGPUDataManager() Line 170
itk::GPUMeanImageFilter<itk::Image<float,3>,itk::GPUImage<float,3>
>::GPUGenerateData() Line 105
itk::GPUImageToImageFilter<itk::Image<float,3>,itk::GPUImage<float,3>,itk::MeanImageFilter<itk::Image<float,3>,itk::GPUImage<float,3>
> >::GenerateData() Line 61
...
I'm not sure where GPUImageDataManager gets allocated, the source is
confusing, and I only ever found a single sentence and ppt slide on it. When
it has to convert from CPU to GPU does it create GPUImage on the fly? What
would be reasons for it not to get allocated?
--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Downcasting-GPU-Filters-tp7590096.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users
More information about the Community
mailing list