[Insight-users] Actually implementing a Gabor filter

Neal R. Harvey harve at lanl.gov
Mon Jun 21 18:18:15 EDT 2010


I basically copied your implementation examples, but am unable to get it 
to work:

Here's the code:

typedef itk::GaborImageSource< ImageType > GaborSourceType;
GaborSourceType::Pointer GaborKernelImage = GaborSourceType::New();

// Setting the sigma for the 2-D Gabor kernel
GaborSourceType::ArrayType GaborSigma;
GaborSigma[0] = 2.0;
GaborSigma[1] = 5.0;

ImageType::SizeType GaborKernelImageSize;
GaborKernelImageSize.Fill( 64 * 4 );
GaborKernelImage->SetSpacing( InputImageSpacing );
GaborKernelImage->SetSize( GaborKernelImageSize );

GaborKernelImage->SetSigma( GaborSigma );
GaborKernelImage->SetFrequency( 0.1 );
GaborKernelImage->SetCalculateImaginaryPart( false );

GaborKernelImage->Update();

std::cout << "Performing Convolution ... Starting" << std::endl;
typedef itk::ConvolutionImageFilter< ImageType > ConvolutionFilterType;
ConvolutionFilterType::Pointer Convoluter;
Convoluter->SetInput( itkChipImg );
Convoluter->SetImageKernelInput( GaborKernelImage->GetOutput() );
Convoluter->NormalizeOn();
Convoluter->Update();
std::cout << "Performing Convolution ... Completed" << std::endl;

It compiles, but I get a segmentation fault - here's the output.

Performing Convolution ... Starting
Segmentation fault

I have no idea where or what the problem is. I have tried to use the 
same code as in the
examples, as much as possible, in order to try and minimize the chance 
of errors introduced
by my own incompetence/ignorance.

Nicholas Tustison wrote:
> Neal,
>
> You should try one of the convolution image filters below (the first is a straightforward implementation and the second is FFT-based) which take as input a source image and a kernel image and returns the filtered image. 
>
> Nick
>
> http://www.insight-journal.org/browse/publication/208
>
> http://www.insight-journal.org/browse/publication/717
>
>
>
> On Jun 15, 2010, at 5:54 PM, Neal R. Harvey wrote:
>
>   
>> I read the Insight Journal paper "Go-Go Gabor Gadgetry" which describes how to create
>> a Gabor filter kernel image. All very interesting, but not very useful unless I can determine how
>> to now use this kernel image in a filter.
>> The paper does not really provide details and, looking through the ITK Software Guide,
>> I can find descriptions of a whole lot of filters, but I haven't yet been able to find one that takes an image
>> as an input for its kernel. Google searches haven't proved much use, either, as I keep ending back
>> at the same paper "Go-Go Gadget" paper.
>> What ITK filtering function do I use that can take in the Gabor kernel image?
>>
>> Any help would be much appreciated.
>>
>> Thanks
>>
>> Harve
>> _____________________________________
>> 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.html
>>
>> 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 Insight-users mailing list