Corrosion Thickness Measurement


#6

Hello Herbie,

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.

Regards,
Pranav.


#7

Thanks Pranav for the details!

Meanwhile I tried to define the outer contours by a straight line just as you’ve now suggested.

One more question:
I assume that the outer contours are horizontal ±0.5 deg. At least this holds for your sample image.

The µm unit is no problem.

There are still some details of the macro to be determined but I think that you’ll see a final version soon.

Stay tuned

Herbie


#8

Hello Herbie

It is not a problem if the horizontal lines (outer contour) has a tolerance of ±0.5 deg.
That is a great news. Looking forward for the result.

Write me if you require more details.

This was my aim for this measurement:

  1. Batch processing of images(I generally have minimum 108 images) at one time
  2. Measurement of Maximum, Mean and Minimum thickness on top and bottom corroded region for each image
  3. Result for Max, Mean and Min. thickness in µm. Report the 3 thickness for both top and bottom corroded area for
    each image.

Thank you for your help.

Regards,
Pranav.


#9

Dear Pranav!

It is not a problem if the horizontal lines (outer contour) has a tolerance of ±0.5 deg.

Originally, I meant something different, namely if you can guarantee that the outer boundaries are aligned horizontally within at least ±0.5 deg.

This is important because the first part of my macro tries to horizontally align the image more precisely in order to automatically find the best outer borders. If your images should show greater deviations than ±0.5 deg, my presently applied method would be sub-optimum.

Regards

Herbie


#10

Hello

Yea the outer boundaries are always aligned within ±0.5 deg. I can guarantee you that.

Regards,
Pranav.


#11

Dear Pranav,

would these contours (inner and outer)


be acceptable?

Regards

Herbie


#12

Hello Herbie,

This is perfect.

Regards,
Pranav


#13

Dear Pranav,

things appear to converge …

the distance in pixel is 199, known distance 500 and unit of length is µm.

Using the scale-bar I get: 296pel equals 500µm.

Please confirm!

Regards

Herbie

EDIT:
Here are the thickness measures in µm I get with “296pel equals 500µm” from your sample image:
ScreenShot-ResultsTable


#14

Hello Herbie,

I checked the scale bar and I am still getting the same result.

I am not sure what is pel?

I checked the result obtained by you with my manual measurement. They correlate with each other (Max. thickness: Top 253 and bottom 260). Just check my scale bar and compute the result.

Regards,
Pranav.


#15

Thanks for checking Pranav!

Here is my result from your sample image “Optical Microscopy_000006.jpg”:

( pel = pixel )

Clueless

Herbie


#16

Hello Herbie,

I found the problem. I had the same image taken from different microscope. Since they have different pixels they give values.

It would be great if the macro always measures the line and determines the value for each image. Hope it is not making the process complicated.

Regards,
Pranav


#17

Dear Pranav,

we are surpassing the point where the gratis volumn of help is exhausted. Perhaps we should continue on a commercial basis …

Do you have a budget for this work?

Regards

Herbie


#18

Hello Herbie,

There is no budget for this work. I am doing it as part of my work so that I could save a lot of time.

It is not a problem. I can do it manually and determine the pixels. I think the macro that is written so far does all that i expected.

Edit: can you post the macro?

Thank you.

Regards,
Pranav


#19

The following ImageJ-macro sets the image scale according to the scale-bar of the image, provided the scale-bar is located somewhere near the right bottom of the image and it looks like your scale-bars do. The macro works for your sample image “Optical Microscopy_000006.jpg”.

/////////////////////// begin macro
requires( "1.51t" );
run( "8-bit" );
b = 10;
setScaleFromBar( b );
exit();
/////////////////////// end macro
/////////////////////// begin functions
function diff( aa ) {
	for ( i = 1; i < aa.length; i++ ) {
		aa[i-1] = aa[i] - aa[i-1];
	}
	aa[aa.length-1] = 0;
}
function getBeginEnd( aaa ) {
	mi = Array.findMinima( aaa, 0 );
	mx = Array.findMaxima( aaa, 0 );
	if ( mx[0] < mi[0] ) aaa[1] = mx[1]; else aaa[1] = mx[0];
	if ( mi[0] > aaa[1] ) aaa[0] = mi[1]; else aaa[0] = mi[0];
}
function setScaleFromBar( bb ) {
	run( "Set Scale...", "distance=0 known=0 pixel=1 unit=pixel" );
	ww = getWidth();
	makeRectangle( 0, bb, ww, getHeight() - 2 * bb );
	setKeyDown( "alt" );
	a = getProfile();
	setKeyDown( "none" );
	min = Array.findMinima( a, 0 );
	if ( min[0] > min[1] ) yy = min[1]; else yy = min[0];
	pel = abs( min[1] - min[0] );
	a = Array.slice( a, yy + pel );
	diff( a );
	getBeginEnd( a );
	makeRectangle( 0, yy + bb + pel + a[0], ww, abs( a[0] - a[1] ) );
	a = getProfile();
	run( "Select None" );
	diff( a );
	getBeginEnd( a );
	pel = abs( a[0] - a[1] );
 	run( "Set Scale...", "distance=" + pel + " known=500 unit=µm" );
}
/////////////////////// end functions

Paste the macro code to an empty macro window (Plugins >> New >> Macro) and run it.

You’ve only today mentioned that you work with differently sized images and this means that I must change a lot of code in the corrosion-thickness macro. Presently, I don’t have the time to do so.

Regards

Herbie


Using ImageJ to automatically set scale by detecting a scale bar in the photo
#20

Hello Herbie,

Thank you for the macro. This is a great work. It is not a problem I can work on the microscope that correlated with this macro. Kindly check your private inbox.

Thank you.

Regards,
Pranav.


#21

Hello Herbie,

I tried running the macro for the same image and I am not able to get the result window. can you check the macro once again?

If possible, can you also post the macro with which you obtained the result window? I think that should work perfectly.

Thank you.

Regards,
Pranav.


#22

Please carefully read my post, especially the text before the macro code.

Regards

Herbie


#23

Sorry I thought it was a complete macro.


#25

Hello Herbie,

Yes the contours(inner and outer) are acceptable.

Regards
Pranav.


#26

Hello Herbie,
@Herbie

I have new images taken at scale-bar: 296 pel equals 500µm. I have thesis presentation in the following week. It would be great if you can upload the macro that you created for this scale bar.

Regards
pranav.