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 #465 (closed enhancement: fixed)

Opened 2011-04-28T17:00:57-05:00

Last modified 2011-07-22T12:39:51-05:00

Rename imagej.util.Index

Reported by: gharris Owned by: bdezonia
Priority: trivial Milestone: biweekly-2011: Jul-18 to Jul-29
Component: Core Version:
Severity: minor Keywords:
Cc: Blocked By:
Blocking:

Description

Something more descriptive of its role in converting between 1 and N dimensions...
Also, "Index" might be confused with Index in SezPoz
(Perhaps it could be combined with Dimensions?)

Change History

comment:1 Changed 2011-05-23T10:23:31-05:00 by curtis

  • Milestone changed from biweekly-2011: May-09 to May-20 to biweekly-2011: May-23 to Jun-03

I like the idea of combining with Dimensions. Will discuss with Barry later this week.

comment:2 Changed 2011-06-20T15:26:08-05:00 by curtis

  • Priority changed from minor to trivial
  • Severity changed from serious to minor
  • Milestone changed from biweekly-2011: Jun-06 to Jun-17 to imagej-2.0-beta2

It would be good to reduce and/or eliminate the Index and Dimensions utility classes, in favor of two classes: Position and Extents. The Extents class wraps a long[] and represents the dimensional sizes of an N-dimensional structure. A Position has an Extents associated with it, but also another long[] which is the current position. Both can return either a long[] for the value per dimension, or long index for the rasterized value usable in flattened one-dimensional structures.

We should also model usage of these classes after ImgLib2, in that they are passed as preallocated parameters to methods which populate them in-place, thus avoiding memory allocation per method call.

comment:3 Changed 2011-07-19T11:30:36-05:00 by bdezonia

Implemented Position class, Extents class, and related test clases in dc4b137e07c3ab3246b5f0abf798d3f1094363d5.

comment:4 Changed 2011-07-19T11:56:45-05:00 by bdezonia

I have found while implementing imglib-ops that it is useful to iterate subregions. We could make Extents be constructed from an origin and relative extents. The general case is to pass a zero origin and full image extents. But you could pass subregions. Make Position first(), last(), fwd(), back(), move(), etc. set the position to mins and maxes as needed.

comment:5 Changed 2011-07-19T12:12:09-05:00 by bdezonia

After some discussion a few things come to mind:

  • make these classes implement interfaces in Imglib. This will add an Imglib dependency anywhere they are used so maybe make them part of ij-data rather than ij-core(util).
  • make these classes parametric taking types like int[] and long[] so we can reuse their basic logic. Have the various get/set routines take T's (that are Integer or Long etc.). Maybe have something like Extents<Integer,int[]> and Extents<Long,long[]>.

comment:6 Changed 2011-07-19T17:28:52-05:00 by bdezonia

Implemented the Imglib interfaces (Interval, Positionable, Localizable, and Iterator) in Position and Extents. Placed in ij-data. Wrote supporting test classes.

comment:7 Changed 2011-07-20T09:10:04-05:00 by curtis

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

Thanks Barry. I'm officially reassigning to you since you are actively working on it. Sounds like we will be able to close it soon.

comment:8 Changed 2011-07-20T16:43:08-05:00 by bdezonia

Have further refined Position and Extents classes. Replaced all references to Dimensions/Index/Span to use Position/Extents. Code is functioning. However some algorithms could be improved by using Positions and Extents rather than their own special case code.

comment:9 Changed 2011-07-22T11:01:15-05:00 by bdezonia

Replaced code in places that used code like long[] getPlanePosition() to now rely on a Position as the return value.

comment:10 Changed 2011-07-22T12:39:51-05:00 by bdezonia

  • Status changed from assigned to closed
  • Resolution set to fixed
  • Milestone changed from imagej-2.0-beta2 to biweekly-2011: Jul-18 to Jul-29

Replaced code in numerous places that could beneift from using Positions. There are plenty of places that use long[]'s but replacing that existing code may not get much bang for the buck. Going forward we must rely on Position more and more.