diff --git a/src/Filtering/Smoothing/SmoothImageWithDiscreteGaussianFilter/Code.py b/src/Filtering/Smoothing/SmoothImageWithDiscreteGaussianFilter/Code.py new file mode 100755 index 000000000..e3f5b5cfc --- /dev/null +++ b/src/Filtering/Smoothing/SmoothImageWithDiscreteGaussianFilter/Code.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +# Copyright NumFOCUS +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import itk +import argparse + +parser = argparse.ArgumentParser( + description="Smoothing Image With Discrete Gaussian Filter." +) +parser.add_argument("input_image") +parser.add_argument("output_image") +parser.add_argument("sigma", type=float) +args = parser.parse_args() + +image = itk.imread(args.input_image) + +smooth_image = itk.discrete_gaussian_image_filter(image, sigma=args.sigma) + +itk.imwrite(smooth_image, args.output_image) diff --git a/src/Filtering/Smoothing/SmoothImageWithDiscreteGaussianFilter/Documentation.rst b/src/Filtering/Smoothing/SmoothImageWithDiscreteGaussianFilter/Documentation.rst index 8ed28e370..185094516 100644 --- a/src/Filtering/Smoothing/SmoothImageWithDiscreteGaussianFilter/Documentation.rst +++ b/src/Filtering/Smoothing/SmoothImageWithDiscreteGaussianFilter/Documentation.rst @@ -28,6 +28,13 @@ Results Code ---- +Python +...... + +.. literalinclude:: Code.py + :language: python + :lines: 1, 16- + C++ ... diff --git a/src/Filtering/Smoothing/SmoothImageWithDiscreteGaussianFilter/SmoothImageWithDiscreteGaussianFilterPython.png.sha512 b/src/Filtering/Smoothing/SmoothImageWithDiscreteGaussianFilter/SmoothImageWithDiscreteGaussianFilterPython.png.sha512 new file mode 100644 index 000000000..e635ffd95 --- /dev/null +++ b/src/Filtering/Smoothing/SmoothImageWithDiscreteGaussianFilter/SmoothImageWithDiscreteGaussianFilterPython.png.sha512 @@ -0,0 +1 @@ +14b645d89824bf4c084f1e9daa88b4049b5ff984d2ce900e9208b442d71c4181a834699e94bd58b78a2ecb45e56e65b863dbea057b744f7aef5550b7a0bf3c8b