<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( </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. </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 CL_MEM_OBJECT_ALLOCATION_FAILURE. </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<PixelType,Dimension><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<PixelType,Dimension><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<ImageType> ReaderType;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>typedef itk::CastImageFilter<ImageType,GPUImageType><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<GPUImageType,GPUImageType><span class="Apple-tab-span" style="white-space:pre"> </span>FilterType; </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->SetFileName("BigImage.mhd"); //512 x 512 x 631</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>reader->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->SetInput( reader->GetOutput() );</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>castFilter->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->SetInput( castFilter->GetOutput() );</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>filter->SetVariance( 1.0 );</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>filter->Update();</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>filter->GetOutput()->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->SetReleaseDataFlag(true);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>filter->GetOutput()->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->SetInput( castFilter->GetOutput() );</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>filter2->SetVariance( 1.0 );</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>filter2->Update(); //GET RUNTIME ERROR HERE</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>filter2->GetOutput()->UpdateBuffers();</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>return EXIT_SUCCESS;<span style="font-size: 10pt;"> </span></div><div>}</div></div></div></div></body></html>