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

Opened 2012-10-11T15:50:13-05:00

Last modified 2013-07-22T12:57:05-05:00

Eliminate PrimitveDoubleArray

Reported by: bdezonia Owned by: bdezonia
Priority: major Milestone: imagej2-b8-analysis
Component: ImgLib2 OPS Version:
Severity: serious Keywords:
Cc: Blocked By:
Blocking: #1519

Description

OPS has a class called PrimitiveDoubleArray for computation speed by avoiding Object overhead. It's possible that it can be eliminated in favor of an ArrayImg<DoubleType>. But PrimitiveDoubleArray may have extra functionality (like auto resize, a "top" beyond which values may exist but are considered nonexistent, the ability to sort, etc. Investigate if we can replace needed functionality with ArrayImg.

Change History

comment:1 Changed 2012-10-11T15:57:22-05:00 by bdezonia

  • Blocking 1519 added

comment:2 Changed 2012-11-05T15:35:48-06:00 by bdezonia

Note that #1562 showed a problem with relying on PrimitiveDoubleArray. And that problem should still exist for grabbing stats from StatCalculator on large images (for those stats that use PrimitiveDoubleArray: Adaptive Median, Trimmed Mean). So the need for this fix is immediately useful.

We need to make an Img that can be backed by DoubleType, that uses a fixed memory footprint, can act like a virtual buffer so that it can hold a lot of values, can be cleared without freeing up resources if desired, and can sort the values within it (not necessarily all allocated values but all values of interest). (This last statement means I may allocate 80 ints but populate 10 of them and I want to sort the first 10 only). This last bit of functionality is necessary for median and trimmed mean code.

comment:3 Changed 2013-02-01T14:22:57-06:00 by curtis

Did you notice the class imagej.util.DoubleArray? Same thing, but implements the Java Collections API.

I am becoming increasingly convinced that we should have a scijava-common project, and use it in ImageJ2 and ImgLib2 and SCIFIO. We could move some of the imagej.util stuff there.

Last edited 2013-02-01T14:23:11-06:00 by curtis

comment:4 Changed 2013-07-19T16:14:20-05:00 by bdezonia

There is now a scijava-common and the arrays are there. But Imglib2 does not depend upon it. Is that an oversight? I am trying to complete this ticket and cannot. Imglib2 only has once dependency: junit. CTR, do you know this off the top of your head?

comment:5 Changed 2013-07-22T12:06:07-05:00 by curtis

As  discussed on fiji-devel, let's add scijava-common as a dependency to imglib2-ops only for now.

comment:6 Changed 2013-07-22T12:57:05-05:00 by bdezonia

  • Status changed from new to closed
  • Resolution set to fixed
Last edited 2013-07-22T12:58:35-05:00 by bdezonia