Skip to content
Snippets Groups Projects
Commit 2dfd9037 authored by Christopher Randolph Rhodes's avatar Christopher Randolph Rhodes
Browse files

Reformatted data embedding assertion, track axis tags in model object

parent 060f6991
No related branches found
No related tags found
3 merge requests!37Release 2024.04.19,!34Revert "Temporary error-handling for debug...",!29Dev multichannel classifiers
......@@ -36,6 +36,7 @@ class IlastikModel(Model):
raise ParameterExpectedError('Ilastik model expects a project (*.ilp) file')
self.shell = None
self.axes = None
super().__init__(autoload, params)
def load(self):
......@@ -53,18 +54,20 @@ class IlastikModel(Model):
shell = app.main(args, init_logging=False)
# validate if inputs are embedded in project file
input_groups = shell.projectManager.currentProjectFile['Input Data']['infos']
lanes = input_groups.keys()
for ll in lanes:
input_types = input_groups[ll]
for tt in input_types:
ds_loc = input_groups[ll][tt].get('location', False)
if self.enforce_embedded and ds_loc and ds_loc[()] == b'FileSystem':
h5 = shell.projectManager.currentProjectFile
for lane in h5['Input Data/infos'].keys():
for role in h5[f'Input Data/infos/{lane}'].keys():
grp = h5[f'Input Data/infos/{lane}/{role}']
if self.enforce_embedded and ('location' in grp.keys()) and grp['location'][()] != b'ProjectInternal':
raise IlastikInputEmbedding('Cannot load ilastik project file where inputs are on filesystem')
assert True
if not isinstance(shell.workflow, self.get_workflow()):
raise ParameterExpectedError(
f'Ilastik project file {self.project_file} does not describe an instance of {shell.workflow.__class__}'
)
self.axes = [
a['key'].upper() for a in json.loads(h5[f'Input Data/infos/lane0000/Raw Data/axistags'][()])['axes']
]
self.shell = shell
return True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment