Пример #1
0
normal_cardiac = util.normalizeImage(cardiac)
dft_cardiac = util.getDFT(normal_cardiac)
height, width = cardiac.shape
cardiac_size = np.array([height, width])

brain = util.loadImage("images/brain.png")
normal_brain = util.normalizeImage(brain)
dft_brain = util.getDFT(normal_brain)
height, width = brain.shape
brain_size = np.array([height, width])

cutoff = np.array([5, 20, 45, 60])
order = np.array([1, 2, 3, 4])
for i in cutoff:
    for j in order:
        p6mask = noise.butterworthLowpassFilter(brain_size, i, j)
        p6applied = util.applyMask(dft_brain, p6mask)
        p6image = util.getImage(p6applied)
        p6fimage = util.post_process_image(p6image)
        filename = "p6_Masked_Image_" + str(i) + "_" + str(j) + ".jpg"
        snr_p6 = util.signalToNoise(brain, p6fimage)
        print(filename, snr_p6)
        util.saveImage(filename, p6fimage)

glhp = np.array([200, 40, 120, 10])
for k in glhp:
    p7lmask = noise.gaussianLowpassFilter(brain_size, k)
    p7lapplied = util.applyMask(dft_brain, p7lmask)
    p7limage = util.getImage(p7lapplied)
    p7lfimage = util.post_process_image(p7limage)
    filename = "p7_GLP_Masked_Image_" + str(k) + ".jpg"
 def test_butterworthLowpassFilter_high_width_high_order(self):
     expected = self.setup.getExpectedOutput(self._testMethodName)
     self.actual = noise.butterworthLowpassFilter(self.emptymask, 50, 3)
     self.actual = self.setup.normalizeImage(self.actual)
     self.assertTrue(self.setup.imagesEqual(expected, self.actual))