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

Changed label in existing project file

parent a7d1a717
No related branches found
No related tags found
No related merge requests found
from pathlib import Path
import h5py
import ilastik.applets.objectClassification
import pandas as pd
from extensions.ilastik.models import IlastikObjectClassifierModel
def transfer_labels_to_ilastik_ilp(ilp, df_stack_meta):
with h5py.File(ilp, 'r+') as h5:
ts = h5['ObjectClassification']['LabelInputs']['0000']
for ti in ts.items():
idx = int(ti[0])
ds = ti[1]
la_old = ds[1]
ds[1] = float(df_stack_meta.loc[df_stack_meta.zi == idx, 'annotation_class_id'].iat[0])
print(f'Changed label {ti} from {la_old} to {ds[1]}')
if __name__ == '__main__':
ilp = 'c:/Users/rhodes/model-server/ilastik/test_automate_obj_labels.ilp'
df = pd.read_csv(
'c:/Users/rhodes/projects/proj0011-plankton-seg/exp0009/output/labeled_patches-20231013-0022/training_stack.csv'
)
transfer_labels_to_ilastik_ilp(ilp, df)
\ No newline at end of file
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