This commit is contained in:
2026-01-05 08:59:36 +02:00
parent e98d287b8a
commit 395d263900
4 changed files with 30 additions and 29 deletions

View File

@@ -18,7 +18,13 @@ class UT:
self.rois = None
if no_labels:
self.rois = ImagejRoi.fromfile(self.roifile_fn)
self.stem = self.roifile_fn.stem.split("Roi-")[1]
print(self.roifile_fn.stem)
print(self.roifile_fn.parent.parts[-1])
if "Roi-" in self.roifile_fn.stem:
self.stem = self.roifile_fn.stem.split("Roi-")[1]
else:
self.stem = self.roifile_fn.parent.parts[-1]
else:
self.roifile_fn = roifile_fn / roifile_fn.parts[-1]
self.stem = self.roifile_fn.stem
@@ -95,9 +101,7 @@ class UT:
for i, roi in enumerate(self.rois):
rc = roi.subpixel_coordinates
if rc is None:
print(
f"No coordinates: {self.roifile_fn}, element {i}, out of {len(self.rois)}"
)
print(f"No coordinates: {self.roifile_fn}, element {i}, out of {len(self.rois)}")
continue
xmn, ymn = rc.min(axis=0)
xmx, ymx = rc.max(axis=0)
@@ -143,6 +147,9 @@ if __name__ == "__main__":
)
args = parser.parse_args()
# print(args)
# aa
for path in args.input:
print("Path:", path)
if not args.no_labels:
@@ -152,6 +159,7 @@ if __name__ == "__main__":
else:
for rfn in Path(path).glob("*.zip"):
# if Path(path).suffix == ".zip":
print("Roi FN:", rfn)
ut = UT(rfn, args.no_labels)
ut.export_rois(args.output, class_index=0)