using MAT: matopen
using NPZ: npzread

scale_factor_act = 1e5
scale_factor_den = 1e-2
scale_factor_dose = 1e6
T = Float32

path = "../data/petvp6/"
file = matopen(path*"petvp6-mumap-208.mat")
mumap = read(file, "mumap208")
mumap = T.(mumap)
close(file)

file = matopen(path*"petvp6-psf-208.mat")
psfs = read(file, "psf_208")
psfs = T.(psfs)
close(file)

file = matopen(path*"petvp6-density-128.mat")
density = read(file, "density")
density = max.(density, 1) # minimum density = 1
density = T.(density * scale_factor_den) # keep things in similar range
close(file)

file = matopen(path*"petvp6-doseGT-128.mat")
doseGT = read(file, "doseGT")
doseGT = T.(doseGT * scale_factor_dose)
close(file)

# file = matopen(path*"doseDVK_128.mat")
# doseDVK = read(file, "DVK")
# doseDVK = T.(doseDVK * scale_factor_dose)
# close(file)

file = matopen(path*"petvp6-xinit-128.mat")
xinit = read(file, "xinit")
xinit = T.(xinit / sum(xinit) * scale_factor_act)
close(file)

file = matopen(path*"petvp6-recon-16th.mat")
xrecon16 = read(file, "x")
xrecon16 = T.(xrecon16 / sum(xrecon16) * scale_factor_act)
close(file)

file = matopen(path*"petvp6-xtrue-128.mat")
xtrue = read(file, "xtrue")
xtrue = T.(xtrue / sum(xtrue) * scale_factor_act)
close(file)

file = matopen(path*"petvp6-yi-128.mat")
yi = read(file, "yi")
yi = T.(yi)
close(file)

file = matopen(path*"petvp6-ri-128.mat")
ri = read(file, "ri")
ri = T.(ri)
close(file)

fullkernel = npzread("../data/fullkernel.npy") # kernels are in 257x257x161
