http://imagej.273.s1.nabble.com/Measure-intensities-on-rather-than-within-an-ROI-line-and-be-able-to-specify-the-line-width-tp3683556p3683561.html
Thanks for the suggestion. If you (or anyone else) needs to do
ROI is defined in all ROIs at once. This is a lot faster than using
the "enlarge" function on each ROI individually. e.g., my code is now
images, so I'm happy it's now only ~6h!).
> Hi Emmanuel,
>
>> Directly on the ROI. The reason I'm using this is that both other
>> solutions expand the ROI on the "outside" and I need to do it in the
>> "inside". Thus I measure two areas and then make the difference
>> between them to get the "band" information.
>
> For interior bands, you can use the ROI Manager's XOR function. Here is a
> small macro:
>
> run("Add to Manager");
> run("Enlarge...", "enlarge=-3");
> run("Add to Manager");
> roiManager("XOR");
> roiManager("Deselect");
> roiManager("Delete");
>
> -Curtis
>
> On Tue, Aug 9, 2011 at 1:27 AM, Emmanuel Levy <
[hidden email]>
> wrote:
>>
>> Hi Lim and Curtis,
>>
>> Thanks a lot for your suggestions again.
>>
>> I've been playing around with this problem with a while and the first
>> version that worked fine was to simply use:
>>
>> run("Enlarge...", "enlarge=-5");
>>
>> Directly on the ROI. The reason I'm using this is that both other
>> solutions expand the ROI on the "outside" and I need to do it in the
>> "inside". Thus I measure two areas and then make the difference
>> between them to get the "band" information.
>>
>> The only problem is that calling this on all ROIs is really slow (I've
>> got really a lot of them)!!
>>
>> I just saw the code of "shrink", which is part of the "enlarge" function:
>>
>>
http://geosysin.iict.ch/irstv-trac/browser/imageJ/macros/EnlargeSelection.txt?rev=90>>
>> And applying the trick from this function:
>>
>> run("Distance Map");
>> setThreshold(5, 255);
>>
>> on my thresholded image seem to do the job very well. This means I'll
>> just use two different images as "masks". One with the entire cells,
>> and one where they are further thresholded based on the distance map.
>>
>> Emmanuel
>>
>>
>>
>> On 3 August 2011 23:24, Lim Soon Yew <
[hidden email]>
>> wrote:
>> > Hi Emmanuel,
>> >
>> > You can try the macro I wrote below:
>> >
>> > p=2; //1-n Call ROI from ROI manager
>> > l=5; //Line width for line profile
>> > roiManager("Select", p-1); //index starts at 0)
>> > //Extract points in ROI
>> > getSelectionCoordinates(xCoordinates, yCoordinates);
>> > makeSelection("polyline",xCoordinates, yCoordinates);
>> > run("Line Width...", "line=l");
>> > run("Plot Profile");
>> >
>> > Best Regards,
>> > John
>> > ________________________________________
>> > From: ImageJ Interest Group [
[hidden email]] On Behalf Of Emmanuel
>> > Levy [
[hidden email]]
>> > Sent: Wednesday, August 03, 2011 10:24 PM
>> > To:
[hidden email]
>> > Subject: Measure intensities *on* rather than within an ROI line, and be
>> > able to specify the "line" width.
>> >
>> > Hi,
>> >
>> > I would like to measure pixel intensities along the border of
>> > particles (cell membranes). In my macro each particle has a
>> > corresponding ROI. That would be equivalent to being able to measure
>> > the intensity *on* (and not within the ROI line), and be able to
>> > specify the line width (e.g., 3-15 pixels).
>> >
>> > In principle this looks simple but I'm not sure what would be the best
>> > way to achieve it. The simplest (and very rough) way I thought of was
>> > to run every measure twice, one on the "dilated" particles and one on
>> > the "eroded" same particles. However, it's not optimal if I want to
>> > get measures for different widths simultaneously (e.g., 3,5,7,9,11,13
>> > and 15 pixels "ribbon" width).
>> >
>> > Thanks for any advice you could give!
>> > Best,
>> >
>> > Emmanuel
>
>