-
Notifications
You must be signed in to change notification settings - Fork 17
Description
Dear Sirs,
Thank you for developing steinbock,which is a wonderful package used for IMC image processing.
However,when trying to run your sample program:
` steinbock classify ilastik prepare --cropsize 500 --seed 123
rm pixel_classifier.ilp && mv IMCWorkflow.ilp pixel_classifier.ilp
rm -r ilastik_crops && mv analysis/crops ilastik_crops
steinbock classify ilastik fix --no-backup
I met the following problem:
Traceback (most recent call last):
File "D:\python\IMCprocess\imc_classification_cmd.py", line 45, in
ilastik_fix("analysis/official_classification.ilp","analysis/official_cropped","analysis/classification_result")
File "D:\python\IMCprocess\imc_classification_cmd.py", line 41, in ilastik_fix
ilastik.fix_ilastik_project_file_inplace(project_file,crop_img_dir,output_dir,ilastik_crop_shapes,last_transpose_axes,)
File "E:\anconda\envs\medsam_data_processor\lib\site-packages\steinbock\classification\ilastik_ilastik.py", line 385, in fix_ilastik_project_file_inplace
_fix_input_data_group_inplace(
File "E:\anconda\envs\medsam_data_processor\lib\site-packages\steinbock\classification\ilastik_ilastik.py", line 421, in _fix_input_data_group_inplace
shape=ilastik_crop_shapes[ilastik_crop_file.stem],
KeyError: 'Patient1_s0_a1_ac_ilastik_x593_y590_w500_h500'`
I've read your source code and found that you implemented the function as follows:
` ilastik_crop_shapes = {}
last_transpose_axes = None
for (
ilastik_crop_file,
transpose_axes,
ilastik_crop,
) in ilastik.try_fix_ilastik_crops_from_disk(
ilastik_crop_files, orig_axis_order=orig_axis_order
):
if last_transpose_axes not in (None, transpose_axes):
raise SteinbockCLIException("Inconsistent axis orders across crops")
ilastik.write_ilastik_crop(ilastik_crop, ilastik_crop_file)
ilastik_crop_shapes[ilastik_crop_file.stem] = ilastik_crop.shape
last_transpose_axes = transpose_axes
logger.info(ilastik_crop_file)
del ilastik_crop
ilastik.fix_ilastik_project_file_inplace(
ilastik_project_file,
ilastik_crop_dir,
ilastik_probab_dir,
ilastik_crop_shapes,
last_transpose_axes,
)`
However,the ilastik.try_fix_ilastik_crops_from_disk function returns noting (because it always continue in the loop) when "steinbock" is True in the dataset,and the ilastik_crop_shape keeps an empty dict.Therefore,when the program runs into the fix_ilastik_project_file_inplace function ,it might occur an error in the following part because the ilastik_crop_shapes contains nothing:
` _fix_raw_data_group_inplace(
raw_data_group,
file_path=str(
rel_ilastik_crop_dir
/ ilastik_crop_file.name
/ _crop_dataset_path
),
nickname=ilastik_crop_file.stem,
shape=ilastik_crop_shapes[ilastik_crop_file.stem],
)`
I wonder whether I use the function wrongly or there might be some problem with the code.
Thanks a lot!!!