using System;
namespace itk.simple.examples {
class SimpleGaussian {
static void Main(string[] args) {
try {
if (args.Length < 3) {
Console.WriteLine("Usage: SimpleGaussian <input> <sigma> <output>");
return;
}
ImageFileReader reader = new ImageFileReader();
reader.SetFileName(args[0]);
Image image = reader.Execute();
SmoothingRecursiveGaussianImageFilter gaussian = new SmoothingRecursiveGaussianImageFilter();
gaussian.SetSigma(Double.Parse(args[1]));
Image blurredImage = gaussian.Execute(image);
CastImageFilter castFilter = new CastImageFilter();
castFilter.SetOutputPixelType(image.GetPixelID());
Image destImage = castFilter.Execute(blurredImage);
ImageFileWriter writer = new ImageFileWriter();
writer.SetFileName(args[2]);
writer.Execute(destImage);
} catch (Exception ex) {
Console.WriteLine(ex);
}
}
}
}