Trouble running "Custom filter..." from plugin
Posted by ph73nt on Mar 15, 2010; 10:34pm
URL: http://imagej.273.s1.nabble.com/Trouble-running-Custom-filter-from-plugin-tp3688954.html
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