Skip to content
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

Update to pom-scijava-37.0.0 #20

Merged
merged 1 commit into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<parent>
<groupId>org.scijava</groupId>
<artifactId>pom-scijava</artifactId>
<version>30.0.0</version>
<version>37.0.0</version>
<relativePath />
</parent>

<groupId>ch.fmi</groupId>
<artifactId>fmi-ij2-plugins</artifactId>
<version>0.8.2-SNAPSHOT</version>
<version>0.9.0-SNAPSHOT</version>

<name>ImageJ2 plugins for use in ImageJ and KNIME</name>
<description>A collection of plugins developed at the FMI Basel.</description>
Expand Down Expand Up @@ -79,8 +79,7 @@
<license.licenseName>lgpl_v3</license.licenseName>
<license.copyrightOwners>FMI Basel</license.copyrightOwners>

<TrackMate_extras.version>0.0.4</TrackMate_extras.version>
<fmi-trackmate-addons.version>0.1.2</fmi-trackmate-addons.version>
<fmi-trackmate-addons.version>0.7.0</fmi-trackmate-addons.version>

<!-- NB: Deploy releases to the SciJava Maven repository. -->
<releaseProfiles>sign,deploy-to-scijava</releaseProfiles>
Expand Down Expand Up @@ -132,12 +131,7 @@
</dependency>
<dependency>
<groupId>sc.fiji</groupId>
<artifactId>TrackMate_</artifactId>
</dependency>
<dependency>
<groupId>org.scijava</groupId>
<artifactId>TrackMate_extras</artifactId>
<version>${TrackMate_extras.version}</version>
<artifactId>TrackMate</artifactId>
</dependency>
<dependency>
<groupId>gov.nist.math</groupId>
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/ch/fmi/AnisotropicDistanceMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
import net.imagej.ops.Ops;
import net.imagej.ops.Ops.Image.DistanceTransform;
import net.imagej.ops.convert.ConvertImages;
import net.imglib2.RandomAccessibleInterval;
import net.imglib2.algorithm.morphology.distance.DistanceTransform.DISTANCE_TYPE;
import net.imglib2.converter.read.ConvertedRandomAccessibleInterval;
import net.imglib2.converter.Converters;
import net.imglib2.img.Img;
import net.imglib2.type.logic.BitType;
import net.imglib2.type.numeric.RealType;
Expand Down Expand Up @@ -95,8 +96,8 @@ public void run() {
break;
case IMGLIB:
FloatType type = new FloatType();
ConvertedRandomAccessibleInterval<RealType<?>, FloatType> conv = new ConvertedRandomAccessibleInterval<>(
input, (s, t) -> t.set(s.getRealDouble() > 0.0 ? 100000000 : 0.0f),
RandomAccessibleInterval<FloatType> conv = Converters.convert(
(RandomAccessibleInterval<RealType<?>>) input, (s, t) -> t.set(s.getRealDouble() > 0.0 ? 100000000 : 0.0f),
type);
outImg = (Img<?>) ops.run(Ops.Create.Img.class, conv);
net.imglib2.algorithm.morphology.distance.DistanceTransform
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/ch/fmi/SpotImageGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class SpotImageGenerator implements Command {
private Double radius;

@Parameter(type = ItemIO.OUTPUT)
private ImgPlus<DoubleType> resultImg;
private ImgPlus<?> resultImg;

@SuppressWarnings("unchecked")
@Override
Expand All @@ -76,7 +76,7 @@ public void run() {
RandomAccessibleInterval<DoubleType> kernel = ops.create().kernelGauss(
radius * 2.0, 2);

resultImg = ImgPlus.wrap((Img<DoubleType>) ops.filter().convolve(img,
resultImg = ImgPlus.wrap((Img<?>) ops.filter().convolve(img,
kernel));
}

Expand Down
20 changes: 10 additions & 10 deletions src/main/java/ch/fmi/TrackMateCollectionTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@
*/
package ch.fmi;

import java.util.ArrayList;

import com.google.common.primitives.Doubles;
import com.google.common.primitives.Ints;

import java.util.ArrayList;
import org.scijava.ItemIO;
import org.scijava.command.Command;
import org.scijava.log.LogService;
import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;

import fiji.plugin.trackmate.Model;
import fiji.plugin.trackmate.Settings;
import fiji.plugin.trackmate.Spot;
import fiji.plugin.trackmate.TrackMate;
import fiji.plugin.trackmate.TrackModel;
import fiji.plugin.trackmate.tracking.LAPUtils;
import fiji.plugin.trackmate.tracking.TrackerKeys;
import fiji.plugin.trackmate.tracking.sparselap.SparseLAPTrackerFactory;

import org.scijava.ItemIO;
import org.scijava.command.Command;
import org.scijava.log.LogService;
import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;
import fiji.plugin.trackmate.tracking.jaqaman.LAPUtils;
import fiji.plugin.trackmate.tracking.jaqaman.SparseLAPTrackerFactory;

@Plugin(type = Command.class, headless = true, menuPath = "FMI>Track Spot Collection")
public class TrackMateCollectionTracker implements Command {
Expand Down Expand Up @@ -130,7 +130,7 @@ public void run() {
settings.dt = frameInterval;

settings.trackerFactory = new SparseLAPTrackerFactory();
settings.trackerSettings = LAPUtils.getDefaultLAPSettingsMap();
settings.trackerSettings = LAPUtils.getDefaultSegmentSettingsMap();
settings.trackerSettings.put(TrackerKeys.KEY_LINKING_MAX_DISTANCE,
linkingMaxDistance);
settings.trackerSettings.put(TrackerKeys.KEY_GAP_CLOSING_MAX_DISTANCE,
Expand Down
41 changes: 17 additions & 24 deletions src/main/java/ch/fmi/TrackMateSpotDetector.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,18 @@
*/
package ch.fmi;

import java.util.ArrayList;

import com.google.common.primitives.Doubles;
import com.google.common.primitives.Ints;

import org.scijava.ItemIO;
import org.scijava.command.Command;
import org.scijava.log.LogService;
import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;

import ch.fmi.trackmate.features.MaxQualitySpotAnalyzerFactory;
import fiji.plugin.trackmate.Model;
import fiji.plugin.trackmate.Settings;
import fiji.plugin.trackmate.Spot;
Expand All @@ -32,22 +41,13 @@
import fiji.plugin.trackmate.detection.DetectorKeys;
import fiji.plugin.trackmate.detection.LogDetectorFactory;
import fiji.plugin.trackmate.features.FeatureFilter;
import fiji.plugin.trackmate.features.spot.SpotContrastAnalyzerFactory;
import fiji.plugin.trackmate.features.spot.SpotIntensityAnalyzerFactory;
import fiji.plugin.trackmate.features.spot.SpotRadiusEstimatorFactory;
import fiji.plugin.trackmate.features.spot.SpotContrastAndSNRAnalyzerFactory;
import fiji.plugin.trackmate.features.spot.SpotIntensityMultiCAnalyzerFactory;
import ij.ImagePlus;
import ij.gui.Roi;
import ij.plugin.filter.ThresholdToSelection;
import ij.process.ImageProcessor;

import java.util.ArrayList;

import org.scijava.ItemIO;
import org.scijava.command.Command;
import org.scijava.log.LogService;
import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;

@Plugin(type = Command.class, headless = true, menuPath = "FMI>Spot Detection (Subpixel localization)")
public class TrackMateSpotDetector implements Command {
@Parameter
Expand Down Expand Up @@ -128,8 +128,7 @@ public void run() {
imp.setCalibration(null);
}

Settings settings = new Settings();
settings.setFrom(imp);
Settings settings = new Settings(imp);

// TODO make detector choice optional
settings.detectorFactory = new LogDetectorFactory<>();
Expand All @@ -142,9 +141,8 @@ public void run() {
DetectorKeys.KEY_RADIUS, spotSize);
settings.detectorSettings.put( //
DetectorKeys.KEY_THRESHOLD, spotThreshold);
settings.addSpotAnalyzerFactory(new SpotIntensityAnalyzerFactory<>());
settings.addSpotAnalyzerFactory(new SpotRadiusEstimatorFactory<>());
settings.addSpotAnalyzerFactory(new SpotContrastAnalyzerFactory<>());
settings.addSpotAnalyzerFactory(new SpotIntensityMultiCAnalyzerFactory<>());
settings.addSpotAnalyzerFactory(new SpotContrastAndSNRAnalyzerFactory<>());
settings.addSpotAnalyzerFactory(new MaxQualitySpotAnalyzerFactory<>());

if (filterMaxQuality) {
Expand All @@ -165,7 +163,6 @@ public void run() {
ArrayList<Double> qualityList = new ArrayList<>();
ArrayList<Double> totalIntensityList = new ArrayList<>();
ArrayList<Double> meanIntensityList = new ArrayList<>();
ArrayList<Double> estDiameterList = new ArrayList<>();
ArrayList<Double> contrastList = new ArrayList<>();
// TODO add other outputs

Expand All @@ -183,15 +180,12 @@ public void run() {
qualityList.add(spot.getFeature(Spot.QUALITY));
totalIntensityList
.add(spot
.getFeature(SpotIntensityAnalyzerFactory.TOTAL_INTENSITY));
.getFeature("TOTAL_INTENSITY_CH1"));
meanIntensityList
.add(spot
.getFeature(SpotIntensityAnalyzerFactory.MEAN_INTENSITY));
estDiameterList
.add(spot
.getFeature(SpotRadiusEstimatorFactory.ESTIMATED_DIAMETER));
.getFeature("MEAN_INTENSITY_CH1"));
contrastList.add(spot
.getFeature(SpotContrastAnalyzerFactory.KEY));
.getFeature("CONTRAST_CH1"));
}
} else {
log.warn(trackmate.getErrorMessage());
Expand All @@ -207,7 +201,6 @@ public void run() {
quality = Doubles.toArray(qualityList);
totalIntensity = Doubles.toArray(totalIntensityList);
meanIntensity = Doubles.toArray(meanIntensityList);
estDiameter = Doubles.toArray(estDiameterList);
contrast = Doubles.toArray(contrastList);

// Return summary values
Expand Down
50 changes: 20 additions & 30 deletions src/main/java/ch/fmi/TrackMateWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,17 @@
*/
package ch.fmi;

import java.util.ArrayList;

import com.google.common.primitives.Doubles;

import org.scijava.ItemIO;
import org.scijava.command.Command;
import org.scijava.log.LogService;
import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;

import ch.fmi.trackmate.features.MaxQualitySpotAnalyzerFactory;
import fiji.plugin.trackmate.FeatureModel;
import fiji.plugin.trackmate.Model;
import fiji.plugin.trackmate.Settings;
Expand All @@ -32,26 +41,17 @@
import fiji.plugin.trackmate.detection.DetectorKeys;
import fiji.plugin.trackmate.detection.LogDetectorFactory;
import fiji.plugin.trackmate.features.FeatureFilter;
import fiji.plugin.trackmate.features.spot.SpotContrastAnalyzerFactory;
import fiji.plugin.trackmate.features.spot.SpotIntensityAnalyzerFactory;
import fiji.plugin.trackmate.features.spot.SpotRadiusEstimatorFactory;
import fiji.plugin.trackmate.features.spot.SpotContrastAndSNRAnalyzerFactory;
import fiji.plugin.trackmate.features.spot.SpotIntensityMultiCAnalyzerFactory;
import fiji.plugin.trackmate.features.track.TrackDurationAnalyzer;
import fiji.plugin.trackmate.tracking.LAPUtils;
import fiji.plugin.trackmate.tracking.TrackerKeys;
import fiji.plugin.trackmate.tracking.sparselap.SparseLAPTrackerFactory;
import fiji.plugin.trackmate.tracking.jaqaman.LAPUtils;
import fiji.plugin.trackmate.tracking.jaqaman.SparseLAPTrackerFactory;
import ij.ImagePlus;
import ij.gui.Roi;
import ij.plugin.filter.ThresholdToSelection;
import ij.process.ImageProcessor;

import java.util.ArrayList;

import org.scijava.ItemIO;
import org.scijava.command.Command;
import org.scijava.log.LogService;
import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;

@Plugin(type = Command.class, headless = true, menuPath = "FMI>Track Spots (Subpixel localization)")
public class TrackMateWrapper implements Command {
@Parameter
Expand Down Expand Up @@ -125,9 +125,6 @@ public class TrackMateWrapper implements Command {
@Parameter(type = ItemIO.OUTPUT)
private double[] radius;

@Parameter(type = ItemIO.OUTPUT)
private double[] estDiameter;

@Parameter(type = ItemIO.OUTPUT)
private double[] contrast;

Expand All @@ -143,9 +140,8 @@ public void run() {

// Create TrackMate instance with settings
Model model = new Model();
Settings settings = new Settings();
Settings settings = new Settings(imp);

settings.setFrom(imp);
settings.dt = frameInterval;
settings.detectorFactory = new LogDetectorFactory<>();

Expand All @@ -164,16 +160,15 @@ public void run() {
}

settings.trackerFactory = new SparseLAPTrackerFactory();
settings.trackerSettings = LAPUtils.getDefaultLAPSettingsMap();
settings.trackerSettings = LAPUtils.getDefaultSegmentSettingsMap();
settings.trackerSettings.put(TrackerKeys.KEY_LINKING_MAX_DISTANCE,
linkingMaxDistance);
settings.trackerSettings.put(TrackerKeys.KEY_GAP_CLOSING_MAX_DISTANCE,
closingMaxDistance);
settings.trackerSettings.put(TrackerKeys.KEY_GAP_CLOSING_MAX_FRAME_GAP,
frameGap);
settings.addSpotAnalyzerFactory(new SpotIntensityAnalyzerFactory<>());
settings.addSpotAnalyzerFactory(new SpotRadiusEstimatorFactory<>());
settings.addSpotAnalyzerFactory(new SpotContrastAnalyzerFactory<>());
settings.addSpotAnalyzerFactory(new SpotIntensityMultiCAnalyzerFactory<>());
settings.addSpotAnalyzerFactory(new SpotContrastAndSNRAnalyzerFactory<>());
settings.addSpotAnalyzerFactory(new MaxQualitySpotAnalyzerFactory<>());
settings.addTrackAnalyzer(new TrackDurationAnalyzer());

Expand Down Expand Up @@ -204,7 +199,6 @@ public void run() {
ArrayList<Double> totalIntensityList = new ArrayList<>();
ArrayList<Double> meanIntensityList = new ArrayList<>();
ArrayList<Double> radiusList = new ArrayList<>();
ArrayList<Double> diameterList = new ArrayList<>();
ArrayList<Double> contrastList = new ArrayList<>();

TrackModel trackModel = model.getTrackModel();
Expand All @@ -223,16 +217,13 @@ public void run() {
zList.add(spot.getDoublePosition(2));
totalIntensityList
.add(spot
.getFeature(SpotIntensityAnalyzerFactory.TOTAL_INTENSITY));
.getFeature("TOTAL_INTENSITY_CH1"));
meanIntensityList
.add(spot
.getFeature(SpotIntensityAnalyzerFactory.MEAN_INTENSITY));
.getFeature("MEAN_INTENSITY_CH1"));
radiusList.add(spot.getFeature(Spot.RADIUS));
diameterList
.add(spot
.getFeature(SpotRadiusEstimatorFactory.ESTIMATED_DIAMETER));
contrastList.add(spot
.getFeature(SpotContrastAnalyzerFactory.KEY));
.getFeature("CONTRAST_CH1"));
}
}

Expand All @@ -257,7 +248,6 @@ public void run() {
totalIntensity = Doubles.toArray(totalIntensityList);
meanIntensity = Doubles.toArray(meanIntensityList);
radius = Doubles.toArray(radiusList);
estDiameter = Doubles.toArray(diameterList);
contrast = Doubles.toArray(contrastList);

// Return summary values
Expand Down
Loading
Loading