Plugin announcement: Orientation measurements

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

Plugin announcement: Orientation measurements

Per Christian Henden
I've created a plugin for measuring the orientation of shapes in an image or stack using statistical calculations. I don't think there is such a plugin already.

Get it at http://www.pvv.org/~perchrh/imagej/orientation.html
The plugin is in the public domain (free license).

Theory of operation:

Requires a segmented input image or stack.
Calculates the orientation of all labels (intensity values) in the image by finding the eigenvector associated with the largest eigenvalue of the covariance matrix of the x,y,z coordinates of each label. For the mathematical details, see this [1] paper, pages 31-32 (23-24).

Jama (Java matrix package, public domain) is used for extracting the eigenvalues and eigenvectors from the covariance matrix. The vectors are normalized before printed.

The coordinate system of the image is used. That means (x=0,y=0) is at the topmost left corner of the screen. X-coordinates increase towards the right and y-coordinates increase downwards. Z-coordinates increase into the screen.

The image is read only once. The complexity of the algorithm is O(N), where N is the number of pixels in the image.

[1] http://www.pvv.org/~perchrh/papers/mastersthesisHendenBacheWiig.pdf

Cheers,

PER
Reply | Threaded
Open this post in threaded view
|

Re: Plugin announcement: Orientation measurements

Albert Cardona
Hi Per,

Would you comment on how is your orientation finder different than SIFT
(Scale Invariant Feature Transform) by D. Lowe 2004 ?

Many thanks and congrats.

Albert

--
Albert Cardona
http://www.mcdb.ucla.edu/Research/Hartenstein/acardona
Reply | Threaded
Open this post in threaded view
|

Re: Plugin announcement: Orientation measurements

Per Christian Henden
On Thursday 06 December 2007 01:00:41 Albert Cardona wrote:
> Hi Per,
>
> Would you comment on how is your orientation finder different than SIFT
> (Scale Invariant Feature Transform) by D. Lowe 2004 ?

I assumed you mean this article http://www.cs.ubc.ca/~lowe/papers/ijcv04.pdf
I've just read the orientation part. SIFT looks like a smart approach, thanks
for pointing me to it. It solves a different problem from my plugin, though.

SIFT finds a number of 'keypoints' in the image. These keypoints are
considered characteristic to the image. One of the attributes of a keypoint
is its orientation. The orientation is determined by an equation using four
neighbouring points  to the keypoint in a scaled version of the image. There
is no concept of the orientation of an object, only orientation of keypoints,
althout it would probably be possible to aggregate these keypoint orientations
in some way.

My plugin assumes a segmented image/volume, so that each object you want to
measure the orientation of has its own label. For each object it looks at the
coordinates of the points that the object consists of and builds a covariance
matrix from those. The covariance matrix is used for calculating a vector
describing the direction of the object.

I hope that was a helpful answer.
Let me know if there are more questions!

PER
Reply | Threaded
Open this post in threaded view
|

Re: Plugin announcement: Orientation measurements

Albert Cardona
Thank you Per your explanations were very clear.
As I have a big interest in segmentation and 3D modeling, I will follow
up on your approach.

Albert

--
Albert Cardona
http://www.mcdb.ucla.edu/Research/Hartenstein/acardona
Reply | Threaded
Open this post in threaded view
|

"Use Virtual Stack"

pcloetens
In reply to this post by Per Christian Henden
Hello,
When I try
the "Use Virtual Stack" option in File>Import>Raw
with version 1.39n
I get the error below.
The file opens fine when opened normally.
Peter

java.lang.NullPointerException
        at ij.plugin.FileInfoVirtualStack.getNumber(FileInfoVirtualStack.java:97)
        at ij.plugin.FileInfoVirtualStack.getInt(FileInfoVirtualStack.java:92)
        at ij.plugin.FileInfoVirtualStack.open(FileInfoVirtualStack.java:71)
        at ij.plugin.FileInfoVirtualStack.<init>(FileInfoVirtualStack.java:23)
        at ij.io.ImportDialog.openImage(ImportDialog.java:159)
        at ij.plugin.Raw.run(Raw.java:20)
        at ij.IJ.runPlugIn(IJ.java:131)
        at ij.Executer.runCommand(Executer.java:100)
        at ij.Executer.run(Executer.java:54)
        at java.lang.Thread.run(Unknown Source)
Reply | Threaded
Open this post in threaded view
|

Re: "Use Virtual Stack"

Wayne Rasband
This bug will be fixed in ImageJ version 1.39o.

-wayne

On Dec 25, 2007, at 9:27 AM, Peter Cloetens wrote:

> Hello,
> When I try
> the "Use Virtual Stack" option in File>Import>Raw
> with version 1.39n
> I get the error below.
> The file opens fine when opened normally.
> Peter
>
> java.lang.NullPointerException
> at ij.plugin.FileInfoVirtualStack.getNumber
> (FileInfoVirtualStack.java:97)
> at ij.plugin.FileInfoVirtualStack.getInt(FileInfoVirtualStack.java:
> 92)
> at ij.plugin.FileInfoVirtualStack.open(FileInfoVirtualStack.java:71)
> at ij.plugin.FileInfoVirtualStack.<init>(FileInfoVirtualStack.java:
> 23)
> at ij.io.ImportDialog.openImage(ImportDialog.java:159)
> at ij.plugin.Raw.run(Raw.java:20)
> at ij.IJ.runPlugIn(IJ.java:131)
> at ij.Executer.runCommand(Executer.java:100)
> at ij.Executer.run(Executer.java:54)
> at java.lang.Thread.run(Unknown Source)
Reply | Threaded
Open this post in threaded view
|

mark a zone with 2 vertical lines within a picture, automaticaly

Rewald, Boris
Dear list,

I would like to mark an approx. 7 cm wide (x 20 cm height) zone within a 19
cm wide (x 20 cm height) jpg picture with vertical lines (in colour?).

I will only include this aperture in the planed analyse but need the
surrounding to move an overlay in the next time stack (WinRhizo Tron, Regent,
Canada --> root growth/decay analysis). Because I have > 2000 pictures, it
would be a pleasure if this marking would be done automatically ... .

I sounds quite easy, but I didn't get the point now ...


Thanks a lot for any comments & a happy new year for all of you!!

Boris
Reply | Threaded
Open this post in threaded view
|

draw a vertical line - malfunctioning??

Rewald, Boris
Dear all,

once again a question about "drawing lines" ... (see my first question
below).

It is not possible to create a vertical line (straight line function, 90°)
with the "Draw" (Strg D) function, but i can draw circles, freehand ect ...
Is this a bug or normal?

Greetings,

Boris


-----------------------------------------------
Boris Rewald
Georg-August University of Göttingen, Germany
Albrecht-von-Haller Institute of Plant Sciences
Dept. of Plant Ecology
 
Grisebachstraße 1
D-37077 Göttingen, Germany
Phone: +49-(0)551-397084
Fax: +49-(0)551-392029
-----------------------------------------------

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Rewald,
Boris
Sent: Thursday, December 27, 2007 3:42 PM
To: [hidden email]
Subject: mark a zone with 2 vertical lines within a picture, automaticaly

Dear list,

I would like to mark an approx. 7 cm wide (x 20 cm height) zone within a 19
cm wide (x 20 cm height) jpg picture with vertical lines (in colour?).

I will only include this aperture in the planed analyse but need the
surrounding to move an overlay in the next time stack (WinRhizo Tron, Regent,
Canada --> root growth/decay analysis). Because I have > 2000 pictures, it
would be a pleasure if this marking would be done automatically ... .

I sounds quite easy, but I didn't get the point now ...


Thanks a lot for any comments & a happy new year for all of you!!

Boris
Reply | Threaded
Open this post in threaded view
|

Re: draw a vertical line - malfunctioning??

Gabriel Landini
On Friday 28 December 2007, Rewald, Boris wrote:
> It is not possible to create a vertical line (straight line function, 90°)
> with the "Draw" (Strg D) function, but i can draw circles, freehand ect ...
> Is this a bug or normal?

Hi,

Not sure what is the "Draw" (Strg D) function.
I think that you may be applying the wrong functions.

Have a look at:
http://rsbweb.nih.gov/ij/developer/macro/functions.html


I think that you need:

drawLine(x1, y1, x2, y2)
 Draws a line between (x1, y1) and (x2, y2). Use setColor() to specify the
color of the line and setLineWidth() to vary the line width.

or

makeLine(x1, y1, x2, y2)
 Creates a new straight line selection. The origin (0,0) is assumed to be the
upper left corner of the image. Coordinates are in pixels. With ImageJ 1.35b
and letter, you can create segmented line selections by specifying more than
two coordinate, for example makeLine(25,34,44,19,69,30,71,56).

or

makeLine(x1, y1, x2, y2, lineWidth)
 Creates a straight line selection with the specified width. Requires 1.38u.
See also: getLine.

Cheers,

G.
Reply | Threaded
Open this post in threaded view
|

Re: draw a vertical line - malfunctioning??

Rewald, Boris
Hi,

With me, drawing vertical lines still did not work manually!! Maybe it is my
fault!

But I found a work-around by filling a small retangle.
Please allow me one last question ...

How can I  transform all pictures in a current file? ... run("Open next") did
not work ...

What I have (for one file)..

