NOTICE! This is a static HTML version of a legacy ImageJ Trac ticket.

The ImageJ project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Ticket #1986 (closed defect: fixed)

Opened 2013-08-19T11:53:36-05:00

Last modified 2013-08-19T14:28:53-05:00

Crop can throw an exception

Reported by: bdezonia Owned by: bdezonia
Priority: major Milestone: imagej2-b8-analysis
Component: Display API Version:
Severity: serious Keywords:
Cc: Blocked By:
Blocking: #1457


Open any image and run the crop command. Sometimes (and usually for images > 2d) an exception is thrown. Note that if you draw an overlay in the view afterwards the window is redrawn and you can see crop worked. The exception message is of the form "expected X converters but got Y" where X and Y vary (even being different between different runs of crop on the a fresh copy of the same image).

java.lang.IllegalArgumentException: Expected 1 converters but got 2

at net.imglib2.display.CompositeXYProjector.<init>(
at java.util.concurrent.FutureTask$Sync.innerRun(
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
at java.util.concurrent.ThreadPoolExecutor$

Change History

comment:1 Changed 2013-08-19T14:14:51-05:00 by bdezonia

The last two lines of CropImage::run() are:


here the duplicated and origin translated overlays are attached
overlayService.addOverlays(display, newOverlays);

The first line does a rebuild. And the second line does a rebuild once for each overlay being copied. Thus in this case you have multiple simultaneous rebuilds taking place that are messing with the same list of lut converters. Race conditions cause things to behave erratically.

One thing I can do is make some method synchronized that will fix this issue.

Another approach is to see how to avoid these multiple rebuilds. This used to work. I think the event processing was changed recently and something that used to queue serially now queues simultaneously.

comment:2 Changed 2013-08-19T14:28:53-05:00 by bdezonia

  • Status changed from new to closed
  • Resolution set to fixed

Took synchronized approach in DefaultDatasetView. Fixed with commit e51a46610a61a99721673bc18c5badfefce6c7d3