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 #1335 (closed defect: fixed)

Opened 2012-07-17T11:44:23-05:00

Last modified 2013-05-31T16:14:57-05:00

Cropping results in exception and does not change data

Reported by: bdezonia Owned by: curtis
Priority: major Milestone: imagej2-b7-ndim-data
Component: Plugins Version:
Severity: serious Keywords:
Cc: rob.vanthof@… Blocked By:
Blocking: #1563

Description

In the ImageJ maling list Rob van 't Hof reported the following issue with beta 3:

"When I create a rectangular selection and run "crop" nothing happens."

To duplicate open boats, draw a rectangular selection, and run crop. Nothing happens. When run from Eclipse you can see an exception has been thrown:

[ERROR] Exception
java.lang.UnsupportedOperationException

at imagej.data.AbstractData.getExtents(AbstractData.java:150)
at imagej.data.display.DefaultOverlayService.getSelectionBounds(DefaultOverlayService.java:213)
at imagej.core.plugins.imglib.CropImage.run(CropImage.java:105)
at imagej.ext.plugin.PluginModule.run(PluginModule.java:161)
at imagej.ext.module.ModuleRunner.run(ModuleRunner.java:157)
at imagej.ext.module.ModuleRunner.call(ModuleRunner.java:119)
at imagej.ext.module.ModuleRunner.call(ModuleRunner.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)

Change History

comment:1 Changed 2012-07-17T16:41:20-05:00 by bdezonia

  • Blocking 1345 added

comment:2 Changed 2012-07-23T12:14:58-05:00 by bdezonia

  • Owner changed from bdezonia to curtis
  • Status changed from new to assigned

With commit 673859de1bd48f03b0d197d7b5f10b527fa221f0 a fix is in place that works for now. However I'm asking someone to review the code to verify that this approach is okay before closing this ticket.

comment:3 Changed 2012-09-07T11:01:46-05:00 by bdezonia

  • Blocking 1457 added; 1345 removed
  • Milestone changed from imagej-2.0.0-beta4 to imagej-2.0.0-beta5

comment:4 Changed 2012-10-10T14:00:18-05:00 by curtis

  • Milestone changed from imagej-2.0.0-beta6 to imagej-2.0.0-beta7

comment:5 Changed 2013-03-14T14:11:42-05:00 by bdezonia

  • Status changed from assigned to reviewing

comment:6 Changed 2013-03-19T16:02:20-05:00 by curtis

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

It seems a bit dangerous for an Overlay to support the getExtents() method, which returns long coordinates, when it is not a discrete entity. That is, an Overlay wraps a RegionOfInterest, which is a RealInterval but not an Interval. So having it pretend to be an Interval by clamping its min/max values to the exterior integer bounds seems disingenuous, and possibly bug-inducing.

That said, it's what we are currently doing. So for now, I changed the javadoc of isDiscrete() to explain that some methods of Interval may throw UnsupportedOperationException, rather than stating that they all would all the time like before. And I removed the explicit discreteness checks from AbstractData#getDims() and AbstractData#getExtents(). See 5bff70dd for details.

comment:7 Changed 2013-05-31T16:14:57-05:00 by bdezonia

  • Blocking 1563 added; 1457 removed
  • Milestone changed from imagej2-b8-analysis to imagej2-b7-ndim-data