AFM-SPM / TopoStats

An AFM image analysis program to batch process data and obtain statistics from images
https://afm-spm.github.io/TopoStats/
GNU Lesser General Public License v3.0
57 stars 10 forks source link

[feature] : message in terminal that says which image causes an error when processing multiple files at the same time #887

Open TFirth2 opened 1 month ago

TFirth2 commented 1 month ago

Is your feature request related to a problem?

Currently, to find an image or images that cause an error in TopoStats you have to run 1 core which stops on the image that causes the error and this is inefficient. If there are multiple error causing images that can be very time consuming.

Describe the solution you would like.

It would be good to run the entire folder and then get a message saying that X image or X image caused the error so these can be dealt with more effectively.

Describe the alternatives you have considered.

I currently batch process image with grain stats off to just view the images and manually remove images that are cut off, blanks or otherwise not good. I then re-run TopoStats for grain stats but then often get stuck on images that won't process to give grain stats.

Additional context

No response

ns-rse commented 6 days ago

Thanks for highlighting this @TFirth2

I can fully appreciate how much of a pain this is.

Its like this because of technical debt where we were rushing to get something working quickly and implemented a broad and crude solution and haven't gone back and fixed it yet.

When we write code sometimes errors arise, but we want to handle those errors. In Python that can be done with the try: ... except: ... construct where some code is tried and if an exception (also known as an error) arises it does what is defined under the except: clause.

We have a broad try: ... except: ... around grain finding (see lines 166-184 if interested) although I notice its currently commented out on the main branch which is possibly a hangover from someone debugging (currently checking with @SylviaWhittle ).

The challenge is knowing/anticipating what the possible errors that can occur might be and with only minicircle.spm to work with on developing tests there wasn't much scope for knowing what might crop up.

If you, or anyone else in the lab, have some sample images which cause errors it would be really useful for the developers to have them so we can see what they cause and write finer-grained code to capture these and, hopefully, allow processing of other images to continue.