Skip to content

Migrate tables from imagej-common #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 42 commits into from
Aug 11, 2018
Merged

Conversation

imagejan
Copy link
Member

This PR migrates the classes in the net.imagej.table package from imagej-common into the org.scijava.table package of this repository, keeping their git commit history.

The ImageJ-specific classes (that had references to Img) were removed. ResultsTable will be replaced by DoubleTable in another commit, and an ImageJ-specific implementation of ResultsTable can remain in imagej-common.

This PR supersedes #1 that didn't contain the git history of the affected files.

imagejan and others added 30 commits July 17, 2018 12:29
In this specific case (double[] and double[][]), it is easy to wrap the
data in DoubleColumn objects. Ideally, we want to support all types of
primitive 1D and 2D arrays, or even all Collection<N extends Number>,
but that will require a little more infrastructural work to accomplish.
This approach is good enough for now, for MATLAB matrix support, which
always uses doubles.
This makes the necessary code changes to account for backwards
incompatibilities.

It also updates several dependencies to their latest versions,
and removes the obsolete imglib2-ops dependency.
There is still much work to be done cleaning up the ImgPlus class and
related interfaces. However, this is an important first step.
Thanks, Java 7!
When appending or inserting a new column into a table, the backing
arrays for those columns will now be initialized. This prevents null
pointer exceptions when attempting to modify appended or inserted
columns.
The loops for shifting the rows/columns now loop backwards. This was
done because if the loops go forwards it doesn't shift the rows/columns, it instead repeats the column/row following the insert.
Prior to this change the removal would end at the specified row, instead
of starting from it.
awalter17 and others added 10 commits July 17, 2018 12:29
This change is an attempt to address two related problems:

1. There are no Display plugins (and hence no DisplayViewers)
   for numbers or booleans.

2. The DisplayPostprocessor tries to handle each output using its own
   Display, which is pretty clunky when there are several simple
   (text/number/boolean) outputs and several windows pop up.

This postprocessor acts just before the display postprocessor,
aggregating all simple outputs into a single GenericTable, which is
then shown to the user via the UIService.

The heuristic on whether and how to use a table is as follows:

- Only simple outputs are included: text, numbers and booleans.

- If there is only a single simple output, and it is text, no
  table is created. This minimizes negative impact on certain
  existing plugins which produce a large amount of text output
  and expect it to be displayed in a TextDisplay.
If the output type is Object, let's look at the actual object value when
deciding whether to lump it into the table. We use this heuristic here
because an Object output is very often the default "result" output, and
we want that value to show in the table if its type is compatible.
If there isn't one, we simply do nothing.

This avoids "Required service is missing" injection
errors when instantiating this postprocessor.
This updates the code to use the revised ImgFactory API.
Also remove temporary imagej-common dependency
@imagejan
Copy link
Member Author

imagejan commented Jul 17, 2018

@ctrueden please let me know if you're fine with this.

My next steps would be:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants