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

Opened 2012-08-23T15:24:14-05:00

Last modified 2012-10-12T12:23:11-05:00

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)

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 2012-08-23T15:24:49-05:00 by bdezonia

  • Blocked By 1250 added

comment:2 Changed 2012-08-23T15:26:43-05:00 by bdezonia

  • Blocking 1395 added

comment:3 Changed 2012-08-23T15:34:34-05:00 by bdezonia

  • Description modified

comment:4 Changed 2012-09-14T10:13:12-05:00 by bdezonia

  • Blocking 1456 added

comment:5 Changed 2012-09-14T10:14:05-05:00 by bdezonia

  • Blocking 1395 removed

comment:6 Changed 2012-10-09T14:30:24-05:00 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 2012-10-10T13:20:17-05:00 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 2012-10-10T13:59:27-05:00 by curtis

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

comment:9 Changed 2012-10-11T12:43:31-05:00 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 2012-10-12T12:21:59-05:00 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 2012-10-12T12:22:10-05:00 by bdezonia

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

comment:12 Changed 2012-10-12T12:23:11-05:00 by bdezonia

  • Blocking 1508 added; 1456 removed