MCPcopy Create free account
hub / github.com/SimpleITK/SimpleITK / ImageIOSelection

Class ImageIOSelection

Examples/ImageIOSelection/ImageIOSelection.java:25–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23import org.itk.simple.*;
24
25class ImageIOSelection {
26
27 public static void main(String argv[]) {
28
29 if ( argv.length < 1 ) {
30 System.out.println("Usage: java ImageIOSelection image_file_name");
31 return;
32 }
33
34 org.itk.simple.ImageFileReader reader = new org.itk.simple.ImageFileReader();
35
36 // Find out which image IOs are supported
37 VectorString image_ios;
38 image_ios = reader.getRegisteredImageIOs();
39 System.out.print("The supported image IOs are: ");
40 System.out.println(image_ios);
41 System.out.println("--------------------");
42
43 // Another option is to just print the reader and see which
44 // IOs are supported
45 System.out.println(reader.toString());
46 System.out.println("--------------------");
47
48 reader.setImageIO("PNGImageIO");
49 reader.setFileName(argv[0]);
50
51 try {
52 Image image = reader.execute();
53 System.out.println("Read image: " + argv[0]);
54
55 VectorUInt32 size = image.getSize();
56 System.out.println("Image size: " + size.get(0) + " " + size.get(1));
57 } catch(Exception e) {
58 System.out.println("Read failed: " + e);
59 }
60
61 }
62
63}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected