Ticket #1335 (closed defect: fixed)

Opened 8 years ago

Last modified 7 years ago

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


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

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 8 years ago by bdezonia

  • Blocking 1345 added

comment:2 Changed 8 years ago 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 8 years ago by bdezonia

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

comment:4 Changed 8 years ago by curtis

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

comment:5 Changed 7 years ago by bdezonia

  • Status changed from assigned to reviewing

comment:6 Changed 7 years ago 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 7 years ago by bdezonia

  • Blocking 1563 added; 1457 removed
  • Milestone changed from imagej2-b8-analysis to imagej2-b7-ndim-data
Note: See TracTickets for help on using tickets.