diff --git a/extensions/chaeo/examples/transfer_labels_to_ilastik_object_classifier.py b/extensions/chaeo/examples/transfer_labels_to_ilastik_object_classifier.py index ed4d5f1db00495a491fe7a6a7af7f4d8e95bff98..16a03362da41b1d1ac31f2bae2b4bc4198d6c2f9 100644 --- a/extensions/chaeo/examples/transfer_labels_to_ilastik_object_classifier.py +++ b/extensions/chaeo/examples/transfer_labels_to_ilastik_object_classifier.py @@ -141,11 +141,17 @@ def generate_ilastik_object_classifier(template_ilp, where: str, lane=0): return new_ilp if __name__ == '__main__': + root = Path('c:/Users/rhodes/projects/proj0011-plankton-seg/') + template_ilp = root / 'exp0014/template_obj.ilp' + where_patch_stack = root / 'exp0009/output/labeled_patches-20231016-0002' + new_ilp = generate_ilastik_object_classifier( - 'c:/Users/rhodes/projects/proj0011-plankton-seg/exp0014/template_obj.ilp', - 'c:/Users/rhodes/projects/proj0011-plankton-seg/exp0009/output/labeled_patches-20231016-0002' + template_ilp, + where_patch_stack, ) + train_zstack = generate_file_accessor(where_patch_stack / 'zstack_train_raw.tif') mod = IlastikObjectClassifierModel({'project_file': new_ilp}) + print(mod.project_file_abspath) \ No newline at end of file diff --git a/extensions/ilastik/models.py b/extensions/ilastik/models.py index ddcb0db5d6f4496e70196781d485e4da2ab43257..47c81abb9151da76dfd21b0d6cf3356031a983ef 100644 --- a/extensions/ilastik/models.py +++ b/extensions/ilastik/models.py @@ -14,7 +14,10 @@ class IlastikImageToImageModel(ImageToImageModel): def __init__(self, params, autoload=True): self.project_file = Path(params['project_file']) params['project_file'] = self.project_file.__str__() - pap = extensions.ilastik.conf.paths['project_files'] / self.project_file + if self.project_file.is_absolute(): + pap = self.project_file + else: + pap = extensions.ilastik.conf.paths['project_files'] / self.project_file self.project_file_abspath = pap if not pap.exists(): raise FileNotFoundError(f'Project file does not exist: {pap}')