<div dir="ltr">Hi Andarahoo,<div><br></div><div><span style="font-size:12.8px">GPUBinaryThresholdImageFilter should be used with GPUImage.</span><br></div><div><span style="font-size:12.8px">Try defining:</span></div><div><span style="font-size:12.8px">typedef itk::GPUImage<float, 3> Image;</span><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">There is a cast in the method GPUUnaryFunctorImageFilter::GenerateData (ancester of </span><span style="font-size:12.8px">GPUBinaryThresholdImageFilter) which may be the cause of the null pointer:</span></div><div><span style="font-size:12.8px"><br></span></div><div><div><span style="font-size:12.8px">  typename GPUOutputImage::Pointer otPtr =  dynamic_cast< GPUOutputImage * >( this->ProcessObject::GetOutput(0) );</span></div><div style="font-size:12.8px"><br></div></div><div><br></div><div>Cheers,</div><div>Emiliano</div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-06-29 23:19 GMT-03:00 Andaharoo <span dir="ltr"><<a href="mailto:andx_roo@live.com" target="_blank">andx_roo@live.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I've been looking to use some of the GPU filters provided by ITK recently.<br>
Namely the GPU anisotropic filter and binary threshold filter. I downloaded<br>
CUDA and ran cmake again with use gpu on flag and it found all my cuda stuff<br>
automatically. Everything appeared to build fine. I then looked up some<br>
implementation details and examples but couldn't really find any. There was<br>
one itk powerpoint from a long while ago that seemed to suggest I'd be able<br>
to just put a gpu filter in the pipeline like any other filter. I liked this<br>
implementation but it didn't work. So right now I have a pipeline that looks<br>
like the following in order to load images with vtk, process with itk, and<br>
then render with vtk.<br>
<br>
vtkToItkFilter -> array of ImageToImageFilters all connected -><br>
itkToVtkFilter<br>
<br>
I tried to stick the GPUBinaryThresholdImageFilter in the array like I would<br>
a normal filter connecting it appropriately and calling update but it broke<br>
throwing a read access violation on line 46 of the GPUGenerateData function<br>
in itkGPUUnaryFunctorImageFilter.<wbr>hxx saying otPtr.m_Pointer was nullptr.<br>
<br>
My code goes a little something like this:<br>
<br>
typedef itk::Image<float, 3> Image;<br>
typedef itk::<wbr>GPUBinaryThresholdImageFilter<<wbr>Image, Image><br>
GPUBinaryThresholdFilter;<br>
GPUBinaryThresholdFilter::<wbr>Pointer filter = GPUBinaryThresholdFilter::New(<wbr>);<br>
double* range = pipe->GetOutput()-><wbr>GetScalarRange();<br>
filter->SetLowerThreshold(<wbr>filterWidget-><wbr>getDoubleFromSlider("Lower"));<br>
filter->SetUpperThreshold(<wbr>filterWidget-><wbr>getDoubleFromSlider("Upper"));<br>
filter->SetOutsideValue(range[<wbr>0]);<br>
filter->SetInsideValue(range[<wbr>1]);<br>
filters.push_back(filter);<br>
if (filters.size() > 0)<br>
        filter->SetInput(filters.back(<wbr>)->GetOutput());<br>
else<br>
        filter->SetInput(<wbr>vtkToItkLoader->GetOutput());<br>
itkToVtkFilter->SetInput(<wbr>filters.back()->GetOutput());<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://itk-insight-users.2283740.n2.nabble.com/Problems-Using-GPU-Filters-tp7590036.html" rel="noreferrer" target="_blank">http://itk-insight-users.<wbr>2283740.n2.nabble.com/<wbr>Problems-Using-GPU-Filters-<wbr>tp7590036.html</a><br>
Sent from the ITK Insight Users mailing list archive at Nabble.com.<br>
______________________________<wbr>_______<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_<wbr>FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/insight-users" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/insight-users</a><br>
</blockquote></div><br></div>