| 27 | namespace sitk = itk::simple; |
| 28 | |
| 29 | int |
| 30 | main(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 | } |
nothing calls this directly
no test coverage detected