|
|
@ -59,22 +59,12 @@ def annotate_one_color_coded_image( |
|
|
|
path.unlink() |
|
|
|
path.unlink() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def sort_cut_images(file_stems, parameters): |
|
|
|
def rename_cut_images(file_stems, parameters): |
|
|
|
for path in tqdm(list(parameters.cuts_dir.iterdir())): |
|
|
|
for path in tqdm(list(parameters.cuts_dir.iterdir())): |
|
|
|
if not path.stem.startswith("."): |
|
|
|
if not path.stem.startswith("."): |
|
|
|
label = ( |
|
|
|
label = ( |
|
|
|
LABEL_SELECTED if path.stem in file_stems else LABEL_DISCARDED |
|
|
|
LABEL_SELECTED if path.stem in file_stems else LABEL_DISCARDED |
|
|
|
) |
|
|
|
) |
|
|
|
new_path = ( |
|
|
|
new_path = path.with_name(f"{path.stem}_cut_{label}{path.suffix}") |
|
|
|
parameters[f"cuts_{label}_dir"] |
|
|
|
path.rename(new_path) |
|
|
|
/ f"{path.stem}_cut_{label}{path.suffix}" |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
path.rename(new_path) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def remove_cuts_dir(parameters): |
|
|
|
|
|
|
|
cuts_dir = parameters["cuts_dir"] |
|
|
|
|
|
|
|
if cuts_dir.is_dir(): |
|
|
|
|
|
|
|
for item in cuts_dir.iterdir(): |
|
|
|
|
|
|
|
item.unlink() |
|
|
|
|
|
|
|
parameters["cuts_dir"].rmdir() |
|
|
|
|
|
|
|