1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21""" Apply SimpleITK's SmoothGaussianImageFilter to an image. """
22
23import os
24import sys
25import SimpleITK as sitk
26
27
28def main(args):
29 """ Apply SimpleITK's SmoothGaussianImageFilter to an image. """
30 if len(args) < 4:
31 print("Usage: SimpleGaussian <input> <sigma> <output>")
32 sys.exit(1)
33
35 reader.SetFileName(args[1])
36 input_image = reader.Execute()
37
38 pixelID = input_image.GetPixelID()
39
41 gaussian.SetSigma(float(args[2]))
42 blur_image = gaussian.Execute(input_image)
43
45 caster.SetOutputPixelType(pixelID)
46 blur_image = caster.Execute(blur_image)
47
49 writer.SetFileName(args[3])
50 writer.Execute(blur_image)
51
52 return_dict = {"input_image": input_image, "blur_image": blur_image}
53 return return_dict
54
55
56
57if __name__ == "__main__":
58 in_image, out_image = main(sys.argv)
59 if "SITK_NOSHOW" not in os.environ:
A hybrid cast image filter to convert images to other types of images.
Read an image file and return a SimpleITK Image.
Write out a SimpleITK image to the specified file location.
Computes the smoothing of an image by convolution with the Gaussian kernels implemented as IIR filter...
void SITKIO_EXPORT Show(const Image &image, const std::string &title="", const bool debugOn=ProcessObject::GetGlobalDefaultDebug())