Add files via upload
This commit is contained in:
parent
7a44748316
commit
7f332a6fa9
2 changed files with 37 additions and 5 deletions
|
@ -2,6 +2,7 @@ import scipy.io as sio # type: ignore
|
||||||
import torch
|
import torch
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
import json
|
||||||
|
|
||||||
from functions.align_cameras import align_cameras
|
from functions.align_cameras import align_cameras
|
||||||
|
|
||||||
|
@ -16,11 +17,23 @@ if __name__ == "__main__":
|
||||||
dtype: torch.dtype = torch.float32
|
dtype: torch.dtype = torch.float32
|
||||||
|
|
||||||
filename_raw_json: str = "raw/Exp001_Trial001_Part001_meta.txt"
|
filename_raw_json: str = "raw/Exp001_Trial001_Part001_meta.txt"
|
||||||
filename_bin_mat: str = "bin_old/Exp001_Trial001_Part001.mat"
|
filename_data_binning_replace: str = "bin_old/Exp001_Trial001_Part001.mat"
|
||||||
batch_size: int = 200
|
batch_size: int = 200
|
||||||
|
|
||||||
filename_aligned_mat: str = "aligned_old/Exp001_Trial001_Part001.mat"
|
filename_aligned_mat: str = "aligned_old/Exp001_Trial001_Part001.mat"
|
||||||
|
|
||||||
|
with open(filename_raw_json, "r") as file_handle:
|
||||||
|
metadata: dict = json.load(file_handle)
|
||||||
|
channels: list[str] = metadata["channelKey"]
|
||||||
|
|
||||||
|
data = torch.tensor(
|
||||||
|
sio.loadmat(filename_data_binning_replace)["nparray"].astype(np.float32),
|
||||||
|
dtype=dtype,
|
||||||
|
device=device,
|
||||||
|
)
|
||||||
|
|
||||||
|
ref_image = data[:, :, data.shape[-2] // 2, :].clone()
|
||||||
|
|
||||||
(
|
(
|
||||||
acceptor,
|
acceptor,
|
||||||
donor,
|
donor,
|
||||||
|
@ -31,13 +44,15 @@ if __name__ == "__main__":
|
||||||
angle_refref,
|
angle_refref,
|
||||||
tvec_refref,
|
tvec_refref,
|
||||||
) = align_cameras(
|
) = align_cameras(
|
||||||
filename_raw_json=filename_raw_json,
|
channels=channels,
|
||||||
filename_bin_mat=filename_bin_mat,
|
data=data,
|
||||||
|
ref_image=ref_image,
|
||||||
device=device,
|
device=device,
|
||||||
dtype=dtype,
|
dtype=dtype,
|
||||||
batch_size=batch_size,
|
batch_size=batch_size,
|
||||||
fill_value=-1,
|
fill_value=-1,
|
||||||
)
|
)
|
||||||
|
del data
|
||||||
|
|
||||||
mat_data = torch.tensor(
|
mat_data = torch.tensor(
|
||||||
sio.loadmat(filename_aligned_mat)["data"].astype(dtype=np.float32),
|
sio.loadmat(filename_aligned_mat)["data"].astype(dtype=np.float32),
|
||||||
|
|
|
@ -3,6 +3,7 @@ import torchvision as tv # type: ignore
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import scipy.io as sio # type: ignore
|
import scipy.io as sio # type: ignore
|
||||||
|
import json
|
||||||
|
|
||||||
from functions.align_cameras import align_cameras
|
from functions.align_cameras import align_cameras
|
||||||
|
|
||||||
|
@ -143,6 +144,19 @@ sio.savemat(filename_bin_mat_fake, mdic)
|
||||||
batch_size: int = 200
|
batch_size: int = 200
|
||||||
filename_raw_json: str = "raw/Exp001_Trial001_Part001_meta.txt"
|
filename_raw_json: str = "raw/Exp001_Trial001_Part001_meta.txt"
|
||||||
|
|
||||||
|
with open(filename_raw_json, "r") as file_handle:
|
||||||
|
metadata: dict = json.load(file_handle)
|
||||||
|
channels: list[str] = metadata["channelKey"]
|
||||||
|
|
||||||
|
|
||||||
|
data = torch.tensor(
|
||||||
|
sio.loadmat(filename_bin_mat_fake)["nparray"].astype(np.float32),
|
||||||
|
dtype=dtype,
|
||||||
|
device=device,
|
||||||
|
)
|
||||||
|
|
||||||
|
ref_image = data[:, :, data.shape[-2] // 2, :].clone()
|
||||||
|
|
||||||
(
|
(
|
||||||
acceptor,
|
acceptor,
|
||||||
donor,
|
donor,
|
||||||
|
@ -153,13 +167,16 @@ filename_raw_json: str = "raw/Exp001_Trial001_Part001_meta.txt"
|
||||||
angle_refref,
|
angle_refref,
|
||||||
tvec_refref,
|
tvec_refref,
|
||||||
) = align_cameras(
|
) = align_cameras(
|
||||||
filename_raw_json=filename_raw_json,
|
channels=channels,
|
||||||
filename_bin_mat=filename_bin_mat_fake,
|
data=data,
|
||||||
|
ref_image=ref_image,
|
||||||
device=device,
|
device=device,
|
||||||
dtype=dtype,
|
dtype=dtype,
|
||||||
batch_size=batch_size,
|
batch_size=batch_size,
|
||||||
fill_value=-1,
|
fill_value=-1,
|
||||||
)
|
)
|
||||||
|
del data
|
||||||
|
|
||||||
|
|
||||||
print("References Acceptor <-> Donor:")
|
print("References Acceptor <-> Donor:")
|
||||||
print("Rotation:")
|
print("Rotation:")
|
||||||
|
|
Loading…
Reference in a new issue