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

Please support multiple frames in PGM file format #268

Open
BarchSteel opened this issue Dec 10, 2020 · 6 comments
Open

Please support multiple frames in PGM file format #268

BarchSteel opened this issue Dec 10, 2020 · 6 comments

Comments

@BarchSteel
Copy link

BarchSteel commented Dec 10, 2020

The PGM file format (http://netpbm.sourceforge.net/doc/pgm.html) allows for multiple frames in one file, called a sequence.
The frames are just written, without gaps or padding, sequentially to the file.
The number of frames in the file can be determined by the (fileSize - Header)/(size_of_one_frame)

If I open such a file in ImageJ, only the first frame is displayed.
Please improve the PGM file reader, so it can read multiple frames as a sequence, just like the RAW importer does.
sequence_3_frames_38x38px_8bit.zip

As a work-around, you can import the file using the "RAW" importer. For example, for the attached file, use uint8, size: 38x38 px, 3 frames.

Tested on ImageJ 1.53e.

@imagejan
Copy link
Member

That's an issue for the ome/bioformats repository, as PGMReader is implemented there.

@ctrueden
Copy link
Member

To complicate matters: because PGM is an open format, there is also a SCIFIO implementation: PGMFormat. Strategically, it is probably time for a conversation about whether to continue maintaining these SCIFIO implementations. Although there are many downsides to discontinuing it, resources-wise, having two implementations to keep synchronized is not really tenable at the moment.

@BarchSteel
Copy link
Author

BarchSteel commented Dec 11, 2020

Thank you for the pointers. I will file this bug report there again.
I opened bug report in SCIFIO first, because I think this used when ImageJ without Fiji is used: scifio/scifio#445
I also created a bug report for Bio-Formats: ome/bioformats#3649

@BarchSteel
Copy link
Author

BarchSteel commented Dec 16, 2020

So, I played a little bit around with SCIFIO and patched the scifio PGMFormat.java to read multi-plane images.
On ImageJ 2.1.1-snapshot (compiled from the GIT master branch from )
But my modified class was only called when I used File->Import->"Image...."
It would not load when I use File->Open Image. ImageJ used some other class, and not my class.

So is/was there a 3rd class for PGM loading?

Edit: I got confused by the ImageJ "About" dialog. The git snapshot 2.1.1-SNAPSHOT shows in Help->"About ImageJ" the version 1.53c. This can't be good for the user...

@imagejan
Copy link
Member

It would not load when I use File->Open Image. ImageJ used some other class, and not my class.

Indeed, ImageJ uses Bio-Formats in that case, unless you specify "Use SCIFIO when opening files (BETA!)" in Edit > Options > ImageJ2...

The git snapshot 2.1.1-SNAPSHOT shows in Help->"About ImageJ" the version 1.53c.

That's unfortunate, but a known issue: Help > About ImageJ is an ImageJ1 command and displays the bundled ImageJ1 version (i.e. the one of your ij.jar file).
Clicking on the info bar will tell you the versions of both IJ1 and IJ2, e.g. (Fiji Is Just) ImageJ 2.1.0/1.53c.

@BarchSteel
Copy link
Author

BarchSteel commented Dec 16, 2020

Indeed, ImageJ uses Bio-Formats in that case, unless you specify "Use SCIFIO when opening files (BETA!)" in Edit > Options > ImageJ2...

That's an interesting comment. When I first read it, I though: well, when I compiling ImageJ from source, there is no Bio-Format plug-in installed. But then you said that there is a bundled version of ImageJ1... and yes, in then dependency ij-1.5.3c.jar, there is another PGM reader at: ij.plugin.PGM_reader.class (which does not seem to be part of the Bio-Formats package either).

Thank you, I will try your option "Use SCIFIO when opening files (BETA!)", it looks very promising ;-)

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