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


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 java.util.concurrent.FutureTask$Sync.innerRun(
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
at java.util.concurrent.ThreadPoolExecutor$

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