Hello!
I have the following questions: In what way is in app. ImageJ performs this task: convert uint16 to uint8 image? i am specially interesting in intensity rescaling from [0 65535] to [0 255]. thank you!! Marko |
> In what way is in app. ImageJ performs this task: convert uint16 to uint8
> image? i am specially interesting in intensity rescaling from [0 65535] to > [0 255]. > ImagePlus imp = IJ.getImage() imp.setProcessor(null, imp.getProcessor().convertToByte(true)); The above is equivalent to the menu command: Image / type / 8-bit which you can run as: IJ.run("8-bit"); -- Albert Cardona http://www.mcdb.ucla.edu/Research/Hartenstein/acardona |
Thank you for you replay...
Have you already also now the algorithm which perform that? Probably 16BPP intensity value is Divided by 65535 and then multiplied by 255...and the is performing some rounding the number...in what way? Floor? Near neighbor?...etc. Thank you! Marko -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Albert Cardona Sent: 6. december 2007 1:41 To: [hidden email] Subject: Re: convert uint16 image to uint8 image in ImageJ > In what way is in app. ImageJ performs this task: convert uint16 to uint8 > image? i am specially interesting in intensity rescaling from [0 65535] to > [0 255]. > ImagePlus imp = IJ.getImage() imp.setProcessor(null, imp.getProcessor().convertToByte(true)); The above is equivalent to the menu command: Image / type / 8-bit which you can run as: IJ.run("8-bit"); -- Albert Cardona http://www.mcdb.ucla.edu/Research/Hartenstein/acardona |
Hi there,
I am pretty sure there is actually no complicated magic involved, simply bit shifting, which can be achieved like that (especially if you only want to scale from 65536 to 256) pixels8[i] = (byte)((pixels16[i] & 0xffff) >> 8); (Due to the shifting it makes no difference if you AND with 0xffff or 0xff00) Look up the short sections on casting and simulating unsigned types in Java in the Writing ImageJ Plugins Tutorial!! http://mtd.fh-hagenberg.at/depot/imaging/imagej/tutorial171.pdf Mit freundlichen Grüßen / Best regards Joachim Ernst Leitz Strasse 17-37 | 35578 Wetzlar (Germany) Tel. +49 6441 29 2611 | Fax +49 6441 29 2700 ____________________________________________ Leica Microsystems CMS GmbH | GmbH mit Sitz in Wetzlar | Amtsgericht Wetzlar HRB 2432 Geschäftsführer: Dr. Martin Haase | Colin Davis | Dr. Wolf-Otto Reuter Marko Usaj <[hidden email] I-LJ.SI> An Gesendet von: [hidden email] ImageJ Interest Kopie Group <[hidden email]. Thema GOV> Re: convert uint16 image to uint8 image in ImageJ 06.12.2007 02:01 Bitte antworten an ImageJ Interest Group <[hidden email]. GOV> Thank you for you replay... Have you already also now the algorithm which perform that? Probably 16BPP intensity value is Divided by 65535 and then multiplied by 255...and the is performing some rounding the number...in what way? Floor? Near neighbor?...etc. Thank you! Marko -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Albert Cardona Sent: 6. december 2007 1:41 To: [hidden email] Subject: Re: convert uint16 image to uint8 image in ImageJ > In what way is in app. ImageJ performs this task: convert uint16 to uint8 > image? i am specially interesting in intensity rescaling from [0 65535] to > [0 255]. > ImagePlus imp = IJ.getImage() imp.setProcessor(null, imp.getProcessor().convertToByte(true)); The above is equivalent to the menu command: Image / type / 8-bit which you can run as: IJ.run("8-bit"); -- Albert Cardona http://www.mcdb.ucla.edu/Research/Hartenstein/acardona ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ |
Free forum by Nabble | Edit this page |