Skip to content
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ nbproject/
build.properties
c:/
dependency-reduced-pom.xml
/previous_jars/*
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ The modifications were implemented based on [this development version](https://g

## Getting started
Install [ImageJ](http://imagej.nih.gov/ij/index.html) and download the latest version of [ThunderSTORM](https://github.com/quantori/prj-thunderstorm/releases/latest). For installation, copy the downloaded file into ImageJ's plugin subdirectory and run ImageJ. See the [Installation guide](https://github.com/zitmen/thunderstorm/wiki/Installation) for more information. To get started using ThunderSTORM, see the [Tutorials](https://github.com/zitmen/thunderstorm/wiki/Tutorials). Example data are provided [here](https://github.com/zitmen/thunderstorm/releases/download/v1.0/example_data.zip).


If you use the phasor sub-pixel estimator, please cite this paper (https://doi.org/10.1063/1.5005899):
* K.J.A. Martens, A.N. Bader, S. Baas, B. Rieger, J. Hohlbein. _Phasor based single-molecule localization microscopy in 3D (pSMLM-3D): an algorithm for MHz localization rates using standard CPUs_ JCP, 2018.
83 changes: 56 additions & 27 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,48 @@
</description>
<url>https://github.com/zitmen/thunderstorm</url>

<inceptionYear>2013</inceptionYear>
<organization>
<name>Wageningen University</name>
<url>https://wur.nl/</url>
</organization>

<contributors>
<contributor>
<name>Koen Martens</name>
<email>koenjamartens@gmail.com</email>
<roles>
<role>developer</role>
</roles>
</contributor>
</contributors>

<mailingLists>
<mailingList>
<name>Image.sc Forum</name>
<archive>https://forum.image.sc/tags/imagej</archive>
</mailingList>
</mailingLists>

<parent>
<groupId>org.scijava</groupId>
<artifactId>pom-scijava</artifactId>
<version>36.0.0</version>
</parent>

<properties>
<skipTests>true</skipTests>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.version>1.7.10</kotlin.version>
<imagej.path>C:\Program Files\ImageJ</imagej.path>
<imagej1.version>1.53s</imagej1.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<kotlin.version>1.8.0</kotlin.version>
<imagej1.version>1.54i</imagej1.version>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<imagej.path>C:\Users\gobes001\LocalSoftware\fiji-win64\Fiji.app\jars</imagej.path>
<lyx.path>C:\Program Files (x86)\LyX 2.1\bin\lyx.exe</lyx.path>
<help.dir>${basedir}/src/main/resources/resources/help</help.dir>
<license.licenseName>GNU GPL 3.0</license.licenseName>
<license.copyrightOwners>Zitmen</license.copyrightOwners>
<scijava.app.directory>C:\Users\gobes001\LocalSoftware\fiji-win64\Fiji.app</scijava.app.directory>
</properties>

<profiles>
Expand All @@ -48,9 +80,13 @@

<issueManagement>
<system>GitHub</system>
<url>https://github.com/zitmen/thunderstorm/issues</url>
<url>https://github.com/HohlbeinLab/prj-thunderstorm/issues</url>
</issueManagement>

<ciManagement>
<system>None</system>
</ciManagement>

<licenses>
<license>
<name>GNU GPL v3</name>
Expand Down Expand Up @@ -157,25 +193,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>copytoplugins</id>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<copy tofile="${imagej.path}/plugins/Thunder_STORM.jar"
file="target/Thunder_STORM.jar"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
Expand Down Expand Up @@ -218,12 +235,18 @@
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>scijava.public</id>
<url>https://maven.scijava.org/content/groups/public</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
Expand Down Expand Up @@ -264,14 +287,20 @@
<dependency>
<groupId>net.imagej</groupId>
<artifactId>ij</artifactId>
<version>${imagej1.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.sf.cssbox</groupId>
<artifactId>swingbox</artifactId>
<version>1.1</version>
</dependency>
<!--Added by KM-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
<scope>provided</scope>
</dependency>
<!--End Added by KM-->
<dependency>
<groupId>net.java.balloontip</groupId>
<artifactId>balloontip</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions previous_jars/maven-archiver/pom.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#Generated by Maven
#Thu Apr 04 16:11:10 CEST 2024
artifactId=ThunderSTORM
groupId=cz.cuni.lf1.lge
version=optimization-release-v1.0
35 changes: 28 additions & 7 deletions src/main/java/cz/cuni/lf1/lge/ThunderSTORM/AnalysisPlugIn.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import cz.cuni.lf1.lge.ThunderSTORM.util.Point;
import cz.cuni.lf1.lge.ThunderSTORM.util.VectorMath;
import ij.IJ;
import ij.ImageJ;
import ij.ImagePlus;
import ij.gui.Roi;
import ij.plugin.filter.ExtendedPlugInFilter;
Expand Down Expand Up @@ -64,7 +65,8 @@ public final class AnalysisPlugIn implements ExtendedPlugInFilter {
private RenderingQueue renderingQueue;
private Roi roi;
private AnalysisOptionsDialog dialog;



/**
* Returns flags specifying capabilities of the plugin.
*
Expand Down Expand Up @@ -144,12 +146,9 @@ public int showDialog(final ImagePlus imp, final String command, PlugInFilterRun
} else {
// Create and show the dialog
try {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
dialog = new AnalysisOptionsDialog(imp, command, allFilters, allDetectors, allEstimators, allRenderers);
dialog.setVisible(true);
}
SwingUtilities.invokeAndWait(() -> {
dialog = new AnalysisOptionsDialog(imp, command, allFilters, allDetectors, allEstimators, allRenderers);
dialog.setVisible(true);
});
} catch(InvocationTargetException e) {
throw e.getCause();
Expand Down Expand Up @@ -310,4 +309,26 @@ synchronized public void showResults() {
renderingQueue.repaintLater();
}
}


// Only run from the IDE
public static void main(String[] args) throws Exception {
Class<?> clazz = AnalysisPlugIn.class;
java.net.URL url = clazz.getProtectionDomain().getCodeSource().getLocation();
java.io.File file = new java.io.File(url.toURI());
System.setProperty("plugins.dir", file.getAbsolutePath());
//System.setProperty("plugins.dir", "C:\\Users\\gobes001\\source\\repos\\thunderstorm-prj\\target");
// start ImageJ
ImageJ imagej = new ImageJ();

// open the Clown sample
ImagePlus image = IJ.openImage("C:\\Users\\gobes001\\source\\repos\\thunderstorm-prj\\Substack.tif");
image.show();

// run the plugin
IJ.runPlugIn(clazz.getName(), "");

//IJ.run("Run Analysis");
//new AnalysisPlugIn("runAnalysis");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class BiPlaneCalibrationPlugin implements PlugIn {
String savePath;
double stageStep;
double zRangeLimit;//in nm
double zzeropos;//in nm
ImagePlus imp1, imp2;
Roi roi1, roi2;

Expand Down Expand Up @@ -81,6 +82,7 @@ public void run(String arg) {
savePath = dialog.getSavePath();
stageStep = dialog.getStageStep();
zRangeLimit = dialog.getZRangeLimit();
zzeropos = 0;
defocusModel = dialog.getActiveDefocusFunction();

if (!isStack(imp1 = dialog.getFirstPlaneStack())) return;
Expand All @@ -98,7 +100,7 @@ public void run(String arg) {
final ICalibrationProcess process = CalibrationProcessFactory.create(
calibrationConfig,
selectedFilterUI, selectedDetectorUI, calibrationEstimatorUI,
defocusModel, stageStep, zRangeLimit, imp1, imp2, roi1, roi2);
defocusModel, stageStep, zRangeLimit, imp1, imp2, roi1, roi2, zzeropos);

try {
process.runCalibration();
Expand Down Expand Up @@ -127,4 +129,4 @@ public void run(String arg) {
IJ.handleException(ex);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cz.cuni.lf1.lge.ThunderSTORM;

import cz.cuni.lf1.lge.ThunderSTORM.estimators.ui.PhasorAstigmatismCalibrationEstimatorUI;
import cz.cuni.lf1.lge.ThunderSTORM.UI.AstigmatismCalibrationDialog;
import cz.cuni.lf1.lge.ThunderSTORM.UI.GUI;
import cz.cuni.lf1.lge.ThunderSTORM.calibration.*;
Expand All @@ -24,10 +25,13 @@ public class CylindricalLensCalibrationPlugin implements PlugIn {
DefocusFunction defocusModel;
IFilterUI selectedFilterUI;
IDetectorUI selectedDetectorUI;
IEstimatorUI selectedEstimatorUI;
PhasorAstigmatismCalibrationEstimatorUI phasorCalibrationEstimatorUI;
AstigmatismCalibrationEstimatorUI calibrationEstimatorUI;
String savePath;
double stageStep;
double zRangeLimit;//in nm
double zzeropos;
ImagePlus imp;
Roi roi;

Expand All @@ -47,9 +51,10 @@ public void run(String arg) {
try {
//load modules
calibrationEstimatorUI = new AstigmatismCalibrationEstimatorUI();
phasorCalibrationEstimatorUI = new PhasorAstigmatismCalibrationEstimatorUI();
List<IFilterUI> filters = ModuleLoader.getUIModules(IFilterUI.class);
List<IDetectorUI> detectors = ModuleLoader.getUIModules(IDetectorUI.class);
List<IEstimatorUI> estimators = Arrays.asList(new IEstimatorUI[]{calibrationEstimatorUI}); // only one estimator can be used
List<IEstimatorUI> estimators = Arrays.asList(new IEstimatorUI[]{calibrationEstimatorUI, phasorCalibrationEstimatorUI});
List<DefocusFunction> defocusFunctions = ModuleLoader.getUIModules(DefocusFunction.class);
Thresholder.loadFilters(filters);

Expand All @@ -60,24 +65,59 @@ public void run(String arg) {
IJ.handleException(e);
}
AstigmatismCalibrationDialog dialog;

dialog = new AstigmatismCalibrationDialog(imp, filters, detectors, estimators, defocusFunctions);
if(dialog.showAndGetResult() != JOptionPane.OK_OPTION) {
return;
}
selectedFilterUI = dialog.getActiveFilterUI();
selectedDetectorUI = dialog.getActiveDetectorUI();
selectedEstimatorUI = dialog.getActiveEstimatorUI();
savePath = dialog.getSavePath();
stageStep = dialog.getStageStep();
zRangeLimit = dialog.getZRangeLimit();
defocusModel = dialog.getActiveDefocusFunction();

//zzeropos is boolean indicator for setting z=0 at intersection of defocus curves, or at middle of calibration stack - KM
zzeropos = dialog.getZZeroPos();

String activeEstimator = ""+selectedEstimatorUI;
String subStringGauss = "ui.AstigmatismCalibrationEstimatorUI";
String subStringPhasor = "ui.PhasorAstigmatismCalibrationEstimatorUI";
//IJ.log(activeEstimator);
roi = imp.getRoi() != null ? imp.getRoi() : new Roi(0, 0, imp.getWidth(), imp.getHeight());

// perform the calibration
//if Phasor is selected - KM
if (activeEstimator.toLowerCase().contains(subStringPhasor.toLowerCase())){
final PhasorAstigmaticCalibrationProcess process = (PhasorAstigmaticCalibrationProcess) PhasorCalibrationProcessFactory.create(
new CalibrationConfig(),
selectedFilterUI, selectedDetectorUI, phasorCalibrationEstimatorUI,
defocusModel, stageStep, zRangeLimit, imp, roi, zzeropos);

try {
process.runCalibration();
} catch(NoMoleculesFittedException ex) {
// if no beads were succesfully fitted, draw localizations anyway
process.drawOverlay();
IJ.handleException(ex);
return;
}
process.drawOverlay();
process.drawSigmaPlots();

try {
process.getCalibration(defocusModel).saveToFile(savePath);
} catch(IOException ex) {
UI.showAnotherLocationDialog(ex, process.getCalibration(defocusModel));
}
} else
//If Gauss is selected, do the standard calibration -KM
{
//The boolean zzeropos is added to differentiate between zero at intersection or middle of calibration stack -KM
final AstigmaticCalibrationProcess process = (AstigmaticCalibrationProcess) CalibrationProcessFactory.create(
new CalibrationConfig(),
selectedFilterUI, selectedDetectorUI, calibrationEstimatorUI,
defocusModel, stageStep, zRangeLimit, imp, roi);
defocusModel, stageStep, zRangeLimit, imp, roi, zzeropos);

try {
process.runCalibration();
Expand All @@ -95,8 +135,9 @@ public void run(String arg) {
} catch(IOException ex) {
UI.showAnotherLocationDialog(ex, process.getCalibration(defocusModel));
}
}
} catch(Exception ex) {
IJ.handleException(ex);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,11 @@ public ImportDialog(Window owner, boolean groundTruth) {
assert moduleNames != null && moduleNames.length > 0;
fileFormat = fileParams.createStringField("fileFormat", StringValidatorFactory.isMember(moduleNames), moduleNames[0]);
filePath = fileParams.createStringField("filePath", StringValidatorFactory.fileExists(), "");
detectMeasurementProtocol = fileParams.createBooleanField("detectMeasurementProtocol", null, true);
startingFrame = params.createIntField("startingFrame", IntegerValidatorFactory.positiveNonZero(), 1);
append = params.createBooleanField("append", null, false);
this.groundTruth = groundTruth;
if(!groundTruth) {
detectMeasurementProtocol = fileParams.createBooleanField("detectMeasurementProtocol", null, true);
showPreview = params.createBooleanField("livePreview", null, true);
rawImageStack = params.createStringField("rawImageStack", StringValidatorFactory.openImages(true), "");
}
Expand Down Expand Up @@ -671,4 +671,4 @@ public void run() {
}
};
}
}
}
Loading