File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
src/Filtering/Smoothing/SmoothImageWithDiscreteGaussianFilter Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ import itk
2
+ import argparse
3
+
4
+ parser = argparse .ArgumentParser (description = "Filtering Of An Image with DiscreteGaussianFilter" )
5
+ parser .add_argument ("input_image" )
6
+ parser .add_argument ("variance" , type = float )
7
+ args = parser .parse_args ()
8
+
9
+ PixelType = itk .F
10
+
11
+ # Read Image in float data type
12
+ inputImage = itk .imread (args .input_image , PixelType )
13
+
14
+ # Check some information from the inputImage
15
+ print ('Shape ' , inputImage .shape )
16
+ print ('dtype is ' , inputImage .dtype )
17
+ print ('type is ' , type (inputImage ))
18
+
19
+ variance = args .variance
20
+ filteredImage = itk .discrete_gaussian_image_filter (inputImage , variance = variance )
21
+
22
+ # Check some information from the filteredImage
23
+ print ('Shape ' , filteredImage .shape )
24
+ print ('dtype is ' , filteredImage .dtype )
25
+ print ('type is ' , type (filteredImage ))
26
+
27
+ # Visualize the result using matplotlib
28
+ import matplotlib .pyplot as plt
29
+ plt .imshow (filteredImage )
30
+ plt .show ()
You can’t perform that action at this time.
0 commit comments