I’m a frequent user of ImageJ and have just encountered the following problem:
I have a tif-image (1308x1080 pixel, 32-bit, greyscale) that I want to bin.
In Fiji (ImageJ2.0.0-rc-69/1.52k; Java 1.8.0_172 [64 bit],):
If I bin it via the menu with “Image > Transform > Bin… > X = 2, Y =2, Method = Average”, it creates a 654x540 unbinned crop of the top left corner.
If I try the same command via the Macro language (run(“Bin…”, “x=2 y=2 bin=Average”), I get the same unbinned cropped image.
If I use the “Median” method, it works fine (get a 654x540 binned image, whole frame).
If I bin a random jpg, I get the expected binned result.
If I convert the 32-bit tif to 16-bit, I get the expected binned result.
If I use Image > Adjust > Size, I can reduce the size to 654x540 pixel and that works as expected.
In Fiji (ImageJ2.0.0-rc-64/1.52k; Java 1.8.0_66 [64 bit]) AND In ImageJ (ImageJ 1.48v; Java 1.6.0_20 [64 bit]):
If run the same “Image > Transform > Bin… > X = 2, Y =2, Method = Average”, I get a 2x2 binned image (654x540), whole frame, as expected.
Does someone know how to fix this?
The obvious solution would be to use my Fiji (ImageJ2.0.0-rc-64/1.52i; Java 1.8.0_66) to run my macros. However, I like the newer version’s Plugin editor Autocomplete feature and I want to avoid having to go back and forth.
I would also like to avoid going the “Adujst > Size” route, as I would have to replace the Bin command in all my macros…
Any suggestions appreciated
UPDATE: If I open the very same image 10 times and bin it with Transform > Bin > Average (identical settings), it’s random whether it crops or bins.
UPDATE2: I solved it using
bin=2; Stack.getDimensions(width, height, channels, slices, frames); run("Scale...", "x="+1/bin+" y="+1/bin+" width="+width/bin+" height="+height/bin+" interpolation=None average create title=to_be_corr");
The binning thing is still weird and I want to know whyyy, but I might never get closure.