20 """ A SimpleITK example demonstrating how to explicitly select a specific
21 IO for image reading. """
24 import SimpleITK
as sitk
27 print(
"Wrong number of arguments.", file=sys.stderr)
28 print(
"Usage: " + __file__ +
" image_file_name", file=sys.stderr)
33 image_ios_tuple = file_reader.GetRegisteredImageIOs()
34 print(
"The supported image IOs are: " + str(image_ios_tuple))
44 file_reader.SetImageIO(
"PNGImageIO")
45 file_reader.SetFileName(sys.argv[1])
47 image = file_reader.Execute()
48 print(
"Read image: " + sys.argv[1])
50 size = image.GetSize()
51 print(
"Image size:", size[0], size[1])
52 except IOError
as err:
53 print(
"Reading failed: ", err)