using System;
namespace itk.simple.examples {
class ImageIOSelection {
static void Main(string[] args) {
try {
if (args.Length < 1) {
Console.WriteLine("Usage: ImageIOSelection image_input_file");
return;
}
ImageFileReader reader = new ImageFileReader();
itk.
simple.VectorString image_ios = reader.GetRegisteredImageIOs();
Console.Write("The supported image IOs are: ");
for (int i=0; i<image_ios.Count; i++) {
Console.Write(image_ios[i] + " ");
}
Console.WriteLine("\n--------------------");
Console.WriteLine(reader.ToString());
Console.WriteLine("--------------------");
reader.SetImageIO("PNGImageIO");
reader.SetFileName(args[0]);
Image image = reader.Execute();
Console.WriteLine("Read image: " + args[0]);
VectorUInt32 size = image.GetSize();
Console.WriteLine( "Image size: " + size[0] + " " + size[1] );
} catch (Exception ex) {
Console.WriteLine("Read failed: " + ex);
}
}
}
}