[ITK Community] [Insight-users] (no subject)
Tim Soper
tim_d_soper at yahoo.com
Tue Jan 7 15:08:15 EST 2014
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( -R6010 -abort() has been called ). I do not have an error when replacing the filter with the non-GPU version.
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.
Thanks,
Tim
//======================== CODE ===========================
#include "itkGPUDiscreteGaussianImageFilter.h"
#include "itkCastImageFilter.h"
#include "itkImageFileReader.h"
int main( int argc, char * argv[] )
{
//type definitions
const int Dimension = 3;
typedef floatPixelType;
typedef itk::Image<PixelType,Dimension>ImageType;
typedef itk::GPUImage<PixelType,Dimension>GPUImageType;
typedef itk::ImageFileReader<ImageType> ReaderType;
typedef itk::CastImageFilter<ImageType,GPUImageType>CastFilterType;
typedef itk::GPUDiscreteGaussianImageFilter<GPUImageType,GPUImageType>FilterType;
//read in our image
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName("BigImage.mhd"); //512 x 512 x 631
reader->Update();
//cast to GPUImage
CastFilterType::Pointer castFilter = CastFilterType::New();
castFilter->SetInput( reader->GetOutput() );
castFilter->Update();
//smooth the image
FilterType::Pointer filter = FilterType::New();
filter->SetInput( castFilter->GetOutput() );
filter->SetVariance( 1.0 );
filter->Update();
filter->GetOutput()->UpdateBuffers();
//clear the GPUImage buffer
filter->SetReleaseDataFlag(true);
filter->GetOutput()->Initialize();
//try to smooth again
FilterType::Pointer filter2 = FilterType::New();
filter2->SetInput( castFilter->GetOutput() );
filter2->SetVariance( 1.0 );
filter2->Update(); //GET RUNTIME ERROR HERE
filter2->GetOutput()->UpdateBuffers();
return EXIT_SUCCESS;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140107/2cb51439/attachment.html>
-------------- next part --------------
_____________________________________
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://www.itk.org/mailman/listinfo/insight-users
More information about the Community
mailing list