Hi Wayne,
I tried your Macro (IJ 1.35g, Windows XP). It worked however the resulting 32 bit gray image turned out to be inverted,a matter of byte order?? Christian Kreutzfeldt |
> I tried your Macro (IJ 1.35g, Windows XP). It worked however the
> resulting 32 bit gray image turned out to be inverted,a matter of byte > order?? The newImage() function was creating an image with an inverting lookup table. Adding 'black' (fill with black) to the second argument fixes the problem. Here is the updated macro. if (bitDepth!=24) exit("RGB image required"); setBatchMode(true); w = getWidth; h = getHeight; rgb = getImageID; newImage("32-bit", "32-bit black", w, h, 1); float = getImageID; for (y=0; y<h; y++) { showProgress(y, h); for (x=0; x<w; x++) { selectImage(rgb); v = getPixel(x,y)&0xffffff; selectImage(float); setPixel(x, y, v); } } resetMinAndMax; setBatchMode(false); //run("16-bit"); -wayne |
Hi Wayne,
I got the latest beta version and your macro works fine. However, even with the revised version, the lookup table seems to be inverted. For densitometry applications I would like black to stick out as a mountain in a surface plot and white to become the lowlands. How can I make sure black is **always** a high point in a surface plot when using this conversion macro? Thanks heaps! ImageJ is a great software! Art Wayne Rasband wrote: >> I tried your Macro (IJ 1.35g, Windows XP). It worked however the >> resulting 32 bit gray image turned out to be inverted,a matter of byte >> order?? > > > The newImage() function was creating an image with an inverting lookup > table. Adding 'black' (fill with black) to the second argument fixes the > problem. Here is the updated macro. > > if (bitDepth!=24) > exit("RGB image required"); > setBatchMode(true); > w = getWidth; > h = getHeight; > rgb = getImageID; > newImage("32-bit", "32-bit black", w, h, 1); > float = getImageID; > for (y=0; y<h; y++) { > showProgress(y, h); > for (x=0; x<w; x++) { > selectImage(rgb); > v = getPixel(x,y)&0xffffff; > selectImage(float); > setPixel(x, y, v); > } > } > resetMinAndMax; > setBatchMode(false); > //run("16-bit"); > > -wayne -- ============================================ == CSO & System Administrators == == ALS, Sydney, Australia == == [hidden email] == ============================================ ======================================================================== The information contained in this e-mail message, including any attachments, is confidential, subject to copyright, and maybe the subject of legal and other privilege. Any dissemination, distribution, or copying of this message, in its entirety or part by any entity apart from the intended recipient is strictly prohibited. Please accept our apologies if you are not the intended recipient. If you think that you have received this e-mail message in error, please e-mail the sender and destroy the original message without making a copy. Unfortunately, we cannot warrant that the email has not been altered or corrupted during transmission. Thank you. ======================================================================== |
Free forum by Nabble | Edit this page |