MCPcopy Create free account
hub / github.com/SimpleITK/SimpleITK / main

Function main

Examples/SimpleGaussian/SimpleGaussian.cxx:29–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27namespace sitk = itk::simple;
28
29int
30main(int argc, char * argv[])
31{
32
33 if (argc < 4)
34 {
35 std::cerr << "Usage: " << argv[0] << " <input> <sigma> <output>\n";
36 return 1;
37 }
38
39 // Read the image file
40 sitk::ImageFileReader reader;
41 reader.SetFileName(std::string(argv[1]));
42 sitk::Image image = reader.Execute();
43
44 // This filters perform a gaussian blurring with sigma in physical
45 // space. The output image will be of real type.
46 sitk::SmoothingRecursiveGaussianImageFilter gaussian;
47 gaussian.SetSigma(atof(argv[2]));
48 sitk::Image blurredImage = gaussian.Execute(image);
49
50 // Covert the real output image back to the original pixel type, to
51 // make writing easier, as many file formats don't support real
52 // pixels.
53 sitk::CastImageFilter caster;
54 caster.SetOutputPixelType(image.GetPixelID());
55 sitk::Image outputImage = caster.Execute(blurredImage);
56
57 // write the image
58 sitk::ImageFileWriter writer;
59 writer.SetFileName(std::string(argv[3]));
60 writer.Execute(outputImage);
61
62 return 0;
63}

Callers

nothing calls this directly

Calls 4

SetFileNameMethod · 0.45
ExecuteMethod · 0.45
SetOutputPixelTypeMethod · 0.45
GetPixelIDMethod · 0.45

Tested by

no test coverage detected