Re: How to read 'raw' data as 32 bit unsigned in Java

Posted by Curtis Rueden on
URL: http://imagej.273.s1.nabble.com/How-to-read-raw-data-as-32-bit-unsigned-in-Java-tp5021772p5021798.html

Hi all,

> ImageJ doesn't support 32 bit integer gray scale images.

It is more precise to write "ImageJ1 doesn't support 32-bit integer
grayscale images."

ImageJ2 does support them.

Here is Groovy code illustrating it:

--snip--
v = Integer.MAX_VALUE
int[] values = [
    v, v - 1, v - 2, v / 4,
    v / 4 - 3, v / 8 - 5, v / 3, v / 2 + 5,
    v / 2 + 3, v / 2 + 7, v / 2 + 11, v / 2 + 13
]
img = net.imglib2.img.array.ArrayImgs.ints(values, 4, 3)

access = img.randomAccess()
for (y=0; y<3; y++) {
    for (x=0; x<4; x++) {
        access.setPosition(x, 0)
        access.setPosition(y, 1)
        println("($x, $y) = ${access.get()} (array
value=${values[4*y+x]})")
    }
}
--snap--

Regards,
Curtis

--
Curtis Rueden
LOCI software architect - https://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
Have you tried the Image.sc Forum? https://forum.image.sc/



On Tue, Feb 12, 2019 at 12:38 PM 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