monashmicroimaging / podocytes

GNU General Public License v3.0
2 stars 3 forks source link

Error handling to recover from corrupt or missing metadata #33

Open GenevieveBuckley opened 5 years ago

GenevieveBuckley commented 5 years ago

I'm finding that occasionally the metadata on voxel size is missing or corrupt. This results in a KeyError for: images[0].metadata['mppZ']

This might be more common since we're working with cropped tiff images for validation purposes (instead of raw .lif files from the microscope), but we'll need to handle it regardless.

We refer to images[0].metadata['mppZ'] directly in two places in main.py, but a lot of follow on statistics use the result in their calculation. Should be skip those entirely? Put a NaN value in the column there? Not sure of the best way to handle this just yet.

GenevieveBuckley commented 5 years ago

Apparently podocytes_validation/51686/Images_51686/glom 8.tif is a good example of this problem.

GenevieveBuckley commented 5 years ago

Traceback:

2018-12-18 14:13:35,009 Processing file: /Users/genevieb/Documents/GitHub/Code_repositories/podocytes_validation/51686/Images_51686/glom 8.tif
2018-12-18 14:13:35,243 Image:0
2018-12-18 14:13:35,244 glom 8.tif
Traceback (most recent call last):
  File "podocytes/main.py", line 176, in <module>
    main()
  File "podocytes/main.py", line 47, in main
    run_program(args)
  File "podocytes/main.py", line 72, in run_program
    single_image_stats = process_image_series(images, filename, args)
  File "podocytes/main.py", line 137, in process_image_series
    images[0].metadata['mppZ']
KeyError: 'mppZ'