Hi, everyone!
I have been using ImageJ to export my 12 bit images for a long time. Today I find out it is not a good idea because the "8 bit" function is not working the way I thought. Instead of converting 0~4095 to 0~255, actually it converts from min~max of that particular image to 0~255. I am wondering, does anybody happen to know any plugins, macros or software to faithfully do the conversion? Thank you very much! Best, Hao -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Hao,
you can simply set the display range to 0-4095 (Set in The Brighness&Contrast Panel). If you select "8-bit" then the 0-4095 range will be mapped to 0-255. You can easily have a macro for this. This is what the Macro recorder would tell you: setMinAndMax(0, 4095); run("8-bit"); (This assumes that Edit>Options>Conversions" has "Scale when converting" enabled; otherwise 0-255 will be mapped to 0-255 and everything from 256-2095 will become 255) It should be noted that a conversion from 12 to 8 bits is never "faithful": You will always lose information; in your case 16 gray levels will be mapped to one! Michael ________________________________________________________________ On Oct 21, 2014, at 19:09, Hao Wu wrote: > Hi, everyone! > > I have been using ImageJ to export my 12 bit images for a long time. Today > I find out it is not a good idea because the "8 bit" function is not > working the way I thought. Instead of converting 0~4095 to 0~255, actually > it converts from min~max of that particular image to 0~255. I am wondering, > does anybody happen to know any plugins, macros or software to faithfully > do the conversion? Thank you very much! > > Best, > Hao -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Hao Wu
I think this is what you want to do:
macro "Convert 12 to 8 bits linear" { setMinAndMax(0, 4095); call("ij.ImagePlus.setDefault16bitRange", 12); run("8-bit"); } =========================================================================== Michael Cammer, Microscopy Core & Skirball Institute, NYU Langone Medical Center Cell: 914-309-3270 note that we do not receive messages left at 212-263-3208 http://ocs.med.nyu.edu/microscopy & http://microscopynotes.com/ -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Hao Wu Sent: Tuesday, October 21, 2014 1:09 PM To: [hidden email] Subject: convert 12 bit to 8 bit images faithfully Hi, everyone! I have been using ImageJ to export my 12 bit images for a long time. Today I find out it is not a good idea because the "8 bit" function is not working the way I thought. Instead of converting 0~4095 to 0~255, actually it converts from min~max of that particular image to 0~255. I am wondering, does anybody happen to know any plugins, macros or software to faithfully do the conversion? Thank you very much! Best, Hao -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Michael Schmid
Hi, Michael!
Thank you so much! It solves a big problem for me. Best, Hao On Tue, Oct 21, 2014 at 1:46 PM, Michael Schmid <[hidden email]> wrote: > Hi Hao, > > you can simply set the display range to 0-4095 (Set in The > Brighness&Contrast Panel). If you select "8-bit" then the 0-4095 range will > be mapped to 0-255. You can easily have a macro for this. This is what the > Macro recorder would tell you: > setMinAndMax(0, 4095); > run("8-bit"); > > (This assumes that Edit>Options>Conversions" has "Scale when converting" > enabled; otherwise 0-255 will be mapped to 0-255 and everything from > 256-2095 will become 255) > > It should be noted that a conversion from 12 to 8 bits is never > "faithful": You will always lose information; in your case 16 gray levels > will be mapped to one! > > Michael > ________________________________________________________________ > On Oct 21, 2014, at 19:09, Hao Wu wrote: > > > Hi, everyone! > > > > I have been using ImageJ to export my 12 bit images for a long time. > Today > > I find out it is not a good idea because the "8 bit" function is not > > working the way I thought. Instead of converting 0~4095 to 0~255, > actually > > it converts from min~max of that particular image to 0~255. I am > wondering, > > does anybody happen to know any plugins, macros or software to faithfully > > do the conversion? Thank you very much! > > > > Best, > > Hao > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Cammer, Michael
Really nice! Thank you so much!
Best, Hao On Tue, Oct 21, 2014 at 1:47 PM, Cammer, Michael <[hidden email] > wrote: > I think this is what you want to do: > > macro "Convert 12 to 8 bits linear" { > setMinAndMax(0, 4095); > call("ij.ImagePlus.setDefault16bitRange", 12); > run("8-bit"); > } > > =========================================================================== > Michael Cammer, Microscopy Core & Skirball Institute, NYU Langone Medical > Center > Cell: 914-309-3270 note that we do not receive messages left at > 212-263-3208 > http://ocs.med.nyu.edu/microscopy & http://microscopynotes.com/ > > > -----Original Message----- > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Hao > Wu > Sent: Tuesday, October 21, 2014 1:09 PM > To: [hidden email] > Subject: convert 12 bit to 8 bit images faithfully > > Hi, everyone! > > I have been using ImageJ to export my 12 bit images for a long time. Today > I find out it is not a good idea because the "8 bit" function is not > working the way I thought. Instead of converting 0~4095 to 0~255, actually > it converts from min~max of that particular image to 0~255. I am wondering, > does anybody happen to know any plugins, macros or software to faithfully > do the conversion? Thank you very much! > > Best, > Hao > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |