Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes needed for FIBSEM .dat format #16

Open
acardona opened this issue Jan 18, 2022 · 4 comments
Open

Fixes needed for FIBSEM .dat format #16

acardona opened this issue Jan 18, 2022 · 4 comments

Comments

@acardona
Copy link
Member

In line 210 of https://github.com/fiji/IO/blob/master/src/main/java/sc/fiji/io/FIBSEM_Reader.java, it reads, in the function readChannels:

		// it is always unsigned short
		final byte[] slice = new byte[ (int)header.xRes * (int)header.yRes * numChannels * 2 ];
		file.read( slice );
		final ByteBuffer buffer = ByteBuffer.wrap( slice );
		final ShortBuffer shortBuffer = buffer.asShortBuffer();

... which is not true. I have here some .dat files that are:

  • signed 16-bit (very surprisingly)
  • BIG_ENDIAN, so it needs ByteBuffer.wrap( slice ).order( ByteOrder.BIG_ENDIAN ) to be parsed correctly.
@imagejan
Copy link
Member

imagejan commented Feb 23, 2022

For what it's worth, here's a permalink to the lines in question (you can create a permalink by clicking on the line numbers on the left hand side, and then using the context menu on the ... button):

// it is always unsigned short
final byte[] slice = new byte[ (int)header.xRes * (int)header.yRes * numChannels * 2 ];
file.read( slice );
final ByteBuffer buffer = ByteBuffer.wrap( slice );
final ShortBuffer shortBuffer = buffer.asShortBuffer();


@acardona is there any metadata in the .dat files that can be used to argue what type and what endianness is required?

@acardona
Copy link
Member Author

Hi @imagejan, there should be, but the only documentation I have are these java files in this repository.

@jefferis
Copy link
Contributor

Out of curiosity @acardona are the magic/header fields in your big endian files little endian even if the image data is big endian?

@acardona
Copy link
Member Author

As far as I know, Greg @jefferis, the java file doesn't decode any header field for endianness. But I think it doesn't decode all header fields, of which there are many. Someone ought to look into the matlab file that converts DAT to TIFF, there it may be specified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants