Skip to content

Commit e8f75f4

Browse files
committed
ENH: Adding python sample for SmoothImageWithDiscreteGaussianFilter
1 parent 6f0e16b commit e8f75f4

File tree

1 file changed

+22
-0
lines changed
  • src/Filtering/Smoothing/SmoothImageWithDiscreteGaussianFilter

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
PixelType = itk.F
2+
3+
# Read Image in float data type
4+
inputImage = itk.imread(inputFileName, PixelType)
5+
6+
# Check some information from the inputImage
7+
print('Shape ', inputImage.shape)
8+
print('dtype is ', inputImage.dtype)
9+
print('type is ', type(inputImage))
10+
11+
variance = 4.0
12+
filteredImage = itk.discrete_gaussian_image_filter(inputImage, variance=variance)
13+
14+
# Check some information from the filteredImage
15+
print('Shape ', filteredImage.shape)
16+
print('dtype is ', filteredImage.dtype)
17+
print('type is ', type(filteredImage))
18+
19+
# Visualize the result using matplotlib
20+
import matplotlib.pyplot as plt
21+
plt.imshow(filteredImage)
22+
plt.show()

0 commit comments

Comments
 (0)