import org.itk.simple.*;
class ImageIOSelection {
public static void main(String argv[]) {
if ( argv.length < 1 ) {
System.out.println("Usage: java ImageIOSelection image_file_name");
return;
}
org.itk.simple.ImageFileReader reader = new org.itk.simple.ImageFileReader();
VectorString image_ios;
image_ios = reader.getRegisteredImageIOs();
System.out.print("The supported image IOs are: ");
System.out.println(image_ios);
System.out.println("--------------------");
System.out.println(reader.toString());
System.out.println("--------------------");
reader.setImageIO("PNGImageIO");
reader.setFileName(argv[0]);
try {
Image image = reader.execute();
System.out.println("Read image: " + argv[0]);
VectorUInt32 size = image.getSize();
System.out.println("Image size: " + size.get(0) + " " + size.get(1));
System.out.println("Read failed: " + e);
}
}
}