Line length and tracing - exception window

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

Line length and tracing - exception window

David Chatelet
Hi,
I am trying to measure the vein length of leaves but ImageJ stops and a
exception window open. Here is what I do:
First I open a tiff or jpeg image of a scale bar. I trace a certain
distance, go to the set scale window, enter the known length and unit,
check "global" and click OK. Then I open a tiff image showing a leaf
venation (same resolution and dimension than the scale bar image), select
the polygon selection tool, increase the line width to 10 and change its
color so I can see it. First I trace a box on my image, measure its
surface area (M key) and embed it on my image (D key). Then I reset the
result window, select the segmented line tool and start tracing lines
following the vein pattern. Everytime I stop, I press the M key to measure
the length of the line I just traced, followed by the D key to embed the
line on my image. Problems: (1) the lines (traced with the segmented line
tool) don’t appear on the image when I press D and (2) after about 10
measurements, ImageJ stop and an exception window appear with the
following message:
java.lang.ArrayIndexOutOfBoundsException: 0
at ij.gui.PolygonRoi.fitSplineForStraightening(PolygonRoi.java:617)
at ij.plugin.Straightener.straightenLine(Straightener.java:98)
at ij.plugin.filter.Analyzer.measureLength(Analyzer.java:327)
at ij.plugin.filter.Analyzer.measure(Analyzer.java:203)
at ij.plugin.filter.Analyzer.run(Analyzer.java:86)
at ij.plugin.filter.PlugInFilterRunner.processOneImage
(PlugInFilterRunner.java:245)
at ij.plugin.filter.PlugInFilterRunner.<init>(PlugInFilterRunner.java:102)
at ij.IJ.runPlugIn(IJ.java:150)
at ij.Executer.runCommand(Executer.java:121)
at ij.Executer.run(Executer.java:58)
at java.lang.Thread.run(Thread.java:619)  

What is going on? I have Vista home premium 32bit and this method was
working fine with ImageJ 1.38. But I upgraded ImageJ recently and it is no
good anymore. Any help would be greatly appreciated. Thanks.

David
Reply | Threaded
Open this post in threaded view
|

Re: Line length and tracing - exception window

Michael Schmid
Hi David,

yes, I could reproduce the exception with the lastest daily build.
(Windows XP, Java 1.5.0_09)
It can occur when typing 'M' before the line segment has more than one
point (i.e., while it has only one anchor at the starting point, and the
end point is still under cursor control), but it can also occur with
longer selections.
After the exception, everything becomes weird; the image is not updated
any more, the keyboard shortcuts don't work (seems that the ImageCanvas is
damaged). It starts to work again if I use the rectangular selection and
move the cursor into the ImageCanvas (sometimes I have to click into it).

Even more strange: It seems that the problem needs a calibration with less
than 1 unit per pixel.

---
One related issue: I do not understand why "Measure" on a polygon roi with
line thickness>1 always creates a spline fit.

Michael
________________________________________________________________

On Tue, August 25, 2009 23:36, David Chatelet wrote:

> Hi,
> I am trying to measure the vein length of leaves but ImageJ stops and a
> exception window open. Here is what I do:
> First I open a tiff or jpeg image of a scale bar. I trace a certain
> distance, go to the set scale window, enter the known length and unit,
> check "global" and click OK. Then I open a tiff image showing a leaf
> venation (same resolution and dimension than the scale bar image), select
> the polygon selection tool, increase the line width to 10 and change its
> color so I can see it. First I trace a box on my image, measure its
> surface area (M key) and embed it on my image (D key). Then I reset the
> result window, select the segmented line tool and start tracing lines
> following the vein pattern. Everytime I stop, I press the M key to measure
> the length of the line I just traced, followed by the D key to embed the
> line on my image. Problems: (1) the lines (traced with the segmented line
> tool) don’t appear on the image when I press D and (2) after about 10
> measurements, ImageJ stop and an exception window appear with the
> following message:
> java.lang.ArrayIndexOutOfBoundsException: 0
> at ij.gui.PolygonRoi.fitSplineForStraightening(PolygonRoi.java:617)
> at ij.plugin.Straightener.straightenLine(Straightener.java:98)
> at ij.plugin.filter.Analyzer.measureLength(Analyzer.java:327)
> at ij.plugin.filter.Analyzer.measure(Analyzer.java:203)
> at ij.plugin.filter.Analyzer.run(Analyzer.java:86)
> at ij.plugin.filter.PlugInFilterRunner.processOneImage
> (PlugInFilterRunner.java:245)
> at ij.plugin.filter.PlugInFilterRunner.<init>(PlugInFilterRunner.java:102)
> at ij.IJ.runPlugIn(IJ.java:150)
> at ij.Executer.runCommand(Executer.java:121)
> at ij.Executer.run(Executer.java:58)
> at java.lang.Thread.run(Thread.java:619)
>
> What is going on? I have Vista home premium 32bit and this method was
> working fine with ImageJ 1.38. But I upgraded ImageJ recently and it is no
> good anymore. Any help would be greatly appreciated. Thanks.
>
> David
>
Reply | Threaded
Open this post in threaded view
|

