<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:10pt"><div><span>I am trying to use the itkGPUDiscreteGaussianImageFilter to smooth a relatively large input image (512 x 512 x 631) with single floating precision. But I am getting runtime errors when I try to perform a second smoothing operation on this large dataset. I can smooth the image once, but then receive a vague error from the code below(&nbsp;</span><span style="background-color: transparent;">-R6010 -abort() has been called ). I do not have an error when replacing the filter with the non-GPU version.&nbsp;</span></div><div style="color: rgb(0, 0, 0); font-size: 13.333333969116211px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.333333969116211px; font-family: 'Courier New', courier,
 monaco, monospace, sans-serif; background-color: transparent; font-style: normal;">Is there a more correct way to clear GPU buffers associated with the filter below? I have tried a similar piece of code within a matlab mex file and received a&nbsp;CL_MEM_OBJECT_ALLOCATION_FAILURE.&nbsp;</div><div style="color: rgb(0, 0, 0); font-size: 13.333333969116211px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.333333969116211px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; background-color: transparent; font-style: normal;">Thanks,</div><div style="color: rgb(0, 0, 0); font-size: 13.333333969116211px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; background-color: transparent; font-style: normal;">Tim</div><div></div><div><div><div><br></div><div>//======================== CODE
 ===========================</div><div>#include "itkGPUDiscreteGaussianImageFilter.h"</div><div>#include "itkCastImageFilter.h"</div><div>#include "itkImageFileReader.h"</div><div><br></div><div>int main( int argc, char * argv[] )</div><div>{</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>//type definitions</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>const int Dimension = 3;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>typedef float<span class="Apple-tab-span" style="white-space:pre">                                                </span>PixelType;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>typedef itk::Image&lt;PixelType,Dimension&gt;<span class="Apple-tab-span" style="white-space:pre">                        </span>ImageType;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>typedef itk::GPUImage&lt;PixelType,Dimension&gt;<span class="Apple-tab-span" style="white-space:pre">        
        </span>GPUImageType;<span class="Apple-tab-span" style="font-size: 10pt; white-space: pre;">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>typedef itk::ImageFileReader&lt;ImageType&gt; ReaderType;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>typedef itk::CastImageFilter&lt;ImageType,GPUImageType&gt;<span class="Apple-tab-span" style="white-space:pre">        </span>CastFilterType;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>typedef itk::GPUDiscreteGaussianImageFilter&lt;GPUImageType,GPUImageType&gt;<span class="Apple-tab-span" style="white-space:pre">        </span>FilterType;&nbsp;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>//read in our image</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>ReaderType::Pointer reader = ReaderType::New();</div><div><span class="Apple-tab-span" style="white-space:pre">
        </span>reader-&gt;SetFileName("BigImage.mhd"); &nbsp;//512 x 512 x 631</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>reader-&gt;Update();</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>//cast to GPUImage</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>CastFilterType::Pointer castFilter = CastFilterType::New();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>castFilter-&gt;SetInput( reader-&gt;GetOutput() );</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>castFilter-&gt;Update();</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>//smooth the image<span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>FilterType::Pointer filter = FilterType::New();</div><div><span class="Apple-tab-span" style="white-space:pre">
        </span>filter-&gt;SetInput( castFilter-&gt;GetOutput() );</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>filter-&gt;SetVariance( 1.0 );</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>filter-&gt;Update();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>filter-&gt;GetOutput()-&gt;UpdateBuffers();</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>//clear the GPUImage buffer</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>filter-&gt;SetReleaseDataFlag(true);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>filter-&gt;GetOutput()-&gt;Initialize();</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>//try to smooth again</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>FilterType::Pointer filter2 = FilterType::New();</div><div><span class="Apple-tab-span"
 style="white-space:pre">        </span>filter2-&gt;SetInput( castFilter-&gt;GetOutput() );</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>filter2-&gt;SetVariance( 1.0 );</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>filter2-&gt;Update(); //GET RUNTIME ERROR HERE</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>filter2-&gt;GetOutput()-&gt;UpdateBuffers();</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>return EXIT_SUCCESS;<span style="font-size: 10pt;">&nbsp;&nbsp;</span></div><div>}</div></div></div></div></body></html>