|
44 | 44 | row1 = centery - v0 |
45 | 45 | row2 = centery + v0 + 1 |
46 | 46 | listx = np.arange(width1) - centerx |
47 | | - |
48 | | -print(np.arange(width1)) |
49 | | -print(listx) |
50 | | -print(listx / u0) |
51 | | - |
52 | 47 | filtershape = 1.0 / (1.0 + np.power(listx / u0, 2 * n)) |
53 | 48 | filtershapepad2d = np.zeros((row2 - row1, filtershape.size)) |
54 | 49 | filtershapepad2d[:] = np.float64(filtershape) |
55 | 50 | filtercomplex = filtershapepad2d + filtershapepad2d * 1j |
56 | 51 |
|
57 | | -print("Centery: ", centery, "Row1: ", row1, "Row2: ", row2) |
58 | | - |
59 | | -# plt.figure() |
60 | | -# plt.imshow(filtercomplex.real) |
61 | | -# plt.title("Uncorrected image") |
62 | | -# plt.show() |
63 | | - |
64 | 52 | # Generate filter objects |
65 | 53 | a = pyfftw.empty_aligned((height1, width1), dtype='complex128', n=16) |
66 | 54 | b = pyfftw.empty_aligned((height1, width1), dtype='complex128', n=16) |
|
73 | 61 | sino[row1:row2] = sino[row1:row2] * filtercomplex |
74 | 62 | sino = ifft_object(fft.ifftshift(sino)) |
75 | 63 |
|
76 | | -plt.figure() |
77 | | - |
78 | 64 | #subplot(r,c) provide the no. of rows and columns |
79 | 65 | f, axarr = plt.subplots(2,2) |
80 | 66 |
|
81 | 67 | # use the created array to output your multiple images. In this case I have stacked 4 images vertically |
82 | 68 | axarr[0, 0].imshow(sinogram_padded) |
| 69 | +axarr[0, 0].set_title('Original sinogram') |
83 | 70 | axarr[0, 1].imshow(sinogram_padded - sinogram_gpu_filter.get().real) |
| 71 | +axarr[0, 1].set_title('Difference of original and GPU filtered') |
84 | 72 | axarr[1, 0].imshow(sinogram_padded - sino.real) |
| 73 | +axarr[1, 0].set_title('Difference of original and CPU filtered') |
85 | 74 | axarr[1, 1].imshow(sinogram_gpu_filter.get().real - sino.real) |
| 75 | +axarr[1, 1].set_title('Difference of GPU and CPU filtered') |
86 | 76 |
|
87 | 77 | plt.show() |
88 | 78 |
|
0 commit comments