1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20""" A SimpleITK 'Hello World' example. """
21
22import os
23import sys
24import SimpleITK as sitk
25
26
27def main(_):
28 """ Generate a simple image and display it using the SimpleITK Show function. """
29
30 pixelType = sitk.sitkUInt8
31 imageSize = [128, 128]
33
34
35 faceSize = [64, 64]
36 faceCenter = [64, 64]
38
39
40 eyeSize = [5, 5]
41 eye1Center = [48, 48]
42 eye2Center = [80, 48]
45
46
47 face = face - eye1 - eye2
49
50
51 mouthRadii = [30, 20]
52 mouthCenter = [64, 76]
55 200,
56 255,
57 255,
58 )
59
60 mouthSize = [64, 18]
61 mouthLoc = [32, 76]
62 face =
sitk.Paste(face, mouth, mouthSize, mouthLoc, mouthLoc)
63
64
65 image = image + face
66 return {"output_image": image}
67
68
69
70if __name__ == "__main__":
71 img = main(sys.argv)
72 if "SITK_NOSHOW" not in os.environ:
73 sitk.Show(img, title=
"Hello World: Python", debugOn=
True)
The Image class for SimpleITK.
Image GaussianSource(PixelIDValueEnum outputPixelType=itk::simple::sitkFloat32, std::vector< unsigned int > size=std::vector< unsigned int >(3, 64), std::vector< double > sigma=std::vector< double >(3, 16.0), std::vector< double > mean=std::vector< double >(3, 32.0), double scale=255, std::vector< double > origin=std::vector< double >(3, 0.0), std::vector< double > spacing=std::vector< double >(3, 1.0), std::vector< double > direction=std::vector< double >(), bool normalized=false)
Generate an n-dimensional image of a Gaussian.
Image Paste(Image &&destinationImage, const Image &sourceImage, std::vector< unsigned int > sourceSize=std::vector< unsigned int >(SITK_MAX_DIMENSION, 1), std::vector< int > sourceIndex=std::vector< int >(SITK_MAX_DIMENSION, 0), std::vector< int > destinationIndex=std::vector< int >(SITK_MAX_DIMENSION, 0), std::vector< bool > DestinationSkipAxes=std::vector< bool >())
Paste an image into another image.
void SITKIO_EXPORT Show(const Image &image, const std::string &title="", const bool debugOn=ProcessObject::GetGlobalDefaultDebug())
Image BinaryThreshold(Image &&image1, double lowerThreshold=0.0, double upperThreshold=255.0, uint8_t insideValue=1u, uint8_t outsideValue=0u)
Binarize an input image by thresholding.