16 bit grayscale values

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

16 bit grayscale values

Blaine Simpson
I'm struggling to use ImageJ to satisfy my Java app's 16 bit grayscale
needs, but it sure takes a lot of tricks to get ImageJ to work with 16
bit grays.

The only critical problem I've encountered which I can't get around and
which I can't enhance in the ImageJ code within my allowable schedule is
the granularity of the values I can draw with.  My application obviously
needs me to specify pixel values more specifically than 8 bits or the
app would use 8-bit grayscale, but ImageJ doesn't let me do this.  The
color chooser widget doesn't give any way to specify precise numerical
values how most color choosers do.  Everything I do in ImageJ seems
designed to assume that if the current image is Grayscale, pixel values
should be forced to a mutiple of 0x010101.  The end result is that I can
only draw pixel values which are multiples of 0x101 (probably as a
result of the the 0x010101 multiples getting truncated to 16 bits).

I guess ImageJ may be forcing values to 0x010101 mutiples so they can be
presented with gray color in the Image UI.  But whereas that tactic
works fine for 8-bit grayscales where the 0xFFFF00 portion may just be
dropped upon writes, it doesn't work for 16-bit grayscales where a less
simple conversion must be performed.

Anybody have a workaround for me so I can somehow draw with 16-bit
values to a grayscale image in ImageJ?
Reply | Threaded
Open this post in threaded view
|

Re: 16 bit grayscale values

Michael Schmid
Hi Blaine,

you can use Process>Math>Set to set the selected area to any  
arbitrary value.
If you want to paint a freehand line, select it first with the  
selection brush (red arrow below the elliptical selection tool; right-
click) and then set the value.
When using the selection brush, don't paint to quickly, it has some  
speed limitations.
Press ctrl-shift A (deselect all) before painting if you want a new  
line that does not start at an existing line.

With a some programming effort, it should be also possible to create  
a tool similar to the blue drawing tools in the standard startup  
macros, not using the foreground/background colors but rather setting  
pixel values - maybe someone has done this already?

Michael
________________________________________________________________

On 20 Oct 2009, at 20:37, Blaine Simpson wrote:

> I'm struggling to use ImageJ to satisfy my Java app's 16 bit grayscale
> needs, but it sure takes a lot of tricks to get ImageJ to work with 16
> bit grays.
>
> The only critical problem I've encountered which I can't get around  
> and
> which I can't enhance in the ImageJ code within my allowable  
> schedule is
> the granularity of the values I can draw with.  My application  
> obviously
> needs me to specify pixel values more specifically than 8 bits or the
> app would use 8-bit grayscale, but ImageJ doesn't let me do this.  The
> color chooser widget doesn't give any way to specify precise numerical
> values how most color choosers do.  Everything I do in ImageJ seems
> designed to assume that if the current image is Grayscale, pixel  
> values
> should be forced to a mutiple of 0x010101.  The end result is that  
> I can
> only draw pixel values which are multiples of 0x101 (probably as a
> result of the the 0x010101 multiples getting truncated to 16 bits).
>
> I guess ImageJ may be forcing values to 0x010101 mutiples so they  
> can be
> presented with gray color in the Image UI.  But whereas that tactic
> works fine for 8-bit grayscales where the 0xFFFF00 portion may just be
> dropped upon writes, it doesn't work for 16-bit grayscales where a  
> less
> simple conversion must be performed.
>
> Anybody have a workaround for me so I can somehow draw with 16-bit
> values to a grayscale image in ImageJ?