Create rectangle with known size

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

Create rectangle with known size

rettl
Hi!

Probably an old topic, but I can't find it...

I have different images (all with scale bar on) and I want to create a rectangle on all of them which has the same size in mm (and then crop this region). Although the magnification is not always 100% the same, I want the macro to create a rectangle with the size of 20x30mm. I know how to set scale, but I can't find a solution for "creating a rectangle in a known size".

I am sure this is very easy. Thanks for your ideas!

CL
Reply | Threaded
Open this post in threaded view
|

Re: Create rectangle with known size

Saalfeld, Stephan
Edit > Selection > Specify...

Cheers,
Stephan



On Mon, 2015-07-06 at 05:48 -0700, rettl wrote:

> Hi!
>
> Probably an old topic, but I can't find it...
>
> I have different images (all with scale bar on) and I want to create a
> rectangle on all of them which has the same size in mm (and then crop this
> region). Although the magnification is not always 100% the same, I want the
> macro to create a rectangle with the size of 20x30mm. I know how to set
> scale, but I can't find a solution for "creating a rectangle in a known
> size".
>
> I am sure this is very easy. Thanks for your ideas!
>
> CL
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Create-rectangle-with-known-size-tp5013429.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: Create rectangle with known size

rettl
That's it! :)
Thank you so much!!!
Reply | Threaded
Open this post in threaded view
|

Re: Create rectangle with known size

BenS
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Create rectangle with known size

rettl
Hi Ben,
I am sorry but since I have a new job I don't have access to the old macros any more...
All the best.

2016-11-09 16:55 GMT+01:00 BenS [via ImageJ] <[hidden email]>:
Hi rettl,

I'm facing the same problem as you did, however, I could not integrate it into my macro yet. Would you mind sharing your macro?

Many thanks,

Ben


If you reply to this email, your message will be added to the discussion below:
http://imagej.1557.x6.nabble.com/Create-rectangle-with-known-size-tp5013429p5017545.html
To unsubscribe from Create rectangle with known size, click here.
NAML



--
Dr. med. Christoph Lutter
Benedicta von Spiegel Straße 17
85072 Eichstätt - Germany
mob. (ger): +49 178 1872721
mob. (usa): +1 301 273 5274
email: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Create rectangle with known size

Michael Schmid
Hi Christoph, Ben,

for scaled images, the Edit>Selection>Specify command supports also
scaled coordinates. Use Plugins>Macros>Record to see how to create a macro.

E.g., if your image is calibrated in cm, you can have

   run("Specify...", "width=2 height=3 x=1 y=1 scaled");

to create a selection 2x3 cm, with its origin at 1 cm in x and y.
You can specify the center of the selection instead of the origin if you
add the 'centered' keyword.

Michael

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

Re: Create rectangle with known size

Stefan Helfrich-2
In reply to this post by rettl
Hi Ben,

you should be able to do the following:

     widthInMM = 100;
     heightInMM = 200;

     widthInPixel = toUnscaled(widthInMM);
     heightInPixel = toUnscaled(heightInMM);

     run("Specify...", "width="+widthInPixel+" height="+heightInPixel+"
x=128 y=70");

You can do a similar thing with toUnscaled(xInMM, yInMM) for the x- and
y-coordinates.

Hope that helps,

Stefan


On 11/10/2016 10:00 AM, rettl wrote:

> Hi Ben,
> I am sorry but since I have a new job I don't have access to the old macros
> any more...
> All the best.
>
> 2016-11-09 16:55 GMT+01:00 BenS [via ImageJ] <
> [hidden email]>:
>
>> Hi rettl,
>>
>> I'm facing the same problem as you did, however, I could not integrate it
>> into my macro yet. Would you mind sharing your macro?
>>
>> Many thanks,
>>
>> Ben
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the discussion
>> below:
>> http://imagej.1557.x6.nabble.com/Create-rectangle-with-
>> known-size-tp5013429p5017545.html
>> To unsubscribe from Create rectangle with known size, 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>
>>
>
>

--
Dr. Stefan Helfrich
Bioimaging Center (L931)
University of Konstanz

PO Box 604
78457 Konstanz
Germany

Tel +49-7531-884666
Fax +49-7531-884005

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