Login  Register

Re: automate distance measure of uneven surface

Posted by Herbie on Feb 26, 2016; 8:16am
URL: http://imagej.273.s1.nabble.com/automate-distance-measure-of-uneven-surface-tp5015719p5015727.html

Dear Dave,

I must admit that Michael's length estimate is much better than the
simple one that I've proposed. Mine may be regarded as a a lower bound
estimate...

Best

Herbie

::::::::::::::::::::::::::::::::::::::::::::
Am 25.02.16 um 21:36 schrieb Michael Schmid:

> Hi David,
>
> you can use the wand tool to get the outline of the airspace, then
> measure the perimeter and subtract the length at the image border.
> Unfortunately this will be very inaccurate because of the pixelated
> edge; the wand will follow the pixel outlines.
>
> Better have a short macro that takes the coordinates with
> getSelectionCoordinates, then eliminate those at the border
> (typically, the last 3 points, unless you have a particle touching
> the 'air' borders). Then create a new segmented line with these
> coordinates or a subset of them (e.g. each 2nd or 3rd one, or moving
> averages, for some smoothing); see the makeSelection command with
> type "polyline".
>
> A very simple version of the macro, without smoothing, is like this,
> but it will follow the pixel outlines:
>
> setAutoThreshold("Default"); run("Convert to Mask"); //make sure it's
> a binary image doWand(0, 0, 0, "Legacy");  //assumes (0,0) is air
> getSelectionCoordinates(x,y); newLength = x.length-3; x2 =
> Array.trim(x, newLength); y2 = Array.trim(y, newLength);
> makeSelection("Polyline", x2, y2); run("Set Measurements...",
> "perimeter redirect=None decimal=3"); run("Measure");
>
>
> Michael
> ________________________________________________________________ On
> Feb 25, 2016, at 18:06, David A. Schneider wrote:
>
>> Greetings,
>>
>> I need to process a large image set of masks (like the one
>> attached) which represent a tissue cross section (lower white
>> region) and surrounding airspace (upper black region). I've written
>> macros to get me this far but I don't know if there is already an
>> existing automatic way to measure the distance of the surface.
>>
>> Note, as in this example image, that there are occasional
>> white-black interfaces not to be included. These occur in the
>> non-tissue space (in the image the single white blotch in upper
>> right quadrant) and those holes in the deeper tissue space (one
>> about mid-lower left side, another on low right side). All images
>> are oriented in this way to start. I'm not concerned about not
>> catching the bit of surface that is just below the left edge
>> boundary.  If it will make for a much simpler solution, I could
>> remove the bits of white-in-black and black-in-white not
>> representing the surface to be measured. But as you can see, hand
>> drawing the surface with a line for a hundred or more images is not
>> feasible nor likely to be accurate.
>>
>> Is there a plugin or function already out there that I can use
>> (preferably in a macro or batch process) to get this done?
>>
>> Thank you for your assistance,
>>
>> Dave
>
> -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html