使い方 DermAnnotationで作成されたTIFF画像を開き,各フレームのラベルを取得 from derm_tiff import load_image derm_image = load_image("example/imgs/input.tiff") labels = derm_image.labels print(labels) # ['Pencil1', 'Pencil2', 'Pencil3'] DermTiffImageの新規作成 assert isinstance(bg_image, NDArray[Shape["*, *, 3"], np.uint8]) H, W, C = bg_image.shape empty_derm_image = DermTiffImage(bg_image=bg_image) new_derm_image = DermTiffImage(bg_image=bg_image, label2mask={"page1": np.zeros((H, W), np.bool_)}, label2color={"page1": (255, 0, 255)}) TIFF画像の各フレームのマスクを合成して出力 for label in labels: pil_img = derm_image.get_annotation_image([label], alpha=0.5) pil_img.show() 新たにフレームを追加 import numpy as np H, W, _ = derm_image.shape new_label = "new label" new_mask = np.random.randint(0, 2, (H, W), dtype=np.bool_) new_color = (255, 255, 0) derm_image.add_frame(new_label, new_mask, new_color) DermAnnotationで開けるTIFF形式で保存 derm_image.save("example/imgs/output.tiff") 全体でリサイズも可能 resized = derm_image.resize(300, 200)