Plugin- threshold, ROI

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Plugin- threshold, ROI

Liisa Palomaa
Hi everyone!

I need help to modify a plugin so I can adjust the threshold- ( I
can't get the plugin thresholdadjuster to work!) - Then I want the
threshold to be a ROI- so I can find the center of the thresholded
area. Is that possible in a plugin?

It would be good if the plugin works for stacks.

Best regards
//Liisa
Reply | Threaded
Open this post in threaded view
|

Re: Plugin- threshold, ROI

Michael Miller
Hello everyone,

I've been working with Liisa quite a bit. I think I can clear a few things
up.

For some samples of her images see:
http://img132.imageshack.us/img132/6105/t2img100jl2.png
http://img132.imageshack.us/img132/4930/t2img1cb9.png

What she needs is the exact origin/center of the dark circles. Her images
are all square width/height but the dark circles are not all exactly
centered relative to her images. We've gotten a basic diffuse subtraction
working in a custom plugin but it would work a lot better if we could start
it from the origin of the dark circle. What we need is some procedure or
Java method that we could run to get the approx origin.

The dark circles "darkness" changes typically within 18 +/- 4 but that may
change per image, they can be offset both in x and y but should be
approximately centered, and I'm fairly certain they stay around radius 50.

One idea I had was to use the analyze particles "center of mass" measurement
would be perfect for extracting this info. We can set threshold to 5 - 25 or
so, and analyze particles to 2500 - 10000 or something and grab the center
circle.

Another was to draw two ROI lines, plus shaped, through the middle of the
picture. A PlotProfile would reveal the approximate center of the circle.
This method is axis/directional dependent however :-(

-Mike

----- Original Message -----
From: "Liisa Palomaa" <[hidden email]>
To: <[hidden email]>
Sent: Sunday, November 12, 2006 1:54 PM
Subject: Plugin- threshold, ROI


> Hi everyone!
>
> I need help to modify a plugin so I can adjust the threshold- ( I
> can't get the plugin thresholdadjuster to work!) - Then I want the
> threshold to be a ROI- so I can find the center of the thresholded
> area. Is that possible in a plugin?
>
> It would be good if the plugin works for stacks.
>
> Best regards
> //Liisa
Reply | Threaded
Open this post in threaded view
|

Re: Plugin- threshold, ROI

dscho
Hi,

On Mon, 13 Nov 2006, Michael Miller wrote:

> I've been working with Liisa quite a bit. I think I can clear a few
> things up.
>
> For some samples of her images see:
> http://img132.imageshack.us/img132/6105/t2img100jl2.png
> http://img132.imageshack.us/img132/4930/t2img1cb9.png
>
> What she needs is the exact origin/center of the dark circles.

How about this:

-- snip --
run("Select None");
id = getImageID();
run("Duplicate...", "title=temp");
w = getWidth();
h = getHeight();
makeOval(w/4, h/4, w/2, h/2);
run("Make Inverse");
run("Colors...", "foreground=white");
run("Fill");
setThreshold(2, 25);
run("Colors...", "background=black");
run("Make Binary", "thresholded remaining");
run("Set Measurements...", "center redirect=None decimal=3");
run("Clear Results");
run("Measure");
close();
selectImage(id);
centerX = newArray(1);
centerY = newArray(1);
centerX[0] = getResult("XM", 0);
centerY[0] = getResult("YM", 0);
makeSelection(10, centerX, centerY);
-- snap --


Hth,
Dscho
Reply | Threaded
Open this post in threaded view
|

Re: Plugin- threshold, ROI

Michael Miller
Thank you so much, this is excellent, and exactly the sort of thing I have
been looking for, for several weeks!

This macro command, getResult(); detailed here
http://rsb.info.nih.gov/ij/developer/macro/functions.html

how can I run it and get data from it from within a PluginFilter? My
experience knows only of the following:

IJ.runMacro("getResult()"); method detailed
http://rsb.info.nih.gov/ij/developer/api/ij/IJ.html returns a String, which
is the data from the macro. This is in my mind a little indirect but
accomplishes the desired goals -- is this the only way?

Thanks again so much :-D

-Mike

----- Original Message -----
From: "Johannes Schindelin" <[hidden email]>
To: <[hidden email]>
Sent: Tuesday, November 14, 2006 3:35 AM
Subject: Re: Plugin- threshold, ROI


> Hi,
>
> On Mon, 13 Nov 2006, Michael Miller wrote:
>
>> I've been working with Liisa quite a bit. I think I can clear a few
>> things up.
>>
>> For some samples of her images see:
>> http://img132.imageshack.us/img132/6105/t2img100jl2.png
>> http://img132.imageshack.us/img132/4930/t2img1cb9.png
>>
>> What she needs is the exact origin/center of the dark circles.
>
> How about this:
>
> -- snip --
> run("Select None");
> id = getImageID();
> run("Duplicate...", "title=temp");
> w = getWidth();
> h = getHeight();
> makeOval(w/4, h/4, w/2, h/2);
> run("Make Inverse");
> run("Colors...", "foreground=white");
> run("Fill");
> setThreshold(2, 25);
> run("Colors...", "background=black");
> run("Make Binary", "thresholded remaining");
> run("Set Measurements...", "center redirect=None decimal=3");
> run("Clear Results");
> run("Measure");
> close();
> selectImage(id);
> centerX = newArray(1);
> centerY = newArray(1);
> centerX[0] = getResult("XM", 0);
> centerY[0] = getResult("YM", 0);
> makeSelection(10, centerX, centerY);
> -- snap --
>
>
> Hth,
> Dscho