Fixing annotations in database

This commit is contained in:
2026-01-21 08:51:39 +02:00
parent d03ffdc4d0
commit 3c8247b3bc
6 changed files with 589 additions and 17 deletions

View File

@@ -97,7 +97,7 @@ class UT:
class_index: int = 0,
):
"""Export rois to a file"""
with open(path / subfolder / f"{self.stem}.txt", "w") as f:
with open(path / subfolder / f"{PREFIX}-{self.stem}.txt", "w") as f:
for i, roi in enumerate(self.rois):
rc = roi.subpixel_coordinates
if rc is None:
@@ -129,8 +129,8 @@ class UT:
self.image = np.max(self.image[channel], axis=0)
print(self.image.shape)
print(path / subfolder / f"{self.stem}.tif")
with TiffWriter(path / subfolder / f"{self.stem}.tif") as tif:
print(path / subfolder / f"{PREFIX}_{self.stem}.tif")
with TiffWriter(path / subfolder / f"{PREFIX}-{self.stem}.tif") as tif:
tif.write(self.image)
@@ -145,11 +145,19 @@ if __name__ == "__main__":
action="store_false",
help="Source does not have labels, export only images",
)
parser.add_argument("--prefix", help="Prefix for output files")
args = parser.parse_args()
PREFIX = args.prefix
# print(args)
# aa
# for path in args.input:
# print(path)
# ut = UT(path, args.no_labels)
# ut.export_image(args.output, plane_mode="max projection", channel=0)
# ut.export_rois(args.output, class_index=0)
for path in args.input:
print("Path:", path)
if not args.no_labels: