Skip to content
This repository was archived by the owner on Oct 26, 2026. It is now read-only.

Remove SciJava Common from Incubator Code - #57

Merged
ctrueden merged 3 commits into
mainfrom
scijava/scijava-ops-engine/sjc2-purge
Sep 7, 2022
Merged

ctrueden merged 3 commits into
mainfrom
scijava/scijava-ops-engine/sjc2-purge

Conversation

@gselzer

@gselzer gselzer commented Feb 11, 2022

Copy link
Copy Markdown
Member

This PR removes SciJava Common as a dependency for all incubator projects, additionally removing most mentions of SciJava Common.

To allow ImageJ Ops2 access to the Ops it describes, we expose DefaultOpEnvironment.

TODO:

  • Decide whether to clean this PR or just squash+merge. I'd prefer to squash.
  • Re-enable package cycles. These were turned off to prevent failures arising from the exposure of DefaultOpEnvironment.

@gselzer

gselzer commented Feb 18, 2022 •

Copy link
Copy Markdown
Member Author

@NicoKiaru I did not remove SJC from scijava-persist, instead moving the needed sections of the POM into scijava-persist's POM (done in a76e25f). If you'd like to the migration to SciJava Common3, I'd be happy to help as needed. The basic pattern I've been following is to create a class that does everything the Service does, with the intention of adding a Service later that can just wrap this class.

For example, SciJava Common's ParseService became SciJava Parse2's Parser.

@gselzer

gselzer commented Feb 18, 2022

Copy link
Copy Markdown
Member Author

@ctrueden everything should build as of this writing, although I am getting some inconsistent NPEs from LocalThresholdTest ☹️

@gselzer gselzer mentioned this pull request Mar 24, 2022
@ctrueden
ctrueden force-pushed the scijava/scijava-ops-engine/sjc2-purge branch 3 times, most recently from 791d5f1 to 48350d1 Compare July 2, 2022 02:30

@ctrueden ctrueden left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR was a mess. It was not done on top of the previous PR in the chain (#56). It en masse changed line ending styles, which created some challenges with git's ability to rebase patches. And it had many WIPs.

Since @gselzer said he wants to squash this branch, I have gone ahead and done so, force pushing the result here. I also split out the dos2unix filtering step onto the main branch as a separate commit, then rebased this PR's work as 48350d1 on top. Unfortunately, there are quite a few conflicts, and I did not have time to investigate and fix all of them, so the sole commit of this PR currently embeds conflicts which need to be fixed, and the commit subsequently amended accordingly. @gselzer Please take a careful look when you have time. The good news is that many of them are simple import conflicts. But there are a few more involved patch reconciliations that will need to be done.


import org.scijava.ops.api.OpEnvironment;
import org.scijava.ops.api.OpInfo;
<<<<<<< HEAD

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note the conflicts embedded in this commit. I did this so that they can be subsequently fixed, and the commit amended, while establishing the proper new base on top of the current main branch.

@ctrueden
ctrueden marked this pull request as ready for review August 8, 2022 18:43
ctrueden and others added 2 commits August 10, 2022 15:42
We need to purge imagej-common as a prerequisite to purging
scijava-common usage, since imagej-common depends on scijava-common.

We were barely using ImgPlus, and are not using Dataset.

We *are* using BigComplex and UnboundedIntegerType though,
so those have migrated into imagej-ops2 from imagej-common.
Ideally, these classes would become part of the imglib2 library layer
somewhere, so their presence in imagej-ops2 might be temporary.

Co-authored-by: Curtis Rueden <ctrueden@wisc.edu>
@ctrueden
ctrueden force-pushed the scijava/scijava-ops-engine/sjc2-purge branch from 17f6102 to c542be9 Compare August 10, 2022 22:05
@ctrueden

Copy link
Copy Markdown
Member

Thanks @gselzer for the cleanup. I made some progress on this PR today, carving out a couple of smaller initial commits from the mega-chonker: in particular, there is now a commit that removes the imagej-common dependency first, migrating in the BigComplex and UnboundedIntegerType classes from net.imagej.types to net.imagej.ops2.util for now. Eventually these could migrate upstream to ImgLib2, but it's a good enough relocation for the moment.

As of this writing, the tip of this branch (c542be9) compiles all modules successfully, although I did not have time to run all the unit tests yet.

I am not finished reviewing this work. In addition to verifying that tests all pass, I'd like to look for other easily separable patches to split into their own commits, while maintaining a pragmatic balance of time. I have a couple of questions about the removal of certain functionalities—e.g. the various Converter plugins, whether we need to invent a new converter plugin mechanism in incubator and then migrate those classes to use it. In which case: we probably shouldn't just delete them in the meantime, but rather migrate them prior to merging this branch purging SJC2. Or at minimum: write down what got removed as an issue, with the goal being to restore these converters within a new conversion subsystem. Anyway, splitting conceptually different changes into their own commits makes it easier to talk about exactly what has changed here, and cherry-pick individual commits depending on the outcome of such conversation.

@ctrueden

ctrueden commented Sep 7, 2022

Copy link
Copy Markdown
Member

On macOS I see the following failures:

[ERROR] Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.12 s <<< FAILURE! - in net.imagej.ops2.features.tamura2d.Tamura2dFeatureTest
[ERROR] testCoarsenessFeature  Time elapsed: 0.99 s  <<< ERROR!
java.lang.ArrayIndexOutOfBoundsException
	at net.imagej.ops2@0-SNAPSHOT/net.imagej.ops2.features.tamura2d.Tamura2dFeatureTest.testCoarsenessFeature(Tamura2dFeatureTest.java:65)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 10000 out of bounds for length 10000
...
[INFO] Running net.imagej.ops2.filter.NonLinearFiltersTest
[ERROR] Tests run: 6, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.52 s <<< FAILURE! - in net.imagej.ops2.filter.NonLinearFiltersTest
[ERROR] testMaxFilter  Time elapsed: 0.004 s  <<< ERROR!
java.lang.ArrayIndexOutOfBoundsException
	at net.imagej.ops2@0-SNAPSHOT/net.imagej.ops2.filter.NonLinearFiltersTest.testMaxFilter(NonLinearFiltersTest.java:89)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 100 out of bounds for length 100

but I also see similar failures on the main branch, before this PR. I also see that the CI passed for this PR, so I'm going to assume it's a preexisting Mac-specific thing. Still needs to be investigated, but I won't bother filing an issue yet because we're bound to stumble across it again as we continue development.

To allow ImageJ Ops2 access to the Ops it describes,
we expose DefaultOpEnvironment.

Obviously, SciJava Discovery Plugin is a Discovery mechanism used
to gain access to Plugins, so it still depends on SciJava Common.

I'll leave the migration of SciJava Persist to Nico.

The following is a non-exhaustive list of changes in this patch:

* Needed classes from scijava-common were migrated to a new
  scijava-common3 component.

* Non-generics-specific methods from the Types class were migrated to a
  new utility class called Classes.

* The Simplifier plugin type has been replaced with two new special ops:
  simplify and focus.

* The LabelRegionToPolygonConverter and RAIToMeshConverter were removed.
  These classes will need to migrate to more suitable locations.
  RAIToMeshConverter should probably go into imagej-mesh, and
  LabelRegionToPolygonConverter should probably go into imagej-common.

* The equation op has been removed, since it relied on the
  JavaScriptScriptLanguage plugin. We will have to consider how best
  to restore this functionality, if indeed it needs to be restored.

* The NilConverter, which rendered proxy objects from nils using
  Nil.proxy(), has been removed. It is not needed, since SciJava Ops
  does not make use of the legacy SciJava converter subsystem anymore.

Signed-off-by: Curtis Rueden <ctrueden@wisc.edu>
@gselzer

gselzer commented Sep 7, 2022

Copy link
Copy Markdown
Member Author

On macOS I see the following failures:

[ERROR] Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.12 s <<< FAILURE! - in net.imagej.ops2.features.tamura2d.Tamura2dFeatureTest
[ERROR] testCoarsenessFeature  Time elapsed: 0.99 s  <<< ERROR!
java.lang.ArrayIndexOutOfBoundsException
	at net.imagej.ops2@0-SNAPSHOT/net.imagej.ops2.features.tamura2d.Tamura2dFeatureTest.testCoarsenessFeature(Tamura2dFeatureTest.java:65)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 10000 out of bounds for length 10000
...
[INFO] Running net.imagej.ops2.filter.NonLinearFiltersTest
[ERROR] Tests run: 6, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.52 s <<< FAILURE! - in net.imagej.ops2.filter.NonLinearFiltersTest
[ERROR] testMaxFilter  Time elapsed: 0.004 s  <<< ERROR!
java.lang.ArrayIndexOutOfBoundsException
	at net.imagej.ops2@0-SNAPSHOT/net.imagej.ops2.filter.NonLinearFiltersTest.testMaxFilter(NonLinearFiltersTest.java:89)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 100 out of bounds for length 100

but I also see similar failures on the main branch, before this PR. I also see that the CI passed for this PR, so I'm going to assume it's a preexisting Mac-specific thing. Still needs to be investigated, but I won't bother filing an issue yet because we're bound to stumble across it again as we continue development.

@ctrueden is it reproducible?

I feel like I spent time debugging a similar issue earlier, and that it ended up being a bug in LoopBuilder. I don't remember where I reported this, though...

@gselzer

gselzer commented Sep 7, 2022

Copy link
Copy Markdown
Member Author

Aha, found it the imglib/imglib2 Gitter

@ctrueden
ctrueden force-pushed the scijava/scijava-ops-engine/sjc2-purge branch from c542be9 to ef865a8 Compare September 7, 2022 21:11
@ctrueden

ctrueden commented Sep 7, 2022

Copy link
Copy Markdown
Member

I finished my review of this PR. I force-pushed an amended version of the big chonker commit, which does not try to tease anything new apart, but does add a better description of what exactly the changes entail. There is only one change that concerns me as potentially losing important stuff: the deletion of LabelRegionToPolygonConverter and RAIToMeshConverter. But these still exist in imagej-ops v1, so it's probably fine. We could migrate each of them to a better place upstream—the former to imagej-common and the latter to imagej-mesh—but it's not a huge deal.

@ctrueden

ctrueden commented Sep 7, 2022

Copy link
Copy Markdown
Member

CI failed because imagej.nih.gov is currently down. This matters because the pom-scijava-base javadoc configuration currently links in several sources including that one. We really need to fix it to use javadoc.scijava.org only for everything. Once I finished the javadoc-wrangler this will no longer be a issue. Until then... we ignore the problem!

@ctrueden
ctrueden merged commit a245ba7 into main Sep 7, 2022
@ctrueden
ctrueden deleted the scijava/scijava-ops-engine/sjc2-purge branch September 7, 2022 21:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants