Scale Bar units

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

Scale Bar units

Magnar Slocombe
Hi,

 

We recommend ImageJ to our customers but some have asked if it is possible
to display different units on the Scale Bar... I know the Scale Bar displays
whatever units the calibration is in but is it possible to calibrate an
image in microns but add a scale bar in mm (or even cm)?

 

To explain, we calibrate all of the microscope images in microns but many
Histopathologists like to do measurements in mm (and sometimes cm) at low
power magnifications as this is a unit of measurement that the surgical team
are more familiar with (they still use microns at high power).

 

Is it possible to add a "units" (um, mm, cm) selector to the scale bar (I
guess it would need to assume the image is already calibrated in microns)?
Are we able to get hold of the source code for the Scale Bar... plugin and
modify it for this purpose?

 

Thanks!

Mags

 

Magnar Slocombe (Mr.)

Director

Micropix logo email

Micropix Ltd

Tel: 01730 815585 / 07876 351117

Melrose, Ashfield Road, Midhurst, W. Sussex, GU29 9JX

[hidden email]

www.micropix.co.uk <http://www.micropix.co.uk/>

 


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

image001.jpg (26K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Scale Bar units

Rasband, Wayne (NIH/NIMH) [E]
On Aug 13, 2014, at 7:21 AM, Magnar Slocombe wrote:

> Hi,
>
> We recommend ImageJ to our customers but some have asked if it is possible
> to display different units on the Scale Bar... I know the Scale Bar displays
> whatever units the calibration is in but is it possible to calibrate an
> image in microns but add a scale bar in mm (or even cm)?
>
> To explain, we calibrate all of the microscope images in microns but many
> Histopathologists like to do measurements in mm (and sometimes cm) at low
> power magnifications as this is a unit of measurement that the surgical team
> are more familiar with (they still use microns at high power).
>
> Is it possible to add a "units" (um, mm, cm) selector to the scale bar (I
> guess it would need to assume the image is already calibrated in microns)?
> Are we able to get hold of the source code for the Scale Bar... plugin and
> modify it for this purpose?

The source code for the Analyze>Tools>Scale Bar command is available at

   http://imagej.nih.gov/ij/source/ij/plugin/ScaleBar.java

To create a customizable user plugin, save the source code in the plugins folder as Scale_Bar.java, open it in ImageJ, change

   package ij.plugin;

to

   import ij.plugin.PlugIn;

Change

   public class ScaleBar implements PlugIn {

to

   public class Scale_Bar implements PlugIn {

and re-compile using the Plugins>Compile and Run command.

-wayne

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

Re: Scale Bar units

Ed Simmons
Hi Wayne,

On 18/08/2014 00:57, Rasband, Wayne (NIH/NIMH) [E] wrote:

> On Aug 13, 2014, at 7:21 AM, Magnar Slocombe wrote:
>
>> Hi,
>>
>> We recommend ImageJ to our customers but some have asked if it is possible
>> to display different units on the Scale Bar... I know the Scale Bar displays
>> whatever units the calibration is in but is it possible to calibrate an
>> image in microns but add a scale bar in mm (or even cm)?
>>
>> To explain, we calibrate all of the microscope images in microns but many
>> Histopathologists like to do measurements in mm (and sometimes cm) at low
>> power magnifications as this is a unit of measurement that the surgical team
>> are more familiar with (they still use microns at high power).
>>
>> Is it possible to add a "units" (um, mm, cm) selector to the scale bar (I
>> guess it would need to assume the image is already calibrated in microns)?
>> Are we able to get hold of the source code for the Scale Bar... plugin and
>> modify it for this purpose?
> The source code for the Analyze>Tools>Scale Bar command is available at
>
>     http://imagej.nih.gov/ij/source/ij/plugin/ScaleBar.java
>
> To create a customizable user plugin, save the source code in the plugins folder as Scale_Bar.java, open it in ImageJ, change
>
>     package ij.plugin;
>
> to
>
>     import ij.plugin.PlugIn;
>
> Change
>
>     public class ScaleBar implements PlugIn {
>
> to
>
>     public class Scale_Bar implements PlugIn {
>
> and re-compile using the Plugins>Compile and Run command.
>
> -wayne
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

I have just tried this with the IJ bundled with a recent MM nightly
build and it gives me an error when trying to compile and run.
The error says
Plugin or class not found: "Scale_Bar"
(java.lang.ClassNotFoundException: Scale_Bar)

The same code compiles fine if it is named ScaleBar.java (the
appropriate change of class name has been made) but this doesn't result
in an item in the menu.

Any ideas? Thanks!
Ed

--
[hidden email]
http://www.esimgagingsolutions.com

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

Re: Scale Bar units

Gabriel Landini
On Monday 18 Aug 2014 12:52:34 Ed Simmons wrote:
> I have just tried this with the IJ bundled with a recent MM nightly
> build and it gives me an error when trying to compile and run.
> The error says
> Plugin or class not found: "Scale_Bar"
> (java.lang.ClassNotFoundException: Scale_Bar)
>
> The same code compiles fine if it is named ScaleBar.java (the
> appropriate change of class name has been made) but this doesn't result
> in an item in the menu.

Perhaps the file name and the class name in the code do not match?
Try renaming both to the same and also include a "_" in the name so it appears
in the menus.
Cheers

Gabriel

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

Re: Scale Bar units

Ed Simmons
On 18/08/2014 13:07, Gabriel Landini wrote:

> On Monday 18 Aug 2014 12:52:34 Ed Simmons wrote:
>> I have just tried this with the IJ bundled with a recent MM nightly
>> build and it gives me an error when trying to compile and run.
>> The error says
>> Plugin or class not found: "Scale_Bar"
>> (java.lang.ClassNotFoundException: Scale_Bar)
>>
>> The same code compiles fine if it is named ScaleBar.java (the
>> appropriate change of class name has been made) but this doesn't result
>> in an item in the menu.
> Perhaps the file name and the class name in the code do not match?
> Try renaming both to the same and also include a "_" in the name so it appears
> in the menus.
> Cheers
>
> Gabriel
>
>
Hi Gabriel,

I thought this was the cause too - but I can only get it to compile when
using no underscores in the file & class names...

Thanks,
Ed

--
[hidden email]
http://www.esimgagingsolutions.com

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

Re: Scale Bar units

Michael Schmid
Hi Ed,

Wayne's instructions work well when I try it.
Note that the file Scale_Bar.java must be in ImageJ/plugins or an immediate subfolder thereof.

You will get that exception if the file is not in ImageJ/plugins or in a folder deeper in the hierarchy, ImageJ/plugins/firstSubFolder/SecondSubFolder

Michael
________________________________________________________________
On Aug 18, 2014, at 14:53, Ed Simmons wrote:

> On 18/08/2014 13:07, Gabriel Landini wrote:
>> On Monday 18 Aug 2014 12:52:34 Ed Simmons wrote:
>>> I have just tried this with the IJ bundled with a recent MM nightly
>>> build and it gives me an error when trying to compile and run.
>>> The error says
>>> Plugin or class not found: "Scale_Bar"
>>> (java.lang.ClassNotFoundException: Scale_Bar)
>>>
>>> The same code compiles fine if it is named ScaleBar.java (the
>>> appropriate change of class name has been made) but this doesn't result
>>> in an item in the menu.
>> Perhaps the file name and the class name in the code do not match?
>> Try renaming both to the same and also include a "_" in the name so it appears
>> in the menus.
>> Cheers
>>
>> Gabriel
>>
>>
> Hi Gabriel,
>
> I thought this was the cause too - but I can only get it to compile when using no underscores in the file & class names...
>
> Thanks,
> Ed

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