Add files via upload

This commit is contained in:
David Rotermund 2024-05-24 17:15:41 +02:00 committed by GitHub
parent d6839094f8
commit 25efb8b341
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View file

@ -83,7 +83,8 @@ def main(*, config_filename: str = "config.json") -> None:
display_image = np.nan_to_num(display_image, nan=1.0) display_image = np.nan_to_num(display_image, nan=1.0)
value_sort = np.sort(image_var.flatten()) value_sort = np.sort(image_var.flatten())
value_sort_max = value_sort[int(value_sort.shape[0] * 0.95)] value_sort_max = value_sort[int(value_sort.shape[0] * 0.95)] * 3
print(value_sort_max)
mylogger.info("-==- DONE -==-") mylogger.info("-==- DONE -==-")
mylogger.info("Create figure") mylogger.info("Create figure")

View file

@ -32,6 +32,7 @@ def main(*, config_filename: str = "config.json") -> None:
path: str = config["ref_image_path"] path: str = config["ref_image_path"]
use_channel: str = "donor" use_channel: str = "donor"
padding: int = 20
image_ref_file: str = os.path.join(path, use_channel + ".npy") image_ref_file: str = os.path.join(path, use_channel + ".npy")
heartbeat_mask_file: str = os.path.join(path, "heartbeat_mask.npy") heartbeat_mask_file: str = os.path.join(path, "heartbeat_mask.npy")
@ -40,9 +41,11 @@ def main(*, config_filename: str = "config.json") -> None:
mylogger.info(f"loading image reference file: {image_ref_file}") mylogger.info(f"loading image reference file: {image_ref_file}")
image_ref: np.ndarray = np.load(image_ref_file) image_ref: np.ndarray = np.load(image_ref_file)
image_ref /= image_ref.max() image_ref /= image_ref.max()
image_ref = np.pad(image_ref, pad_width=padding)
mylogger.info(f"loading heartbeat mask: {heartbeat_mask_file}") mylogger.info(f"loading heartbeat mask: {heartbeat_mask_file}")
mask: np.ndarray = np.load(heartbeat_mask_file) mask: np.ndarray = np.load(heartbeat_mask_file)
mask = np.pad(mask, pad_width=padding)
image_3color = np.concatenate( image_3color = np.concatenate(
( (
@ -68,6 +71,7 @@ def main(*, config_filename: str = "config.json") -> None:
nonlocal mask nonlocal mask
mylogger.info(f"Save mask to: {refined_mask_file}") mylogger.info(f"Save mask to: {refined_mask_file}")
mask = mask[padding:-padding, padding:-padding]
np.save(refined_mask_file, mask) np.save(refined_mask_file, mask)
exit() exit()
@ -88,7 +92,7 @@ def main(*, config_filename: str = "config.json") -> None:
"A ROI with the following coordiantes has been added to the mask" "A ROI with the following coordiantes has been added to the mask"
) )
for i in range(0, len(new_roi.x)): for i in range(0, len(new_roi.x)):
mylogger.info(f"{round(new_roi.x[i],1)} x {round(new_roi.y[i],1)}") mylogger.info(f"{round(new_roi.x[i], 1)} x {round(new_roi.y[i], 1)}")
mylogger.info("") mylogger.info("")
new_mask = new_roi.get_mask(display_image[:, :, 0]) new_mask = new_roi.get_mask(display_image[:, :, 0])
mask[new_mask] = 0.0 mask[new_mask] = 0.0
@ -110,7 +114,7 @@ def main(*, config_filename: str = "config.json") -> None:
"A ROI with the following coordiantes has been removed from the mask" "A ROI with the following coordiantes has been removed from the mask"
) )
for i in range(0, len(new_roi.x)): for i in range(0, len(new_roi.x)):
mylogger.info(f"{round(new_roi.x[i],1)} x {round(new_roi.y[i],1)}") mylogger.info(f"{round(new_roi.x[i], 1)} x {round(new_roi.y[i], 1)}")
mylogger.info("") mylogger.info("")
new_mask = new_roi.get_mask(display_image[:, :, 0]) new_mask = new_roi.get_mask(display_image[:, :, 0])
mask[new_mask] = 1.0 mask[new_mask] = 1.0