Skip to content

Instantly share code, notes, and snippets.

@ctrueden
Last active June 29, 2018 10:51
Show Gist options
  • Save ctrueden/8c14e07d5f2d9b4623b42b2e80feca30 to your computer and use it in GitHub Desktop.
Save ctrueden/8c14e07d5f2d9b4623b42b2e80feca30 to your computer and use it in GitHub Desktop.
Simple SCIFIO example which parses metadata and prints it
package net.restlesscoder.sandbox.imagej;
import io.scif.FieldPrinter;
import io.scif.Format;
import io.scif.Metadata;
import net.imagej.ImageJ;
public class ParseMetadata {
public static void main(final String... args) throws Exception {
ImageJ ij = new ImageJ();
final String filePath = "/Users/curtis/data/toucan.png";
Format format = ij.scifio().format().getFormat(filePath);
Metadata metadata = format.createParser().parse(filePath);
System.out.println(new FieldPrinter(metadata));
ImageMetadata imageMeta = metadata.get(0);
System.out.println(imageMeta);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment