Ticket #1517 (closed defect: fixed)

Opened 8 years ago

Last modified 7 years ago

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


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

  • Blocking 1519 added

comment:2 Changed 8 years ago 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 7 years ago 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 7 years ago by curtis (previous) (diff)

comment:4 Changed 7 years ago 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 7 years ago by curtis

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

comment:6 Changed 7 years ago by bdezonia

  • Status changed from new to closed
  • Resolution set to fixed
Last edited 7 years ago by bdezonia (previous) (diff)
Note: See TracTickets for help on using tickets.