Draw random dots only within a ROI

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

Draw random dots only within a ROI

Zeta
Hi,

I am using the macro "DrawRandomDots" but i need it to work within a certain ROI.

How can I do it? Or, is there any line that can be added to the macro to make it work within a ROI?

Thank you in advance
Reply | Threaded
Open this post in threaded view
|

Re: Draw random dots only within a ROI

Krs5
Dear Davide(?),

What will be the shape of your ROIs? Rectangular?

Kees

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Zeta
Sent: 17 November 2014 02:37
To: [hidden email]
Subject: Draw random dots only within a ROI

Hi,

I am using the macro "DrawRandomDots" but i need it to work within a certain ROI.

How can I do it? Or, is there any line that can be added to the macro to make it work within a ROI?

Thank you in advance



--
View this message in context: http://imagej.1557.x6.nabble.com/Draw-random-dots-only-within-a-ROI-tp5010470.html
Sent from the ImageJ mailing list archive at Nabble.com.

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

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Draw random dots only within a ROI

Zeta
Hi Kees,

the ROI will be rectangular shape.

I have a picture of a plate with fouling organisms on it, and I need to generate 50 dots in the bottom part of the plate and 50 in the top part (two rectangular ROIs).

A way to go would be to crop the image and generate random dots across the cropped part, but i have about 800 plates and each picture would be cropped twice. The time needed would be enormous.

Thank you
Davide  
Reply | Threaded
Open this post in threaded view
|

Re: Draw random dots only within a ROI

Krs5
Hi Davide,

Second question: should the whole dot fall within the ROI or only the center of the dots. In the last case part of the dot will fall outside of the ROI.

Kees
________________________________________
From: ImageJ Interest Group [[hidden email]] on behalf of Zeta [[hidden email]]
Sent: 17 November 2014 22:21
To: [hidden email]
Subject: Re: Draw random dots only within a ROI

Hi Kees,

the ROI will be rectangular shape.

I have a picture of a plate with fouling organisms on it, and I need to
generate 50 dots in the bottom part of the plate and 50 in the top part (two
rectangular ROIs).

A way to go would be to crop the image and generate random dots across the
cropped part, but i have about 800 plates and each picture would be cropped
twice. The time needed would be enormous.

Thank you
Davide



--
View this message in context: http://imagej.1557.x6.nabble.com/Draw-random-dots-only-within-a-ROI-tp5010470p5010498.html
Sent from the ImageJ mailing list archive at Nabble.com.

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

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Draw random dots only within a ROI

Zeta
Kees,

it doesn't really matter, since the dot will be only a reference. The easiest things would work. :)

Davide

2014-11-18 11:31 GMT+13:00 Straatman, Kees (Dr.) [via ImageJ] <[hidden email]>:
Hi Davide,

Second question: should the whole dot fall within the ROI or only the center of the dots. In the last case part of the dot will fall outside of the ROI.

Kees
________________________________________
From: ImageJ Interest Group [[hidden email]] on behalf of Zeta [[hidden email]]
Sent: 17 November 2014 22:21
To: [hidden email]
Subject: Re: Draw random dots only within a ROI

Hi Kees,

the ROI will be rectangular shape.

I have a picture of a plate with fouling organisms on it, and I need to
generate 50 dots in the bottom part of the plate and 50 in the top part (two
rectangular ROIs).

A way to go would be to crop the image and generate random dots across the
cropped part, but i have about 800 plates and each picture would be cropped
twice. The time needed would be enormous.

Thank you
Davide



--
View this message in context: http://imagej.1557.x6.nabble.com/Draw-random-dots-only-within-a-ROI-tp5010470p5010498.html
Sent from the ImageJ mailing list archive at Nabble.com.

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

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



If you reply to this email, your message will be added to the discussion below:
http://imagej.1557.x6.nabble.com/Draw-random-dots-only-within-a-ROI-tp5010470p5010499.html
To unsubscribe from Draw random dots only within a ROI, click here.
NAML



--
Davide Zazzaro
Research PhD student
Department of Marine Science
University of Auckland
Auckland 1010
New Zealand
Tel: +64 27 8756181
Reply | Threaded
Open this post in threaded view
|

Re: Draw random dots only within a ROI

Krs5
Dear Davide,

OK, see if the code below does what you want

dotSize = 25;
Roi.getBounds(x,y,w,h);
for (i=0; i<25; i++) {
        x1 = (random()*w-dotSize/2)+x;
        y1 = (random()*h-dotSize/2)+y;
        makeOval(x1, y1, dotSize, dotSize);
        run("Fill");
}
run("Select None");

Best wishes

Kees
________________________________________
From: ImageJ Interest Group [[hidden email]] on behalf of Zeta [[hidden email]]
Sent: 17 November 2014 22:35
To: [hidden email]
Subject: Re: Draw random dots only within a ROI

Kees,

it doesn't really matter, since the dot will be only a reference. The
easiest things would work. :)

Davide

2014-11-18 11:31 GMT+13:00 Straatman, Kees (Dr.) [via ImageJ] <
[hidden email]>:

