Re: [ITK-users] Problems Using GPU Filters

Emiliano Beronich <[email protected]>
Newsgroups gmane.comp.lib.itk.user
Message-ID <CAPXOEV3Z1nM5=oa7qr5ip2ME01XvWVRn6Ni-LHnrX+kZRf=EzA@mail.gmail.com>
Hi Andarahoo,

GPUBinaryThresholdImageFilter should be used with GPUImage.
Try defining:
typedef itk::GPUImage<float, 3> Image;

There is a cast in the method GPUUnaryFunctorImageFilter::GenerateData
(ancester of GPUBinaryThresholdImageFilter) which may be the cause of the
null pointer:

  typename GPUOutputImage::Pointer otPtr =  dynamic_cast< GPUOutputImage *
>( this->ProcessObject::GetOutput(0) );


Cheers,
Emiliano



2017-06-29 23:19 GMT-03:00 Andaharoo <[email protected]>:

> I've been looking to use some of the GPU filters provided by ITK recently.
> Namely the GPU anisotropic filter and binary threshold filter. I downloaded
> CUDA and ran cmake again with use gpu on flag and it found all my cuda
> stuff
> automatically. Everything appeared to build fine. I then looked up some
> implementation details and examples but couldn't really find any. There was
> one itk powerpoint from a long while ago that seemed to suggest I'd be able
> to just put a gpu filter in the pipeline like any other filter. I liked
> this
> implementation but it didn't work. So right now I have a pipeline that
> looks
> like the following in order to load images with vtk, process with itk, and
> then render with vtk.
>
> vtkToItkFilter -> array of ImageToImageFilters all connected ->
> itkToVtkFilter
>
> I tried to stick the GPUBinaryThresholdImageFilter in the array like I
> would
> a normal filter connecting it appropriately and calling update but it broke
> throwing a read access violation on line 46 of the GPUGenerateData function
> in itkGPUUnaryFunctorImageFilter.hxx saying otPtr.m_Pointer was nullptr.
>
> My code goes a little something like this:
>
> typedef itk::Image<float, 3> Image;
> typedef itk::GPUBinaryThresholdImageFilter<Image, Image>
> GPUBinaryThresholdFilter;
> GPUBinaryThresholdFilter::Pointer filter = GPUBinaryThresholdFilter::New(
> );
> double* range = pipe->GetOutput()->GetScalarRange();
> filter->SetLowerThreshold(filterWidget->getDoubleFromSlider("Lower"));
> filter->SetUpperThreshold(filterWidget->getDoubleFromSlider("Upper"));
> filter->SetOutsideValue(range[0]);
> filter->SetInsideValue(range[1]);
> filters.push_back(filter);
> if (filters.size() > 0)
>         filter->SetInput(filters.back()->GetOutput());
> else
>         filter->SetInput(vtkToItkLoader->GetOutput());
> itkToVtkFilter->SetInput(filters.back()->GetOutput());
>
>
>
> --
> View this message in context: http://itk-insight-users.
> 2283740.n2.nabble.com/Problems-Using-GPU-Filters-tp7590036.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
>

_____________________________________
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.