Re: Line length and tracing - exception window

Wayne Rasband
On Aug 28, 2009, at 3:14 PM, Michael Schmid wrote:

> Hi David,
>
> yes, I could reproduce the exception with the lastest daily build.
> (Windows XP, Java 1.5.0_09)
> It can occur when typing 'M' before the line segment has more than one
> point (i.e., while it has only one anchor at the starting point, and  
> the
> end point is still under cursor control), but it can also occur with
> longer selections.
> After the exception, everything becomes weird; the image is not updated
> any more, the keyboard shortcuts don't work (seems that the  
> ImageCanvas is
> damaged). It starts to work again if I use the rectangular selection  
> and
> move the cursor into the ImageCanvas (sometimes I have to click into  
> it).
>
> Even more strange: It seems that the problem needs a calibration with  
> less
> than 1 unit per pixel.

This bug is fixed in the 1.43g daily build.

> One related issue: I do not understand why "Measure" on a polygon roi  
> with
> line thickness>1 always creates a spline fit.

ImageJ uses the straighten function (Edit>Selection>Straighten) to  
measure area, mean, etc. of segmented lines selections with a width  
greater than 1 pixel, and the straighten function does a spline fit.

-wayne


>
> Michael
> ________________________________________________________________
>
> On Tue, August 25, 2009 23:36, David Chatelet wrote:
>> Hi,
>> I am trying to measure the vein length of leaves but ImageJ stops and  
>> a
>> exception window open. Here is what I do:
>> First I open a tiff or jpeg image of a scale bar. I trace a certain
>> distance, go to the set scale window, enter the known length and unit,
>> check "global" and click OK. Then I open a tiff image showing a leaf
>> venation (same resolution and dimension than the scale bar image),  
>> select
>> the polygon selection tool, increase the line width to 10 and change  
>> its
>> color so I can see it. First I trace a box on my image, measure its
>> surface area (M key) and embed it on my image (D key). Then I reset  
>> the
>> result window, select the segmented line tool and start tracing lines
>> following the vein pattern. Everytime I stop, I press the M key to  
>> measure
>> the length of the line I just traced, followed by the D key to embed  
>> the
>> line on my image. Problems: (1) the lines (traced with the segmented  
>> line
>> tool) don’t appear on the image when I press D and (2) after about 10
>> measurements, ImageJ stop and an exception window appear with the
>> following message:
>> java.lang.ArrayIndexOutOfBoundsException: 0
>> at ij.gui.PolygonRoi.fitSplineForStraightening(PolygonRoi.java:617)
>> at ij.plugin.Straightener.straightenLine(Straightener.java:98)
>> at ij.plugin.filter.Analyzer.measureLength(Analyzer.java:327)
>> at ij.plugin.filter.Analyzer.measure(Analyzer.java:203)
>> at ij.plugin.filter.Analyzer.run(Analyzer.java:86)
>> at ij.plugin.filter.PlugInFilterRunner.processOneImage
>> (PlugInFilterRunner.java:245)
>> at  
>> ij.plugin.filter.PlugInFilterRunner.<init>(PlugInFilterRunner.java:
>> 102)
>> at ij.IJ.runPlugIn(IJ.java:150)
>> at ij.Executer.runCommand(Executer.java:121)
>> at ij.Executer.run(Executer.java:58)
>> at java.lang.Thread.run(Thread.java:619)
>>
>> What is going on? I have Vista home premium 32bit and this method was
>> working fine with ImageJ 1.38. But I upgraded ImageJ recently and it  
>> is no
>> good anymore. Any help would be greatly appreciated. Thanks.
>>
>> David
>>
>