> Hi Davide,
>
> Second question: should the whole dot fall within the ROI or only the
> center of the dots. In the last case part of the dot will fall outside of
> the ROI.
>
> Kees
> ________________________________________
> From: ImageJ Interest Group [[hidden email]
> <http://user/SendEmail.jtp?type=node&node=5010499&i=0>] on behalf of Zeta
> [[hidden email] <http://user/SendEmail.jtp?type=node&node=5010499&i=1>]
> Sent: 17 November 2014 22:21
> To: [hidden email] <http://user/SendEmail.jtp?type=node&node=5010499&i=2>
> Subject: Re: Draw random dots only within a ROI
>
> Hi Kees,
>
> the ROI will be rectangular shape.
>
> I have a picture of a plate with fouling organisms on it, and I need to
> generate 50 dots in the bottom part of the plate and 50 in the top part
> (two
> rectangular ROIs).
>
> A way to go would be to crop the image and generate random dots across the
> cropped part, but i have about 800 plates and each picture would be
> cropped
> twice. The time needed would be enormous.
>
> Thank you
> Davide
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/Draw-random-dots-only-within-a-ROI-tp5010470p5010498.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://imagej.1557.x6.nabble.com/Draw-random-dots-only-within-a-ROI-tp5010470p5010499.html
>  To unsubscribe from Draw random dots only within a ROI, click here
> <
> .
> NAML
> <
http://imagej.1557.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>



--
*Davide Zazzaro*
Research PhD student
Department of Marine Science
University of Auckland
Auckland 1010
New Zealand
Tel: +64 27 8756181




--
View this message in context: http://imagej.1557.x6.nabble.com/Draw-random-dots-only-within-a-ROI-tp5010470p5010500.html
Sent from the ImageJ mailing list archive at Nabble.com.

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

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Draw random dots only within a ROI

Zeta
Hi Kees,

thank you soooo much, it worked perfectly!!!!! you really saved me a LOT of time.   :)

Best wishes
Davide

2014-11-18 11:43 GMT+13:00 Straatman, Kees (Dr.) [via ImageJ] <[hidden email]>:
Dear Davide,

OK, see if the code below does what you want

dotSize = 25;
Roi.getBounds(x,y,w,h);
for (i=0; i<25; i++) {
        x1 = (random()*w-dotSize/2)+x;
        y1 = (random()*h-dotSize/2)+y;
        makeOval(x1, y1, dotSize, dotSize);
        run("Fill");
}
run("Select None");

Best wishes

Kees
________________________________________
From: ImageJ Interest Group [[hidden email]] on behalf of Zeta [[hidden email]]
Sent: 17 November 2014 22:35
To: [hidden email]
Subject: Re: Draw random dots only within a ROI

Kees,

it doesn't really matter, since the dot will be only a reference. The
easiest things would work. :)

Davide

2014-11-18 11:31 GMT+13:00 Straatman, Kees (Dr.) [via ImageJ] <
[hidden email]>:

> Hi Davide,
>
> Second question: should the whole dot fall within the ROI or only the
> center of the dots. In the last case part of the dot will fall outside of
> the ROI.
>
> Kees
> ________________________________________
> From: ImageJ Interest Group [[hidden email]
> <http://user/SendEmail.jtp?type=node&node=5010499&i=0>] on behalf of Zeta
> [[hidden email] <http://user/SendEmail.jtp?type=node&node=5010499&i=1>]
> Sent: 17 November 2014 22:21
> To: [hidden email] <http://user/SendEmail.jtp?type=node&node=5010499&i=2>
> Subject: Re: Draw random dots only within a ROI

>
> Hi Kees,
>
> the ROI will be rectangular shape.
>
> I have a picture of a plate with fouling organisms on it, and I need to
> generate 50 dots in the bottom part of the plate and 50 in the top part
> (two
> rectangular ROIs).
>
> A way to go would be to crop the image and generate random dots across the
> cropped part, but i have about 800 plates and each picture would be
> cropped
> twice. The time needed would be enormous.
>
> Thank you
> Davide
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/Draw-random-dots-only-within-a-ROI-tp5010470p5010498.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://imagej.1557.x6.nabble.com/Draw-random-dots-only-within-a-ROI-tp5010470p5010499.html
>  To unsubscribe from Draw random dots only within a ROI, click here
> <

> .
> NAML
> <
http://imagej.1557.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>



--
*Davide Zazzaro*
Research PhD student
Department of Marine Science
University of Auckland
Auckland 1010
New Zealand
Tel: +64 27 8756181




--
View this message in context: http://imagej.1557.x6.nabble.com/Draw-random-dots-only-within-a-ROI-tp5010470p5010500.html
Sent from the ImageJ mailing list archive at Nabble.com.

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

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



If you reply to this email, your message will be added to the discussion below:
http://imagej.1557.x6.nabble.com/Draw-random-dots-only-within-a-ROI-tp5010470p5010501.html
To unsubscribe from Draw random dots only within a ROI, click here.
NAML



--
Davide Zazzaro
Research PhD student
Department of Marine Science
University of Auckland
Auckland 1010
New Zealand
Tel: +64 27 8756181