Exemple #1
0
 def getInputImage(self, imagename):
     return util.loadImage(self.pathInput + imagename)
Exemple #2
0
 def getExpectedOutput(self, testname):
     self.testname = testname
     return util.loadImage(self.pathExpectOutput + self.testname + '.png')
Exemple #3
0
# Use this file as you wish to generate the images needed to answer the report

import src.project.Utilities as util
import numpy as np
import src.project.SelectiveImageAcquisition as sia

image = util.loadImage('images/brain.png')
rows, cols = image.shape
print(image.shape)
# code for cardiac cartesian
# mask = sia.cartesianPattern((rows, cols), 0.7)
mask = sia.circlePattern((rows, cols), 90)

shift_fft = util.getDFT(image)
filtered_image_fft = np.multiply(mask, shift_fft)
filtered_image = util.post_process_images(util.getImage(filtered_image_fft))

util.displayImage(filtered_image)

Exemple #4
0
# Use this file as you wish to generate the images needed to answer the report

import src.project.Utilities as util
import src.project.ImageSynthesisNoise as isn

heart = "images/cardiac.jpg"
brain = "images/brain.png"
matrix = "images/noisyimage.npy"

##############  Utilities   ###################
img = util.loadImage(heart)
img2 = util.loadImage(brain)
img3 = util.loadMatrix(matrix)
# util.displayImage(img)
# util.displayImage(img2)
#util.displayImage(img)
h = img.shape[0]
w = img.shape[1]
h1 = img2.shape[0]
w1 = img2.shape[1]

w2 = img3.shape[1]
h2 = img3.shape[0]

print(h2)
print(w2)

mask_size = (h, w)
mask_size2 = (h1, w1)

#img_copy = util.getDFT(img2)
Exemple #5
0
 def test_loadImage_jpg(self):
     expected = self.setup.getExpectedOutput(self._testMethodName)
     self.actual = util.loadImage("resources/inputs/test_loadImage.jpg")
     self.assertTrue(self.setup.imagesEqual(expected, self.actual))
import cv2
import numpy as np

import src.project.SelectiveImageAcquisition as aqc
import src.project.Utilities as util

cardiac = util.loadImage("images/cardiac.jpg")
normal_cardiac = util.normalizeImage(cardiac)
dft_cardiac = util.getDFT(normal_cardiac)
write_dft = util.writableDFT(dft_cardiac)
util.saveMatrix("Cardiac_DFT.jpg", write_dft)
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)
#util.saveMatrix("Brain_DFT.jpg", dft_brain)
height, width = brain.shape
brain_size = np.array([height, width])

p1mask = aqc.bandPattern(cardiac_size, 15, 128, 35)
p1fmask = util.post_process_image(p1mask)
util.saveImage("p1fmask.jpg", p1fmask)
p1applied = util.applyMask(dft_cardiac, p1mask)
p1image = util.getImage(p1applied)
p1fimage = util.post_process_image(p1image)
util.saveImage('p1_Masked_Image.jpg', p1fimage)

p2mask1 = aqc.bandPattern(cardiac_size, 15, 128, 10)
p2applied1 = util.applyMask(dft_cardiac, p2mask1)