open("D:\\DrArbeit\\Rhizoskopie\\Analysierte Bilder\\Ab\\Versuch
Linie\\AbEiDa_T008_L000_01.09.2006_1200_014_Bor.JPG");
makeRectangle(408, 4, 12, 3176);
run("Fill");
makeRectangle(1504, 4, 12, 3168);
run("Fill");
saveAs("Jpeg", "D:\\DrArbeit\\Rhizoskopie\\Analysierte Bilder\\Ab\\Versuch
Linie\\NEU\\AbEiDa_T008_L000_01.09.2006_1200_014_Bor.jpg");

close();




Thanks a lot in advance!
All the best,

Boris






-----------------------------------------------
Boris Rewald
Georg-August University of Göttingen, Germany
Albrecht-von-Haller Institute of Plant Sciences
Dept. of Plant Ecology
 
Grisebachstraße 1
D-37077 Göttingen, Germany
Phone: +49-(0)551-397084
Fax: +49-(0)551-392029
-----------------------------------------------

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Gabriel
Landini
Sent: Friday, December 28, 2007 4:45 PM
To: [hidden email]
Subject: Re: draw a vertical line - malfunctioning??

On Friday 28 December 2007, Rewald, Boris wrote:
> It is not possible to create a vertical line (straight line function,
> 90°) with the "Draw" (Strg D) function, but i can draw circles, freehand
ect ...
> Is this a bug or normal?

Hi,

Not sure what is the "Draw" (Strg D) function.
I think that you may be applying the wrong functions.

Have a look at:
http://rsbweb.nih.gov/ij/developer/macro/functions.html


I think that you need:

drawLine(x1, y1, x2, y2)
 Draws a line between (x1, y1) and (x2, y2). Use setColor() to specify the
color of the line and setLineWidth() to vary the line width.

or

makeLine(x1, y1, x2, y2)
 Creates a new straight line selection. The origin (0,0) is assumed to be the
upper left corner of the image. Coordinates are in pixels. With ImageJ 1.35b
and letter, you can create segmented line selections by specifying more than
two coordinate, for example makeLine(25,34,44,19,69,30,71,56).

or

makeLine(x1, y1, x2, y2, lineWidth)
 Creates a straight line selection with the specified width. Requires 1.38u.
See also: getLine.

Cheers,

G.
Reply | Threaded
Open this post in threaded view
|

Re: draw a vertical line - malfunctioning??

Gabriel Landini
On Friday 28 December 2007, Rewald, Boris wrote:
> How can I  transform all pictures in a current file? ... run("Open next")
> did not work ...

Do you mean in a current folder?
If so, please look here:

http://rsb.info.nih.gov/ij/macros/

There is a large collection of macros. Perhaps the BatchConvert.txt or
BatchProcessFolders.txt macro is what you want.

> saveAs("Jpeg", "D:\\DrArbeit\\Rhizoskopie\\Analysierte Bilder\\Ab\\Versuch
> Linie\\NEU\\AbEiDa_T008_L000_01.09.2006_1200_014_Bor.jpg");

I would suggest not to use jpeg format, though. Each time you save in that
format you change the contents of the image (it is a lossy format).

Regards,

G.
Reply | Threaded
Open this post in threaded view
|

Re: draw a vertical line - malfunctioning??

Michael Schmid
In reply to this post by Rewald, Boris
Hi Boris,

that's a problem that I have never seen.
Maybe you display a zoomed-in image, so the pixels changed by drawing
are not displayed unless you enlarge it to 100%?
  Image>Zoom>View 100%

Michael
______________________________________________________________

On Fri, 28 Dec 2007 16:17:09 +0100 "Rewald, Boris"
<[hidden email]> wrote:

>Dear all,
>
>once again a question about "drawing lines" ... (see my first question
>below).
>
>It is not possible to create a vertical line (straight line function, 90°)
>with the "Draw" (Strg D) function, but i can draw circles, freehand ect ...
>Is this a bug or normal?
>
>Greetings,
>
>Boris
>
Reply | Threaded
Open this post in threaded view
|

Re: mark a zone with 2 vertical lines within a picture, automaticaly

Justin McGrath
In reply to this post by Rewald, Boris
The Hough transform would be useful here, but I don't know of a plugin
that implements it for ImageJ.  Since your situation is just vertical
lines, you can simplify it.  If you use "Find edges" and add together
all of the pixel values in a column, then the two highest values in
the new array should be the vertical lines in your image.   The lines
are probably not perfectly vertical, so you might want to smooth the
array first.

Justin

On Dec 27, 2007 8:41 AM, Rewald, Boris <[hidden email]> wrote:

> Dear list,
>
> I would like to mark an approx. 7 cm wide (x 20 cm height) zone within a 19
> cm wide (x 20 cm height) jpg picture with vertical lines (in colour?).
>
> I will only include this aperture in the planed analyse but need the
> surrounding to move an overlay in the next time stack (WinRhizo Tron, Regent,
> Canada --> root growth/decay analysis). Because I have > 2000 pictures, it
> would be a pleasure if this marking would be done automatically ... .
>
> I sounds quite easy, but I didn't get the point now ...
>
>
> Thanks a lot for any comments & a happy new year for all of you!!
>
> Boris
>