It is great that you could determine the inner contour.
For the outer contour I will generally draw a straight line(red line as indicated in the image below) where I could clearly differentiate the corroded region from the embedding (see image below).
If the outer contour is uneven (as shown below) i will draw a straight line between the highest points and then draw a vertical line to the inner countour.
Regarding the inner contour I need to exactly trace the corroded region like you have defined in the image.
The vertical yellow line (In your last reply) should be as vertical as possible, so that the measurement is accurate. So generally the vertical line is measured from the upper straight line to the inner contour.
Addidtional information: All my images are taken at 500µm. It would be great if the output of my Maximum and Mean thickness is in µm. I generally use “set scale” to define it. If you can intergrate it into the macro it would be awesome. the distance in pixel is 199, known distance 500 and unit of length is µm.
Thank you for your help.