diff --git a/Thresholder/pom.xml b/Thresholder/pom.xml
index eb082cc..94d8871 100644
--- a/Thresholder/pom.xml
+++ b/Thresholder/pom.xml
@@ -11,7 +11,7 @@
MotiQ_Thresholder
JNH
- 0.2.0-SNAPSHOT
+ 0.2.1-SNAPSHOT
MotiQ thresholder
diff --git a/Thresholder/src/main/java/motiQ_thr/Thresholder.java b/Thresholder/src/main/java/motiQ_thr/Thresholder.java
index fcb68fd..22018d9 100644
--- a/Thresholder/src/main/java/motiQ_thr/Thresholder.java
+++ b/Thresholder/src/main/java/motiQ_thr/Thresholder.java
@@ -4,7 +4,7 @@
*
* Copyright (C) 2015-2024 Jan N. Hansen
* First version: January 05, 2015
- * This version: July 25, 2024
+ * This version: July 26, 2024
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -37,13 +37,14 @@
import ij.measure.*;
import ij.process.*;
import ij.plugin.*;
+import ij.plugin.frame.Recorder;
import ij.text.*;
import java.text.*;
public class Thresholder implements PlugIn, Measurements{//, DialogListener {
//Name variables
final static String PLUGINNAME = "MotiQ_thresholder";
- final static String PLUGINVERSION = "v0.2.0";
+ final static String PLUGINVERSION = "v0.2.1";
//Fonts
static final Font SuperHeadingFont = new Font("Sansserif", Font.BOLD, 16);
@@ -56,6 +57,7 @@ public class Thresholder implements PlugIn, Measurements{//, DialogListener {
static final DecimalFormat dformat0 = new DecimalFormat("#0",new DecimalFormatSymbols(Locale.US));
static final DecimalFormat dformat1 = new DecimalFormat("#0.000000",new DecimalFormatSymbols(Locale.US));
static final DecimalFormat dformat2 = new DecimalFormat("#0.00",new DecimalFormatSymbols(Locale.US));
+ DecimalFormat dformatdialog = new DecimalFormat("#0.000000");
// final static String[] DSLItems = {"3D Analysis (CLSM, 2PM)", "2D in vivo / acute slices (live 2PM)", "2D in vitro (epiFM)"};
@@ -102,9 +104,12 @@ public class Thresholder implements PlugIn, Measurements{//, DialogListener {
//Multi-task management
ProgressDialog progressDialog;
boolean processingDone = false;
- boolean continueProcessing = true;
+ boolean continueProcessing = true;
+
+ boolean record = false;
public void run(String arg) {
+ dformatdialog.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
//-----------Eventually read settings from macro input------------------------
@@ -291,7 +296,13 @@ public void run(String arg) {
showDialog = false;
}
+ record = false;
+
if(showDialog) {
+ if(Recorder.record) {
+ record = true;
+ Recorder.record = false;
+ }
/**&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *
* display dialog
* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
@@ -365,9 +376,78 @@ public void run(String arg) {
autoSaveImage = gd.getNextBoolean();
saveDate = gd.getNextBoolean();
- if (gd.wasCanceled()) return;
+ if (gd.wasCanceled()) return;
+
+ if(record) {
+ Recorder.record = true;
+ }
+ }
+
+ //Create macro recording string if macro recording activated:
+ if (record) {
+ String recordString = "";
+ if(useAlternateRef) {
+ recordString += "use-alternate ";
+
+ if(getImageByName) {
+ recordString += "automatically-find ";
+ }
+
+ recordString += "begin-of-suffix=[" + nameSuffix + "] ";
+
+ recordString += "additional-suffix=[" + parentEnding + "] ";
+
+ if(restrictToPos) {
+ recordString += "restrict ";
+ }
+ }
+
+ recordString += "scale=" + dformatdialog.format(scalingFactor) + " ";
+
+ if(conv8Bit) {
+ recordString += "convert ";
+ }
+
+ recordString += "threshold=" + selectedAlgorithm + " ";
+
+ recordString += "stack-handling=[" + chosenStackMethod + "] ";
+
+ if(separateFrames) {
+ recordString += "threshold-every-time-step ";
+ }
+
+ if(onlyTimeGroup) {
+ recordString += "threshold-only-distinct-times ";
+ recordString += "start-time=" + startGroup + " ";
+ recordString += "end-time=" + endGroup + " ";
+ }
+
+ if(localThreshold) {
+ recordString += "local-threshold ";
+ recordString += "local-threshold-radius=" + locThrRadius + " ";
+ }
+
+ if(fillHoles) {
+ recordString += "fill-holes ";
+ }
+
+ if(keepIntensities) {
+ recordString += "keep-intensities ";
+ }
+ if(autoSaveImage) {
+ recordString += "automatically-save ";
+ }
+
+ if(saveDate) {
+ recordString += "include-date ";
+ }
+
+ recordString = recordString.substring(0,recordString.length()-1);
+ Recorder.record = true;
+
+ Recorder.recordString("run(\"" + PLUGINNAME + " (" + PLUGINVERSION + ")\",\"" + recordString + "\");\n");
}
/**&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
@@ -492,6 +572,9 @@ public void windowClosing(WindowEvent winEvt) {
// progressDialog.setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
progressDialog.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(WindowEvent winEvt) {
+ if (record) {
+ Recorder.record = true;
+ }
if(processingDone==false){
IJ.error("Script stopped...");
}
@@ -1109,8 +1192,14 @@ else if(chosenStackMethod.equals(stackMethod[4])){
parImp.close();
if(keepIntensities == false){
+ if (record) {
+ Recorder.record = false;
+ }
IJ.run(imp, "Grays", "");
if(imp.getBitDepth() != 8) IJ.run(imp, "8-bit", "");
+ if (record) {
+ Recorder.record = true;
+ }
}
/***************************************************************************
@@ -1193,7 +1282,13 @@ else if(chosenStackMethod.equals(stackMethod[4])){
+ " but WITHOUT ANY WARRANTY; without even the implied warranty of"
+ " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.");
tw1.append("Plugin version: "+PLUGINVERSION);
+ if (record) {
+ Recorder.record = false;
+ }
tw1.saveAs(outputPath + "_log.txt");
+ if (record) {
+ Recorder.record = true;
+ }
}
//Save Image Treatment
@@ -1204,7 +1299,7 @@ else if(chosenStackMethod.equals(stackMethod[4])){
}
System.gc();
}
- processingDone = true;
+ processingDone = true;
}
@@ -1506,6 +1601,10 @@ private void segmentImage(ImagePlus imp, double threshold, int z){
}
}
imp.setPosition(z+1);
+
+ if (record) {
+ Recorder.record = false;
+ }
if(!Prefs.blackBackground) {
IJ.run(maskImp, "Invert", "slice");
}
@@ -1513,6 +1612,9 @@ private void segmentImage(ImagePlus imp, double threshold, int z){
if(!Prefs.blackBackground) {
IJ.run(maskImp, "Invert", "slice");
}
+ if (record) {
+ Recorder.record = true;
+ }
progressDialog.updateBarText("segment image...");
for(int x = 0; x < imp.getWidth(); x++){
@@ -1563,7 +1665,9 @@ private void segmentImageLocally (ImagePlus imp, double thresholdMatrix [][][]){
}
}
-
+ if (record) {
+ Recorder.record = false;
+ }
if(!Prefs.blackBackground) {
IJ.run(transImp, "Invert", "stack");
}
@@ -1573,6 +1677,9 @@ private void segmentImageLocally (ImagePlus imp, double thresholdMatrix [][][]){
if(!Prefs.blackBackground) {
IJ.run(transImp, "Invert", "stack");
}
+ if (record) {
+ Recorder.record = true;
+ }
progressDialog.updateBarText("segment image...");
for(int x = 0; x < imp.getWidth(); x++){
diff --git a/Thresholder/src/main/resources/plugins.config b/Thresholder/src/main/resources/plugins.config
index 6596525..a27c4a1 100644
--- a/Thresholder/src/main/resources/plugins.config
+++ b/Thresholder/src/main/resources/plugins.config
@@ -24,8 +24,8 @@
# Belongs to the MotiQ toolbox for analyzing cellular morphology, dynamics, and signaling (https://github.com/hansenjn/MotiQ). MotiQ_thresholder is a automated thresholding tool for image stacks. MotiQ thresholder calculates a threshold in a separate reference image and applies it to the input image. The reference image is optionally processed by MotiQ thresholder prior to threshold calculation, whereby the image histogram used for threshold calculation can be improved.
# Author: Jan N. Hansen
-# Version: 0.2.0
+# Version: 0.2.1
# Date: 2017/09/15
# Requires: ImageJ
-Plugins>MotiQ, "MotiQ Thresholder (v0.2.0)", motiQ_thr.Thresholder
\ No newline at end of file
+Plugins>MotiQ, "MotiQ Thresholder (v0.2.1)", motiQ_thr.Thresholder
\ No newline at end of file