NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug.

The Fiji project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Bug 1052 - Stack overflow upon measuring perimeter of a rounded rectangle ROI
Stack overflow upon measuring perimeter of a rounded rectangle ROI
Status: RESOLVED FIXED
Product: Fiji
Classification: Unclassified
Component: ImageJ1
unspecified
PC Windows
: P5 minor
Assigned To: Wayne Rasband
Depends on:
Blocks:
 
Reported: 2015-04-09 03:57 CDT by Jurriaan Hölzenspies
Modified: 2015-04-09 23:52 CDT
2 users (show)

See Also:

Description Jurriaan Hölzenspies 2015-04-09 03:57:11 CDT
Measuring the perimeter of a rectangular ROI after using Edit>Selection>Make rectangular selection rounded causes a stack overflow exception.

Macro to reproduce the error:
newImage("ROI_crash", "8-bit black", 1392, 1040, 1);
makeRectangle(660, 222, 80, 80);
run("Set Measurements...", "area mean min centroid center perimeter display redirect=None decimal=3");
run("Make rectangular selection rounded", "radius=5");
run("Measure");

Exception:
java.lang.StackOverflowError
        at java.awt.geom.Path2D$Float$TxIterator.currentSegment(Path2D.java:952)
        at ij.gui.ShapeRoi.parsePath(ShapeRoi.java:891)
        at ij.gui.ShapeRoi.getRois(ShapeRoi.java:463)
        at ij.gui.ShapeRoi.getLength(ShapeRoi.java:651)
        at ij.gui.ShapeRoi.getLength(ShapeRoi.java:657)

The last line is repeated many times.
Comment 1 Jurriaan Hölzenspies 2015-04-09 03:59:15 CDT
Information about your version of Java:

  os.arch => amd64
  os.name => Windows 7
  os.version => 6.1
  java.version => 1.6.0_24
  java.vendor => Sun Microsystems Inc.
  java.runtime.name => Java(TM) SE Runtime Environment
  java.runtime.version => 1.6.0_24-b07
  java.vm.name => Java HotSpot(TM) 64-Bit Server VM
  java.vm.version => 19.1-b02
  java.vm.vendor => Sun Microsystems Inc.
  java.vm.info => mixed mode
  java.awt.graphicsenv => sun.awt.Win32GraphicsEnvironment
  java.specification.name => Java Platform API Specification
  java.specification.version => 1.6
  sun.cpu.endian => little
  sun.desktop => windows
  file.separator => \

The up-to-date check says: UPDATEABLE

Information relevant to JAVA_HOME related problems:

  JAVA_HOME is set to: D:\Programs\FIJI-W~1\Fiji.app/java/win64/jdk1.6.0_24//jre
  imagej.dir => D:\Programs\FIJI-W~1\Fiji.app

Information about the version of each plugin:

Activated update sites:
ImageJ: http://update.imagej.net/ (last check:20150327235348)
Fiji: http://fiji.sc/update/ (last check:20150408073904)
Comment 2 Curtis Rueden 2015-04-09 11:53:10 CDT
Thanks for the excellent bug report!

I confirm that the macro in question produces the given StackOverflowError on OS X 10.10.2 with a fully up-to-date (Fiji is Just) ImageJ 2.0.0-rc-28/1.49q.

The issue is triggered because of Fiji's "Make rectangle selection rounded" plugin, which can be found here:

  https://github.com/fiji/Fiji_Plugins/blob/Fiji_Plugins-3.0.0/src/main/java/fiji/selection/Rounded_Rectangle.java

Without digging further, my guess is that that plugin produces a ROI with degenerate segments, or something similar.

Wayne: if you think the fix should happen on the Fiji_Plugins side, feel free to reassign the issue to me.
Comment 3 Wayne Rasband 2015-04-09 23:52:32 CDT
The latest ImageJ daily build (1.49r15) fixes this bug. The perimeter is set to zero.