Skip to content

Commit 72e1ac2

Browse files
committed
Initialize scijava-ops-flim
This new repository contains a port of the flimj-ops library: https://github.com/flimlib/flimj-ops/
1 parent 7637bbb commit 72e1ac2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+5006
-5
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
<module>scijava-meta</module>
5555
<module>scijava-ops-api</module>
5656
<module>scijava-ops-engine</module>
57+
<module>scijava-ops-flim</module>
5758
<module>scijava-ops-image</module>
5859
<module>scijava-ops-legacy</module>
5960
<module>scijava-ops-indexer</module>

scijava-ops-engine/src/main/java/module-info.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@
532532
org.scijava.ops.engine.adapt.functional.InplacesToFunctions.Inplace16_14ToFunction16,
533533
org.scijava.ops.engine.adapt.functional.InplacesToFunctions.Inplace16_15ToFunction16,
534534
org.scijava.ops.engine.adapt.functional.InplacesToFunctions.Inplace16_16ToFunction16,
535+
org.scijava.ops.engine.conversionLoss.impl.IdentityLossReporter,
535536
org.scijava.ops.engine.eval.DefaultEval,
536537
org.scijava.ops.engine.stats.Mean.MeanFunction;
537538

scijava-ops-engine/src/main/java/org/scijava/ops/engine/matcher/convert/ConvertedOpInfo.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,9 @@ private double calculatePriority(OpEnvironment env) {
461461
List<Type> originalInputs = info.inputTypes();
462462
List<Type> inputs = inputTypes();
463463
for (int i = 0; i < inputs.size(); i++) {
464-
penalty += determineLoss(env, Nil.of(inputs.get(i)), Nil.of(originalInputs
465-
.get(i)));
464+
var from = inputs.get(i);
465+
var to = Types.mapVarToTypes(originalInputs.get(i), typeVarAssigns);
466+
penalty += determineLoss(env, Nil.of(from), Nil.of(to));
466467
}
467468

468469
Type opOutput = info.outputType();

scijava-ops-engine/src/main/resources/META-INF/services/org.scijava.ops.spi.Op

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,5 +234,6 @@ org.scijava.ops.engine.adapt.functional.InplacesToFunctions$Inplace16_13ToFuncti
234234
org.scijava.ops.engine.adapt.functional.InplacesToFunctions$Inplace16_14ToFunction16
235235
org.scijava.ops.engine.adapt.functional.InplacesToFunctions$Inplace16_15ToFunction16
236236
org.scijava.ops.engine.adapt.functional.InplacesToFunctions$Inplace16_16ToFunction16
237+
org.scijava.ops.engine.conversionLoss.impl.IdentityLossReporter
237238
org.scijava.ops.engine.eval.DefaultEval
238239
org.scijava.ops.engine.stats.Mean$MeanFunction

scijava-ops-engine/src/test/java/org/scijava/ops/engine/impl/ServiceLoaderDiscoveryIntegrationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ public class ServiceLoaderDiscoveryIntegrationTest {
4747
public void opDiscoveryRegressionIT() {
4848
final Discoverer d = Discoverer.using(ServiceLoader::load);
4949
final List<Op> discoveries = d.discover(Op.class);
50-
Assertions.assertEquals(236, discoveries.size());
50+
Assertions.assertEquals(237, discoveries.size());
5151

5252
@SuppressWarnings("unused")
5353
final OpInfoGenerator g = new OpClassOpInfoGenerator();
5454
final List<OpInfo> infos = discoveries.stream() //
5555
.flatMap(c -> g.generateInfosFrom(c).stream()) //
5656
.collect(Collectors.toList());
57-
Assertions.assertEquals(236, infos.size());
57+
Assertions.assertEquals(237, infos.size());
5858
}
5959

6060
@Test

scijava-ops-engine/templates/main/java/module-info.vm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ module org.scijava.ops.engine {
128128
org.scijava.ops.engine.adapt.functional.InplacesToFunctions.Inplace${arity}_${a}ToFunction${arity},
129129
#end
130130
#end
131+
org.scijava.ops.engine.conversionLoss.impl.IdentityLossReporter,
131132
org.scijava.ops.engine.eval.DefaultEval,
132133
org.scijava.ops.engine.stats.Mean.MeanFunction;
133134

scijava-ops-flim/LICENSE.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Copyright (c) 2024, SciJava developers.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification,
5+
are permitted provided that the following conditions are met:
6+
7+
1. Redistributions of source code must retain the above copyright notice, this
8+
list of conditions and the following disclaimer.
9+
10+
2. Redistributions in binary form must reproduce the above copyright notice,
11+
this list of conditions and the following disclaimer in the documentation
12+
and/or other materials provided with the distribution.
13+
14+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
18+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24+
POSSIBILITY OF SUCH DAMAGE.

scijava-ops-flim/README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# SciJava Ops FLIM: A fluorescence lifetime analysis library for SciJava Ops.
2+
3+
SciJava Ops FLIM is a collection of FLIM analysis ops based on [FLIMLib](https://github.com/flimlib/flimlib). It extends the single-transient fitting functions in FLIMLib to dataset-level fitting ops. Currently supported fitting ops include: RLD, MLA, Global, Phasor, and single-component Bayesian.
4+
5+
Besides curve fitting, SciJava Ops FLIM also provides a variety of pre-processing options such as pixel binning, intensity thresholding, ROI masking as well as post-processing utility ops for e.g. calculating τ<sub>m</sub> (mean lifetime), A<sub>i</sub>% (fractional contribution) and pseudocoloring the result with LUT.
6+
7+
# Example usage
8+
Open [test2.sdt](test_files/test2.sdt) in [Fiji](https://fiji.github.io/). Execute in [Script Editor](http://imagej.github.io/Using_the_Script_Editor) as Groovy:
9+
10+
```groovy
11+
#@ UIService ui
12+
#@ OpEnvironment op
13+
#@ ImgPlus img
14+
15+
// set up parameters
16+
import org.scijava.ops.flim.FitParams
17+
18+
param = new FitParams()
19+
param.transMap = img; // input 3-dimensional (x, y, t) dataset
20+
param.xInc= 0.040 // time difference between bins (ns)
21+
param.ltAxis = 2 // time bins lay along axis #2
22+
23+
// op call
24+
fittedImg = op.unary("flim.fitLMA").input(param).apply().paramMap
25+
26+
// display each parameter
27+
zImg = op.ternary("transform.hyperSliceView").input(fittedImg, param.ltAxis, 0L).apply()
28+
AImg = op.ternary("transform.hyperSliceView").input(fittedImg, param.ltAxis, 1L).apply()
29+
tauImg = op.ternary("transform.hyperSliceView").input(fittedImg, param.ltAxis, 2L).apply()
30+
31+
ui.show("z", zImg)
32+
ui.show("A", AImg)
33+
ui.show("tau", tauImg)
34+
```
35+
36+
After running this script, the output shown below can be seen by first running the script, and then brightness and contrast (Ctrl + Shift + C, select "Set" and bound the contrast to each image's corresponding range below).
37+
38+
(z in [-1, 1], A in [0, 4], tau in[0, 3]):
39+
40+
![example output](images/example%20z.png)![example output](images/example%20A.png)![example output](images/example%20tau.png)
41+
42+
See more examples in [Demo.ipynb](notebooks/Demo.ipynb) and [groovy.md](groovy.md).
43+
44+
# Using from a Java project
45+
46+
To depend on SciJava Ops FLIM, copy the following to your `pom.xml`:
47+
48+
```xml
49+
<properties>
50+
<scijava-ops-flim.version>0-SNAPSHOT</scijava-ops-flim.version>
51+
</properties>
52+
53+
<dependencies>
54+
<dependency>
55+
<groupId>org.scijava</groupId>
56+
<artifactId>scijava-ops-flim</artifactId>
57+
<version>${scijava-ops-flim.version}</version>
58+
</dependency>
59+
</dependencies>
60+
```
61+
62+
# See also
63+
64+
- [FLIMLib](https://github.com/flimlib/flimlib): Curve fitting library for FLIM
65+
- [Debug tutorial](https://github.com/flimlib/flimlib/wiki/Debugging)
66+
- [FLIMJ Ops](https://github.com/flimlib/flimj-ops): ImageJ Ops for accessing FLIM
67+
68+
# Citation
69+
70+
Coming soon...

scijava-ops-flim/environment.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: scijava
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
- beakerx
6+
- jupyter_contrib_nbextensions
7+
- numpy
8+
- openjdk=11
96.2 KB
Loading

0 commit comments

Comments
 (0)