Hello:
This message is intended for the ImageJ Listserv. I am new to ImageJ and this list, so I hope this works. I am doing a project for graduate school. I have a bunch (hundreds) of 8-bit grayscale images that show a crack gradually getting longer. What I'd like to do is develop a macro to use ImageJ to find the length of the crack in each image and send the data to an Excel file. Can anyone give me ideas on how to do any part of this? Specifically, I'm thinking I need to do the following: 1. Be able to open, analyze, and close each image one at a time in the macro. I'm thinking to use a for loop but not sure how to do this with filenames. 2. Define a region where the crack is located. I know the exact crack path from the last image but I don't know how to define it in ImageJ. There is no pixel shifting between images. 3. Get the pixel intensity values in the region of the crack and set some threshold value to determine the farthest point along the crack path that has that minimum value, and then send that to Ecxel. One problem I am seeing is that there is a lot of noise in the image. Any help on how to this is greatly appreciated. Thanks, Josh |
P.S. I have posted several sample images of what I'm working with online. Note that the images have several cracks in them and I'm only looking at one of them for any given analysis. The address is:
http://www.louisville.edu/~jwkief02/research/crack.htm Thanks, Josh -----Original Message----- From: "Kiefer,Joshua William" <[hidden email]> To: [hidden email] Date: Tue, 31 Oct 2006 12:24:16 -0500 Subject: Measuring Crack Lengths in Many Images Hello: This message is intended for the ImageJ Listserv. I am new to ImageJ and this list, so I hope this works. I am doing a project for graduate school. I have a bunch (hundreds) of 8-bit grayscale images that show a crack gradually getting longer. What I'd like to do is develop a macro to use ImageJ to find the length of the crack in each image and send the data to an Excel file. Can anyone give me ideas on how to do any part of this? Specifically, I'm thinking I need to do the following: 1. Be able to open, analyze, and close each image one at a time in the macro. I'm thinking to use a for loop but not sure how to do this with filenames. 2. Define a region where the crack is located. I know the exact crack path from the last image but I don't know how to define it in ImageJ. There is no pixel shifting between images. 3. Get the pixel intensity values in the region of the crack and set some threshold value to determine the farthest point along the crack path that has that minimum value, and then send that to Ecxel. One problem I am seeing is that there is a lot of noise in the image. Any help on how to this is greatly appreciated. Thanks, Josh |
In reply to this post by Kiefer,Joshua William
Hi,
On Tue, 31 Oct 2006, Kiefer,Joshua William wrote: > 1. Be able to open, analyze, and close each image one at a time in the > macro. I'm thinking to use a for loop but not sure how to do this with > filenames. See http://rsb.info.nih.gov/ij/macros/ListFilesRecursively.txt > 2. Define a region where the crack is located. I know the exact crack > path from the last image but I don't know how to define it in ImageJ. > There is no pixel shifting between images. You should make this path a selection, and save it (SaveAs/Selection). If you open this file, it will not open a new image, but apply that selection to the current image (replacing any active selection). Then, extract the coordinates from the selection. See e.g. http://rsb.info.nih.gov/ij/macros/SelectionCoordinates.txt Once you have the coordinates, you can access the pixel values with the macro function getPixel(x,y). > 3. Get the pixel intensity values in the region of the crack and set > some threshold value to determine the farthest point along the crack > path that has that minimum value, and then send that to Ecxel. You should probably determine the threshold first, by inspecting the image, and then just let the macro ask for this threshold. Look at an example for that at http://rsb.info.nih.gov/ij/macros/DialogDemo.txt > One problem I am seeing is that there is a lot of noise in the image. > Any help on how to this is greatly appreciated. One thing I'd try is the 1-D median. Just iterate along the (free-hand) ROI coordinates given as an array. For each element, store the median of the neighbourhood into the output array. Example: Input is {0, 60, 40, 100, 90, 110, 100}. Take "radius" 2 for the neighbourhood, i.e. look at the 2 neighbours to the left, and the 2 neighbours to the right of the current element. The first element's (augmented by zeroes) neighbourhood is {0, 0, 0, 60, 40}. After sorting, you get {0, 0, 0, 40, 60}. The middle element (the median) is 0. Continuing with the example input, the output array looks like this: {0, 40, 60, 100, 100, 100, 90} If the macro is too slow, you will have to do this as a plugin (but try it as macro first, to see if it does what you want). After getting the median, just iterate from the left (depending if you drew the selection from center outwards or vice versa, this will be the last, or the first elements resp.) and stop when you find a value above the threshold. Subtracting the number of coordinates you looked so far gives you the length. Well, not completely. Supposing you are interested in the Euclidean length of the crack, you should then construct a selection of the remaining coordinates, fit a spline through it, and get that selection's length. Hth, Dscho |
Free forum by Nabble | Edit this page |