1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20""" A SimpleITK example demonstrating various image grid manipulation
21 techniques. """
22
23import sys
24import SimpleITK as sitk
25
26if len(sys.argv) < 3:
27 print("Usage: " + sys.argv[0] + " <input-1> <input-2>")
28 sys.exit(1)
29
30
33
34
36joined_image = join.Execute(image_1, image_2)
37
38
40channel1_image = select.Execute(joined_image, 0, sitk.sitkUInt8)
41channel2_image = select.Execute(joined_image, 1, sitk.sitkUInt8)
42channel3_image = select.Execute(joined_image, 2, sitk.sitkUInt8)
43
44
46composed_image = compose.Execute(channel1_image, channel2_image, channel3_image)
47
48
49sliced_image = composed_image[100:400, 100:400, 0]
50
51
53extract.SetSize([300, 300, 0])
54extract.SetIndex([100, 100, 0])
55extracted_image = extract.Execute(composed_image)
56
57
58
59
61crop.SetLowerBoundaryCropSize([100, 100, 0])
62crop.SetUpperBoundaryCropSize(
63 [composed_image.GetWidth() - 400, composed_image.GetHeight() - 400, 1]
64)
65cropped_image = crop.Execute(composed_image)
ComposeImageFilter combine several scalar images into a multicomponent image.
Decrease the image size by cropping the image by an itk::Size at both the upper and lower bounds of t...
Join N-D images into an (N+1)-D image.
Extracts the selected index of the vector that is the input pixel type.
SITKIO_EXPORT Image ReadImage(const PathType &filename, PixelIDValueEnum outputPixelType=sitkUnknown, const std::string &imageIO="")
ReadImage is a procedural interface to the ImageFileReader class which is convenient for most image r...