Exemple #1
0
"""

import dataOp
import metrics
import customLayers as cl
import helperFunctions as hf

import numpy as np
import pandas as pd
import tensorflow as tf

from tqdm import tqdm
from tensorflow.keras import layers, models, losses
import matplotlib.pyplot as plt

dVal = dataOp.data_loader("C:/Datasets/MRI_Data/Recon_v4/Val", 8, 4, 10, False)
dTrain = dataOp.data_loader("C:/Datasets/MRI_Data/Recon_v4/Train", 8, 4, 10,
                            False)

dL = dataOp.data_loader("C:/Datasets/MRI_Data/Recon_v4/Val", 1, 4, 10, False)
d = dL.__getitem__(200)

dIn = layers.Input(shape=(256, 256, 2))
mIn = layers.Input(shape=(256, 256, 2))
mul = cl.mulBlock()([dIn, mIn])

# Dumbell Image Domain
ifft = cl.ifftBlock()(mul)
dumbell = cl.dumbellXL()(ifft)

fft = cl.fftBlock()(dumbell)
Exemple #2
0
custom_objects = {
    "mulBlock": cl.mulBlock,
    "ifftBlock": cl.ifftBlock,
    "dumbellXL": cl.dumbellXL,
    "fftBlock": cl.fftBlock,
    "conBlock": cl.conBlock,
    "resBlock": cl.resBlock,
    "PSNR_loss": metrics.PSNR_loss,
    "image_gradient_loss": metrics.image_gradient_loss,
    "SSIM_loss": metrics.SSIM_loss
}

model = models.load_model("RCC_DumbellXL_4x_MSE.h5",
                          custom_objects=custom_objects)

dL = dataOp.data_loader("C:/Datasets/MRI_Data/Recon_v4/Val", 1, 4, 10, False)
d = dL.__getitem__(200)

img_dict, stat_dict = hf.getStats(model, d)
print(stat_dict)
hf.gen_comparison_graph(img_dict)


def soloImg(out):
    out = np.reshape(out, (256, 256, 2))
    out = out[:, :, 0] + 1j * out[:, :, 1]

    plt.figure()
    plt.subplot(1, 2, 1)
    plt.imshow(np.abs(out), cmap='gray')
    plt.title('Magnitude')