-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add SACA framework Op and SACA use case #156
Conversation
This commit adds Shulei and Ellen's SACA code from imagej/imagej-ops coloc-multithread-saca branch from commit b12ce2904945f7cf14db105e86f917d113279b63. This is right before Ellen commited a WIP first attempt to multithread SACA. While it works there are notes indicating that the output is still slow and does not conform to Shulei's output from the original R package. Given this, I felt it best to start the SciJava Ops port from the last known working state and then make progress towards resolving the Op performance and output results in the SciJava Ops framework.
This commit converts the imagej op copied from the saca branch to a SciJava op. This Op works, however it is not multithreaded and it produces NaN results at the edge of the heatmap.
Shulei's original SACA code also sets NaN's to 0.
To multithread the singleiteration function, we need to use the chunked LoopBuilder. This results in about a ~40% reducing in processing time.
The SACA framework has three components: - Z score heatmap - SigPixel matrix - pValue matrix The Z score heatmap is the result of weighted kendall tau operation. The SigPixel (significant pixel) and pValue results are derived from the heatmap Z score. Thus to use the SigPixel and pValue matrix outputs the user needs to first create the Z score heatmap.
The goal here is to let Adaptation make this op a Function.
This commit is a rebase of the saca branch with main. For some reason the simplify/RAIFocusersTest.java file was kept and not removed during the rebase. This commit removes it and updates the OpRegressionTest count.
The loop builder introduces a non-reproducible randomness to the SACA algorithm. Unfortnately, we need stop using the multithreaded version of the loop builder to resolve this.
This commit adds a test for the SACA framework. It tests all three Ops in the "coloc.saca" namespace. A slice is taken of both input test data and processed using SACA. 10 positions are sampled on all three SACA outputs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elevans by and large this looks great! Thank you for porting this - just a couple small changes, none of which I'd expect to take any real work.
The one strange thing here is that there are edits to RAIFocusers.java
and related templates which are probably unnecessary. Can we see if this PR still works without those changes? Same goes for the edits to SciJava Ops Engine changes - I think I put comments on each
scijava-ops-image/templates/main/java/org/scijava/ops/image/simplify/RAIFocusers.vm
Outdated
Show resolved
Hide resolved
scijava-ops-image/templates/test/java/org/scijava/ops/image/simplify/RAIFocusersTest.vm
Outdated
Show resolved
Hide resolved
scijava-ops-image/templates/main/java/org/scijava/ops/image/simplify/RAIFocusers.list
Outdated
Show resolved
Hide resolved
scijava-ops-image/templates/test/java/org/scijava/ops/image/simplify/RAIFocusersTest.list
Outdated
Show resolved
Hide resolved
scijava-ops-engine/src/main/java/org/scijava/ops/engine/impl/DefaultOpEnvironment.java
Outdated
Show resolved
Hide resolved
scijava-ops-image/src/main/java/org/scijava/ops/image/coloc/saca/SACAHeatmapPValue.java
Outdated
Show resolved
Hide resolved
scijava-ops-image/src/main/java/org/scijava/ops/image/coloc/saca/WtKendallTau.java
Show resolved
Hide resolved
scijava-ops-image/src/main/java/org/scijava/ops/image/simplify/RAIFocusers.java
Outdated
Show resolved
Hide resolved
scijava-ops-image/src/test/java/org/scijava/ops/image/coloc/saca/SACATest.java
Show resolved
Hide resolved
scijava-ops-image/src/test/java/org/scijava/ops/image/coloc/saca/SACATest.java
Outdated
Show resolved
Hide resolved
@gselzer Absolutely! So the |
I don't see anything that needs revision beyond what Gabe said. Thanks @elevans! |
Thanks! Almost done! |
I accidently left these RAIFocusers in from a rebase.
This commit removes some code changes that I think I applied from a rebase from one experimental branch to the SACA one. I checked the log history in main and couldn't find the code changes there. Regardless, they are not needed. This commit should now align with the current ops engine in main.
96713b3
to
63780ff
Compare
@gselzer Thanks for the awesome review. I think I've replied to everything and addressed all comments. Its ready for another look! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elevans thank you so much for addressing my prior review! More Ops = a better framework!
...unfortunately, I'd suggest a couple more things 😅
scijava-ops-image/src/main/java/org/scijava/ops/image/stats/DefaultPNorm.java
Outdated
Show resolved
Hide resolved
scijava-ops-image/src/test/java/org/scijava/ops/image/coloc/saca/SACATest.java
Show resolved
Hide resolved
scijava-ops-image/src/test/java/org/scijava/ops/image/stats/DefaultPNormTest.java
Outdated
Show resolved
Hide resolved
15c858b
to
9f4a1b4
Compare
This commit converts the PNorm.java helper class into an Op in the `stats` namespace. This commit also adds a test for this new Op.
This commit converts the QNorm.java helper class for SACA into an Op. This commit also includes a test for this new Op.
This commit refactors the coloc.saca namespace tests
This commit refactors the SACA test to use a setup helper method create the resources needed for the tests just once.
9f4a1b4
to
33cd59e
Compare
@gselzer This PR is ready for its second round of review. Thanks for all the help! |
This PR adds the SACA framework (3 Ops: z-score heat map, p-value heatmap, sig mask) and the use case that goes with it.