Posted by
Kenneth Sloan-2 on
Feb 12, 2019; 7:17pm
URL: http://imagej.273.s1.nabble.com/How-to-read-raw-data-as-32-bit-unsigned-in-Java-tp5021772p5021774.html
If you do this in Java, I think there are a couple of workarounds.
Here's one idea: Since you already can "process these data as ints", you
should be able to create your own 8-bit RGB image. Of course, you only
get 8-bits of gray scale.
Here's another idea: you should be able to import the image as a 32-bit
float image. If there is non-zero data in the upper 8 bits, the image will look
very strange, but at least you'll have a 32-bit array. Next, take each
32-bit float pixel value and use Float.floatToRawIntBits to get
your 32-bit integer values.
Since you can already create the int values from your byte array, I would start
with that idea.
Be careful about signed/unsigned.
Finally, I would consider creating a 24-bit integer gray-scale value, and using
that as a 32-bit float (using Float.intBitsToFloat). This gives you a float image
where the values are between 0.0 and 1.0. You can then use an Overlay to highlight
the problem pixels. Use either idea above to get a 32-bit unsigned value, and
scale it to 24-bits. Convert that to a float, and store it in a 32-bit float image.
Or, simply create a 16-bit integer gray scale image, and use an Overlay.
Your choice may depend on what you know about the range of values. The advantage of
my 24-bit version above is that you have a bit more flexibility in dynamically adjusting
the range of displayed gray levels. The disadvantage is that the numbers will all
be presented as (0.0..1.0) instead of [0..65535] (for the 16-bit version)
--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.
> On Feb 12, 2019, at 12:37, Herbie <
[hidden email]> wrote:
>
> Good day,
>
> ImageJ doesn't support 32 bit integer gray scale images.
>
> Supported are 8bit and 16bit integer as well as 32bit float. Furthermore 24bit (3 X 8bit) RGB and index color 8bit.
>
> Regards
>
> Herbie
>
> :::::::::::::::::::::::::::::::::::::::::::::
> Am 12.02.19 um 19:15 schrieb Robert Lockwood:
>> Working with Java I have raw data files with 32 bit integer gray scale data
>> which I read into a byte[] array. I process these data as ints looking for
>> adjacent pixels that have the same value in order to debug a problem with
>> the camera.
>> I'd like to create a scaled grayscale RGB from the original data so that I
>> may color the detected adjacent pixels to allow us to detect patterns
>> visually but I don't understand how to create and populate a grayscale
>> integer ImageJ array and have not found an example by Google searching.
>> How do I do this?
>> TIA
>> --
>> 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