Ticket #1432 (closed defect: fixed)

Opened 7 years ago

Last modified 7 years ago

Implement a pure IJ2 measurement facility

Reported by: bdezonia Owned by: bdezonia
Priority: major Milestone: imagej2-b5-scripting
Component: Core Version:
Severity: serious Keywords:
Cc: Blocked By: #1250
Blocking: #1508

Description (last modified by bdezonia) (diff)

Once we have created an IJ2 version of the results table we'll want to define an IJ2 measurement API. We would eventually replace the Analyze > Measure and Analyse > Set Measurements plugins. Some of that work is already required by other tickets (such as #1319).

Anyhow a measurement service that could take images, subregions definitions, and produce outputs (given any metric implementation of a Stat interface) would be useful. Using the functional interfaces of Imglib OPS would make this quite easy.

Change History

comment:1 Changed 7 years ago by bdezonia

  • Blocked By 1250 added

comment:2 Changed 7 years ago by bdezonia

  • Blocking 1395 added

comment:3 Changed 7 years ago by bdezonia

  • Description modified (diff)

comment:4 Changed 7 years ago by bdezonia

  • Blocking 1456 added

comment:5 Changed 7 years ago by bdezonia

  • Blocking 1395 removed

comment:6 Changed 7 years ago by bdezonia

To be clear we don't need a Stat interface. Any statistic can be implemented as a Function<PointSet,DoubleType> (for instance). Users can defines a set of points in a PointSet and call Function::compute() for the PointSet of an input Dataset to get a result. The PointSet can be irregularly shaped using any combination of the PointSet implementations (or ones the API user creates themselves).

comment:7 Changed 7 years ago by bdezonia

I've done some work on this problem on the measurement branch. In that branch I define a MeasurementService. But it is hobbled at the moment. It generates compile time warnings on each call to measure(). It also uses reflection which we should avoid. Finally it only correctly handles Functions that take a single argument (the data to sample) to their constructor.

ctrueden mentioned that we could rely on Command/Module code to handle varying number of varying types of constructor arguments. this might help avoid us reinventing code. however it may duplicate other code already present in OPS (like the actual functions that compute things right now).

comment:8 Changed 7 years ago by curtis

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

comment:9 Changed 7 years ago by bdezonia

After discussing optimization with Aivar:

  • optimize measurement api so that values can be reused rather than recalced. For instance you could write a Function<PointSet,BundleOfStats>. The function could gather a family of stats and utilize partial results. So have a function that computes mean AND std dev and uses the result of the mean to calc the std dev. Gathering all moments is similar idea.
  • make general where you can pass it a set of measurements to make and it will do so passing over data once for efficiency. i.e. calc(avg, skew, median, ...)

comment:10 Changed 7 years ago by bdezonia

  • Status changed from new to closed
  • Resolution set to fixed

With commit 3337a580c265a21e538fc7092a03dbbd43e3ed9a a MeasurementService is in place and merged to master.

It is simple to use and supports both kinds of optimizations Aivar and I discussed.

comment:11 Changed 7 years ago by bdezonia

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

comment:12 Changed 7 years ago by bdezonia

  • Blocking 1508 added; 1456 removed
Note: See TracTickets for help on using tickets.