20 """ A SimpleITK example demonstrating various image grid manipulation
24 import SimpleITK
as sitk
27 print(
"Usage: " + sys.argv[0] +
" <input-1> <input-2>")
36 joined_image = join.Execute(image_1, image_2)
40 channel1_image = select.Execute(joined_image, 0, sitk.sitkUInt8)
41 channel2_image = select.Execute(joined_image, 1, sitk.sitkUInt8)
42 channel3_image = select.Execute(joined_image, 2, sitk.sitkUInt8)
46 composed_image = compose.Execute(channel1_image, channel2_image, channel3_image)
49 sliced_image = composed_image[100:400, 100:400, 0]
53 extract.SetSize([300, 300, 0])
54 extract.SetIndex([100, 100, 0])
55 extracted_image = extract.Execute(composed_image)
61 crop.SetLowerBoundaryCropSize([100, 100, 0])
62 crop.SetUpperBoundaryCropSize(
63 [composed_image.GetWidth() - 400, composed_image.GetHeight() - 400, 1]
65 cropped_image = crop.Execute(composed_image)