Posted by
Fred Damen on
Jun 11, 2020; 5:07am
URL: http://imagej.273.s1.nabble.com/Image-Byte-Order-Correction-tp5023490p5023491.html
Greetings Xinjie,
Take the source binary file and display it in a hex dump. My preferred is
Gvim(Tools>Convert To HEX), or on Linux hexdump, and look at the first
voxel. Every 4 character block is a 16 bit integer. In big endian big
numbers (>255) should have nonzero first byte, small numbers (<256) zero
first byte.
Read the binary image into ImageJ. Check the voxel at 0,0 and if its
bigness is the same as in the hexdump then the image was read in
correctly.
Write out the binary image in little endian format and display it as a hex
dump. If the bytes for the first 16bit number are swapped then you
accomplished your task.
Note, using Gvim you can edit the displayed hex and set the number to
something obvious, then convert back to binary and save.
OR on Linux
dd conv=swab <infile >outfile
Enjoy,
Fred
On Wed, June 10, 2020 9:28 pm, Xinjie Cao wrote:
> Dear all,
>
> I need to convert a big-endian .i33 phantom image into a little-endian
> .i33
> image. I tried to convert one into a little-endian order raw image as
> following official guide,
> ```
>
https://imagej.nih.gov/ij/docs/menus/file.html> By default, 16-bit and 32-bit images are saved using big-endian byte
> order. Check "Save TIFF and Raw in Intel Byte Order" in the
> *Edit>Options>Input/Output* dialog box to save using little-endian byte
> order.
> ```
> While it looks like it is not working as it should be, does anyone have
> some experience on that? Any answer will be highly appreciated! Thank you!
>
> Best,
> Xinjie
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html