http://imagej.273.s1.nabble.com/Image-Byte-Order-Correction-tp5023490p5023498.html
If you feel adventurous, you could try writing the TIFF file yourself.
It is not as tricky as it may seem.
the TIFF header and file format structure looks like.
And here is a script on writing TIFF files. Where it creates the
the array again to replace the original one in the ShortProcessor.
Save the TIFF file normally. In disk, the bytes will be in little
endian. Something like this (untested, in jython):
>
> Dear Fred,
>
> Thanks for your immediate response, really appreciate it. I think your
> solution is awesome and I tried it step by step. Here I have one more
> question about your description,
> ```
> Write out the binary image in little endian format and display it as a hex
> dump.
> ```
> So how do you write out the binary image in little endian format? I only
> find a check called 'Save TIFF and raw in Intel byte order', and when I
> tried this one, the result is still a big endian byte order file I think,
> for example as following,
> ```
> Original file in hex format:
> 041b940: 0000 0000 0000 803f 0000 803f 0000 803f .......?...?...?
> 041b950: 0000 803f 0000 803f 0000 c442 0000 c442 ...?...?...B...B
> 041b960: 0000 c442 0000 c442 0000 c442 0000 c442 ...B...B...B...B
>
> Saved new raw file in hex format:
> 041b940: 0000 0000 003f 0047 003f 0047 003f 0047 .....?.G.?.G.?.G
> 041b950: 003f 0047 003f 0047 0042 4447 0042 4447 .?.G.?.G.BDG.BDG
> 041b960: 0042 4447 0042 4447 0042 4447 0042 4447 .BDG.BDG.BDG.BDG
> ```
> As you can see above, there is still non-zero first byte in the new output
> raw file. Could you explain explicitly how you write out a little endian
> new file and recommend me a way to convert the output raw file to .i33
> format if you can? I am totally a rookie in image reconstruction and I
> really appreciate your help! Thank you!
>
> Best,
>
> On Thu, Jun 11, 2020 at 1:12 AM Fred Damen <
[hidden email]> wrote:
>
> > 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> >
>
>
> --
> *....................................................*
> *Xinjie Cao*
> *M.E. / Ph.D. student*
> *Research Project Assistant*
> *Department of Electrical and Computer Engineering & Radiology *
> *Novel Medical Imaging Technologies Lab*
> *Health Science Center Level 8*
> *Stony Brook, NY 11794-8460 *
> *Tel: +1 (631)202-9445*
> you.stonybrook.edu/goldan/people/
> *email: **xinjie.cao@stonybroo*k.edu <
[hidden email]>
>
>
> *....................................................*
> It is prohibited to distribute or publish the files attached to any other
> people unless you get permission from the writer himself. All rights
> reserved.
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html