Login  Register

Re: Trouble running "Custom filter..." from plugin

Posted by Michael Schmid on Mar 16, 2010; 10:05am
URL: http://imagej.273.s1.nabble.com/Trouble-running-Custom-filter-from-plugin-tp3688954p3688955.html

Hi Neil,

just to make sure there are no misunderstandings:
Process>FFT>Custom Filter is in the Fourier domain, with low  
frequencies at the center. So, your filter is actually a high-pass  
filter.
The filter should have values of 255 for the frequencies that should  
pass unattanuated.

If you want a convolution operation, use Process>Filters>Convolve.  
You will need a kernel size that is an odd number (e.g., 3x3, 5x5;  
you can also have 1D kernels like 1x7 or 7x1).


Michael
________________________________________________________________

On 15 Mar 2010, at 23:34, ph73nt wrote:

> Hi list,
>
> I'm not getting the results I expect when I call the "Custom  
> Filter..." menu
> command from a plugin.  I'm writing a plugin that iteratively  
> applies a
> custom filter to a series of small pixel blocks of the input  
> image.  All
> images are 32 bit floats.  Here is a schematic of the steps I take:
>
> - Create a filter image block, a 4x4px imageplus (imFilter) in a  
> window
> titled "Filter"
> - For simple testing I'm using a filter where the values are unity  
> at the
> edges and zero elsewhere:
>   1 1 1 1
>   1 0 0 1
>   1 0 0 1
>   1 1 1 1
> - I create a new image from the original image (imp) to form my  
> current
> "block" (imBlock), again a 4x4 square image block
> - For testing I'm forcing the values in this block to have known  
> values:
>   0 1 2 3
>   0 0 0 0
>   4 5 6 7
>   0 0 0 0
> - I use "Custom Filter..." to filter imBlock with imFilter.
>
> If I do the Custom Filter manually by using the menus I get an  
> image block
> that appears smoothed, which I'm expecting.  But if I try to  
> automate this
> in my plugin, the image block ends up as just a 4x4 image with zero-
> valued
> pixels everywhere.
>
> The command I'm using to call the filter is:
>   ij.IJ.run(imBlock, "Custom Filter...", "filter=[Filter]");
>
> Is there something implicitly wrong with the way I am calling the  
> filter?
> Any suggestions/criticisms would be gratefully received.
>
> Many thanks, Neil
>
> --
> View this message in context: http://n2.nabble.com/Trouble-running- 
> Custom-filter-from-plugin-tp4740352p4740352.html
> Sent from the ImageJ mailing list archive at Nabble.com.