Commit aaf90b6f authored by Andrey Filippov's avatar Andrey Filippov

Working state, will remove extra

parent e20665e8
......@@ -35,7 +35,7 @@ import java.util.HashMap;
import java.util.Properties;
import java.util.Set;
import com.elphel.imagej.common.GenericJTabbedDialog;
import com.elphel.imagej.common.GenericJTabbedDialogMcp; // codex 2026-01-25
import com.elphel.imagej.common.WindowTools;
import com.elphel.imagej.correction.CorrectionColorProc;
import com.elphel.imagej.lwir.LwirReaderParameters;
......@@ -3408,7 +3408,7 @@ public class CLTParameters {
public boolean showJDialog() {
// GenericDialog gd = new GenericDialog("Set CLT parameters");
GenericJTabbedDialog gd = new GenericJTabbedDialog("Set CLT parameters",1090,900);
GenericJTabbedDialogMcp gd = new GenericJTabbedDialogMcp("Set CLT parameters",1090,900); // codex 2026-01-25
gd.addTab ("General", "General parameters");
gd.addNumericField("Nominal (rectilinear) disparity between side of square cameras (pix)", this.disparity, 3,7,"pix",
"Used when rendering 4 images");
......@@ -6315,4 +6315,4 @@ public class CLTParameters {
}
\ No newline at end of file
}
......@@ -44,7 +44,7 @@ import javax.swing.JFileChooser;
import com.elphel.imagej.calibration.CalibrationFileManagement;
import com.elphel.imagej.calibration.DirectoryChoser;
import com.elphel.imagej.calibration.MultipleExtensionsFileFilter;
import com.elphel.imagej.common.GenericJTabbedDialog;
import com.elphel.imagej.common.GenericJTabbedDialogMcp; // codex 2026-01-25
import com.elphel.imagej.common.WindowTools;
import com.elphel.imagej.tileprocessor.IntersceneMatchParameters;
......@@ -895,7 +895,7 @@ public class EyesisCorrectionParameters {
public boolean showJDialog(String title) {
// GenericDialog gd = new GenericDialog(title);
GenericJTabbedDialog gd = new GenericJTabbedDialog(title ,1000, 900);
GenericJTabbedDialogMcp gd = new GenericJTabbedDialogMcp(title ,1000, 900); // codex 2026-01-25
gd.addTab("Eyesis parameters","Eyesis camera parameters, most not all applicable to quad cameras");
gd.addCheckbox ("Splt into Bayer stack (if false will exit)", this.split);
gd.addCheckbox ("Apply vignetting/color correction to source files",this.vignetting);
......@@ -1197,7 +1197,7 @@ public class EyesisCorrectionParameters {
public boolean showCLTBatchDialog(String title,
CLTParameters clt_parameters) {
GenericJTabbedDialog gd = new GenericJTabbedDialog(title,1000,1000);
GenericJTabbedDialogMcp gd = new GenericJTabbedDialogMcp(title,1000,1000); // codex 2026-01-25
updateAuxFromMain();
......
package com.elphel.imagej.common;
import java.util.ArrayList;
import java.util.List;
import com.elphel.imagej.mcp.McpDialogField;
import com.elphel.imagej.mcp.McpDialogRegistry;
import com.elphel.imagej.mcp.McpDialogSession;
import ij.IJ;
public class GenericJTabbedDialogMcp extends GenericJTabbedDialog{
// codex 2026-01-25: MCP dialog capture state
private static boolean defaultMcpMode = false;
public boolean mcp_mode = false;
private final List<McpDialogField> mcpFields = new ArrayList<McpDialogField>();
private final String dialogTitle;
private String currentTab = "";
private int readIndex = 0;
public GenericJTabbedDialogMcp(String title) {
super(title);
this.dialogTitle = title;
this.mcp_mode = defaultMcpMode;
}
public GenericJTabbedDialogMcp(String title, int width, int height) {
super(title, width, height);
this.dialogTitle = title;
this.mcp_mode = defaultMcpMode;
}
// codex 2026-01-25: global MCP mode default
public static void setDefaultMcpMode(boolean enabled) {
defaultMcpMode = enabled;
}
private void addMcpField(McpDialogField field) {
mcpFields.add(field);
}
@Override
public void addTab(String tab_name, String tab_tooltip) {
if (mcp_mode) {
// codex 2026-01-25: capture current tab for MCP schema
currentTab = tab_name;
}
else super.addTab(tab_name, tab_tooltip);
}
......@@ -21,7 +49,14 @@ public class GenericJTabbedDialogMcp extends GenericJTabbedDialog{
@Override
public void addCheckbox(String label, boolean defaultValue, String tooltip) {
if (mcp_mode) {
addMcpField(new McpDialogField(
McpDialogField.Type.BOOLEAN,
label,
tooltip,
currentTab,
null,
null,
Boolean.toString(defaultValue)));
}
else super.addCheckbox(label, defaultValue, tooltip);
}
......@@ -29,7 +64,15 @@ public class GenericJTabbedDialogMcp extends GenericJTabbedDialog{
@Override
public void addNumericField(String label, double defaultValue, int digits, int columns, String units, String tooltip) {
if (mcp_mode) {
String defaultText = IJ.d2s(defaultValue, digits);
addMcpField(new McpDialogField(
McpDialogField.Type.NUMBER,
label,
tooltip,
currentTab,
units,
null,
defaultText));
}
else super.addNumericField(label, defaultValue, digits, columns, units, tooltip);
}
......@@ -41,7 +84,14 @@ public class GenericJTabbedDialogMcp extends GenericJTabbedDialog{
int width,
String tooltip) {
if (mcp_mode) {
addMcpField(new McpDialogField(
McpDialogField.Type.STRING,
label,
tooltip,
currentTab,
null,
null,
value));
}
else super.addStringField (label, value, width, tooltip);
}
......@@ -49,7 +99,14 @@ public class GenericJTabbedDialogMcp extends GenericJTabbedDialog{
@Override
public void addChoice(String label, String[] items, String defaultItem, String tooltip, int count) {
if (mcp_mode) {
addMcpField(new McpDialogField(
McpDialogField.Type.CHOICE,
label,
tooltip,
currentTab,
null,
items,
defaultItem));
}
else super.addChoice(label, items, defaultItem, tooltip, count);
}
......@@ -65,7 +122,14 @@ public class GenericJTabbedDialogMcp extends GenericJTabbedDialog{
@Override
public void addMessage(String message, String tooltip) {
if (mcp_mode) {
addMcpField(new McpDialogField(
McpDialogField.Type.MESSAGE,
message,
tooltip,
currentTab,
null,
null,
null));
}
else super.addMessage(message, tooltip);
}
......@@ -73,15 +137,51 @@ public class GenericJTabbedDialogMcp extends GenericJTabbedDialog{
@Override
public void buildDialog() { // non-blocking, does not show
if (mcp_mode) {
// codex 2026-01-25: publish dialog schema to MCP registry
readIndex = 0;
McpDialogRegistry.setCurrent(new McpDialogSession(dialogTitle, mcpFields));
}
else super.buildDialog();
}
private McpDialogField nextField(McpDialogField.Type type) {
while (readIndex < mcpFields.size()
&& mcpFields.get(readIndex).type == McpDialogField.Type.MESSAGE) {
readIndex++;
}
if (readIndex >= mcpFields.size()) {
return null;
}
McpDialogField field = mcpFields.get(readIndex);
if (field.type != type) {
throw new IllegalArgumentException(
"MCP dialog field mismatch: expected " + type + ", got " + field.type + " label=" + field.label);
}
readIndex++;
return field;
}
private String getValueOrDefault(McpDialogField field) {
McpDialogSession session = McpDialogRegistry.getCurrent();
if (session != null && field != null) {
String value = session.getValue(field.label);
if (value != null) {
return value;
}
}
return field == null ? null : field.defaultValue;
}
@Override
public boolean getNextBoolean() {
if (mcp_mode) {
return false;
McpDialogField field = nextField(McpDialogField.Type.BOOLEAN);
String value = getValueOrDefault(field);
if (value == null) {
return false;
}
String normalized = value.trim().toLowerCase();
return normalized.equals("true") || normalized.equals("1") || normalized.equals("yes") || normalized.equals("y");
}
else return super.getNextBoolean();
}
......@@ -89,7 +189,25 @@ public class GenericJTabbedDialogMcp extends GenericJTabbedDialog{
@Override
public int getNextChoiceIndex() {
if (mcp_mode) {
return -1;
McpDialogField field = nextField(McpDialogField.Type.CHOICE);
String value = getValueOrDefault(field);
if (value == null || field.choices == null) {
return 0;
}
try {
int idx = Integer.parseInt(value.trim());
if (idx >= 0 && idx < field.choices.length) {
return idx;
}
} catch (NumberFormatException e) {
// ignore and try by name
}
for (int i = 0; i < field.choices.length; i++) {
if (field.choices[i].equals(value)) {
return i;
}
}
return 0;
}
else return super.getNextChoiceIndex();
}
......@@ -97,7 +215,16 @@ public class GenericJTabbedDialogMcp extends GenericJTabbedDialog{
@Override
public double getNextNumber() {
if (mcp_mode) {
return Double.NaN;
McpDialogField field = nextField(McpDialogField.Type.NUMBER);
String value = getValueOrDefault(field);
if (value == null || value.isEmpty()) {
return Double.NaN;
}
try {
return Double.parseDouble(value);
} catch (NumberFormatException e) {
return Double.NaN;
}
}
else return super.getNextNumber();
}
......@@ -105,7 +232,9 @@ public class GenericJTabbedDialogMcp extends GenericJTabbedDialog{
@Override
public String getNextString() {
if (mcp_mode) {
return "";
McpDialogField field = nextField(McpDialogField.Type.STRING);
String value = getValueOrDefault(field);
return value == null ? "" : value;
}
else return super.getNextString();
}
......@@ -113,6 +242,7 @@ public class GenericJTabbedDialogMcp extends GenericJTabbedDialog{
@Override
public boolean showDialog() {
if (mcp_mode) {
buildDialog();
return true;
}
else return super.showDialog();
......@@ -121,6 +251,7 @@ public class GenericJTabbedDialogMcp extends GenericJTabbedDialog{
@Override
public String showDialogAny() {
if (mcp_mode) {
buildDialog();
return "";
}
else return super.showDialogAny();
......
......@@ -4,6 +4,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
/**
......@@ -20,6 +21,9 @@ public final class LogTee {
private static volatile PrintStream fileStream = null;
private static volatile Path sceneLogPath = null;
private static volatile boolean installed = false;
// codex 2026-01-25: optional console/file noise filter
private static volatile boolean filterEnabled = false;
private static volatile String[] filterSubstrings = null;
private LogTee() {
}
......@@ -27,6 +31,7 @@ public final class LogTee {
public static void install() {
synchronized (LOCK) {
if (installed) return;
configureFilterFromProperty();
System.setOut(new PrintStream(new TeeStream(ORIGINAL_OUT), true));
System.setErr(new PrintStream(new TeeStream(ORIGINAL_ERR), true));
installed = true;
......@@ -57,6 +62,55 @@ public final class LogTee {
return sceneLogPath;
}
// codex 2026-01-25: set filters via -Delphel.logtee.filter
// Values:
// "ome" -> built-in OME/Bio-Formats noise filters
// "none" -> disable filtering
// comma-separated substrings to drop lines containing any of them
private static void configureFilterFromProperty() {
String value = System.getProperty("elphel.logtee.filter");
if (value == null || value.trim().isEmpty()) {
filterEnabled = false;
filterSubstrings = null;
return;
}
String trimmed = value.trim();
if ("none".equalsIgnoreCase(trimmed)) {
filterEnabled = false;
filterSubstrings = null;
return;
}
if ("ome".equalsIgnoreCase(trimmed)) {
filterEnabled = true;
filterSubstrings = new String[] {
"Loaded properties from: services.properties",
"Added interface interface ome.codecs.services.JAIIIOService",
"Checking comment style",
"Expected positive value for PhysicalSize",
"Parsing TIFF EXIF data",
"Populating OME metadata",
"Reading IFDs"
};
return;
}
String[] parts = trimmed.split(",");
filterEnabled = parts.length > 0;
filterSubstrings = parts;
}
private static boolean shouldFilterLine(String line) {
if (!filterEnabled || filterSubstrings == null || line == null) {
return false;
}
for (String token : filterSubstrings) {
if (token == null) continue;
String t = token.trim();
if (t.isEmpty()) continue;
if (line.contains(t)) return true;
}
return false;
}
private static void closeFileStream() {
if (fileStream != null) {
fileStream.flush();
......@@ -66,6 +120,7 @@ public final class LogTee {
private static final class TeeStream extends OutputStream {
private final PrintStream console;
private final StringBuilder buffer = new StringBuilder();
private TeeStream(PrintStream console) {
this.console = console;
......@@ -73,23 +128,55 @@ public final class LogTee {
@Override
public void write(int b) throws IOException {
console.write(b);
PrintStream fs = fileStream;
if (fs != null) fs.write(b);
if (!filterEnabled) {
console.write(b);
PrintStream fs = fileStream;
if (fs != null) fs.write(b);
return;
}
buffer.append((char) b);
if (b == '\n') {
flushBuffer();
}
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
console.write(b, off, len);
PrintStream fs = fileStream;
if (fs != null) fs.write(b, off, len);
if (!filterEnabled) {
console.write(b, off, len);
PrintStream fs = fileStream;
if (fs != null) fs.write(b, off, len);
return;
}
String chunk = new String(b, off, len, StandardCharsets.UTF_8);
for (int i = 0; i < chunk.length(); i++) {
char c = chunk.charAt(i);
buffer.append(c);
if (c == '\n') {
flushBuffer();
}
}
}
@Override
public void flush() throws IOException {
if (filterEnabled && buffer.length() > 0) {
flushBuffer();
}
console.flush();
PrintStream fs = fileStream;
if (fs != null) fs.flush();
}
private void flushBuffer() {
String line = buffer.toString();
buffer.setLength(0);
if (shouldFilterLine(line)) {
return;
}
console.print(line);
PrintStream fs = fileStream;
if (fs != null) fs.print(line);
}
}
}
......@@ -104,12 +104,40 @@ public class EyesisCorrections {
case 2: LOG_LEVEL = "DEBUG"; break;
default: LOG_LEVEL = "OFF";
}
System.out.println("Method disabled: EyesisCorrections.setDebug("+debugLevel+"), LOG_LEVEL="+LOG_LEVEL);
return;
/*
// LOG_LEVEL = "ERROR"; // overwrite for testing
boolean LOG_LEVEL_SET = loci.common.DebugTools.enableLogging(LOG_LEVEL);
// if (!LOG_LEVEL_SET) { // only first time true
loci.common.DebugTools.setRootLevel(LOG_LEVEL);
// }
System.out.println("EyesisCorrections.setDebug("+debugLevel+"), LOG_LEVEL_SET="+LOG_LEVEL_SET+" LOG_LEVEL="+LOG_LEVEL);
*/
}
public void setDebugOnce(int debugLevel){
this.debugLevel=debugLevel;
String LOG_LEVEL = "OFF";
switch (this.debugLevel) {
case -2: LOG_LEVEL = "FATAL"; break;
case -1: LOG_LEVEL = "ERROR"; break;
case 0: LOG_LEVEL = "WARN"; break;
case 1: LOG_LEVEL = "INFO"; break;
case 2: LOG_LEVEL = "DEBUG"; break;
default: LOG_LEVEL = "OFF";
}
boolean LOG_LEVEL_SET = loci.common.DebugTools.enableLogging(LOG_LEVEL);
if (!LOG_LEVEL_SET) { // only first time true
loci.common.DebugTools.setRootLevel(LOG_LEVEL);
}
System.out.println("EyesisCorrections.setDebug("+debugLevel+"), LOG_LEVEL_SET="+LOG_LEVEL_SET+" LOG_LEVEL="+LOG_LEVEL);
return;
}
public int getNumChannels(){return (this.usedChannels!=null)?this.usedChannels.length:0;}
......@@ -614,7 +642,12 @@ public class EyesisCorrections {
this.defectsDiff[nChn]=null;
}
int [][] bayer={{1,0},{2,1}}; // GR/BG
// Assign static final Logger LOGGER here to prevent multi-hreaded races in new ImagejJp4Tiff();
// ImagejJp4Tiff.setLogger();
// ImagejJp4Tiff imagejJp4Tiff =
new ImagejJp4Tiff(); // just to cause
// still not enough, as
final Thread[] threads = ImageDtt.newThreadArray(threadsMax);
final AtomicInteger ai = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
......
......@@ -108,6 +108,7 @@ import com.elphel.imagej.common.CholeskyLDLTMulti;
import com.elphel.imagej.common.DoubleFHT;
import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.GenericJTabbedDialog;
import com.elphel.imagej.common.GenericJTabbedDialogMcp;
import com.elphel.imagej.common.LogTee;
import com.elphel.imagej.common.ShowDoubleFloatArrays;
import com.elphel.imagej.common.WindowTools;
......@@ -118,6 +119,7 @@ import com.elphel.imagej.gpu.GpuQuad;
import com.elphel.imagej.gpu.JCuda_ImageJ_Example_Plugin;
import com.elphel.imagej.ims.DjiSrt;
import com.elphel.imagej.ims.DjiSrtReader;
import com.elphel.imagej.mcp.McpServer;
import com.elphel.imagej.ims.EventLogger;
import com.elphel.imagej.ims.QuatVertLMA;
import com.elphel.imagej.ims.UasLogReader;
......@@ -527,6 +529,11 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
*/
LogTee.install(); // once, early
// codex 2026-01-25: start MCP server + enable MCP dialog mode by default
GenericJTabbedDialogMcp.setDefaultMcpMode(getMcpMode());
McpServer.startIfNeeded(this, getMcpPort());
// codex 2026-01-25: optional SLF4J/logback root level override
applySlf4jRootLevel();
try {
loadPrefs();
} catch (IOException e1) {
......@@ -1517,7 +1524,14 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
String label = e.getActionCommand();
triggerCommand(e.getActionCommand());
}
// codex 2026-01-25: MCP-visible command trigger
public void triggerCommand(String label) {
if (label == null) {
return;
}
if (label.equals("Abort")) {
this.SYNC_COMMAND.stopRequested.set(1);
this.SYNC_COMMAND.confirm = true;
......@@ -1527,27 +1541,107 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
this.SYNC_COMMAND.confirm = true;
return;
}
// System.out.println("actionPerformed: SwingUtilities.isEventDispatchThread()="+SwingUtilities.isEventDispatchThread());
// executed in EDT, so no need to synchronize additionally?
// System.out.println("triggerCommand: SwingUtilities.isEventDispatchThread()="+SwingUtilities.isEventDispatchThread());
if (this.SYNC_COMMAND.isRunning) {
this.SYNC_COMMAND.interruptCommand();
/*
GenericDialog gd = new GenericDialog("Busy");
gd.addMessage("Command \"" + this.SYNC_COMMAND.buttonLabel + "\" is running. Ask it to stop "
+ ((this.SYNC_COMMAND.stopRequested.get() != 0) ? "(again!) " : "") + "(when possible)?");
gd.enableYesNoCancel("ASAP", "When convenient");
gd.showDialog();
if (gd.wasCanceled())
return;
this.SYNC_COMMAND.stopRequested.set(gd.wasOKed() ? 1 : 2);
*/
return;
}
synchronized (this.SYNC_COMMAND) {
this.SYNC_COMMAND.buttonLabel = label;
this.SYNC_COMMAND.notify();
}
// matchSimulatedPattern.FFT_SIZE=FFT_SIZE;
}
// codex 2026-01-25: MCP status accessors
public boolean isSyncRunning() {
return this.SYNC_COMMAND.isRunning;
}
public int getSyncStopRequested() {
return this.SYNC_COMMAND.stopRequested.get();
}
public String getSyncButtonLabel() {
return this.SYNC_COMMAND.buttonLabel;
}
private int getMcpPort() {
String value = System.getProperty("elphel.mcp.port");
if (value == null || value.isEmpty()) {
return 48888;
}
try {
return Integer.parseInt(value);
} catch (NumberFormatException e) {
return 48888;
}
}
private boolean getMcpMode() {
String value = System.getProperty("elphel.mcp.mode");
if (value == null || value.isEmpty()) {
return true;
}
return Boolean.parseBoolean(value);
}
// codex 2026-01-25: allow JVM flag to quiet SLF4J/logback and JUL noise
private void applySlf4jRootLevel() {
String value = System.getProperty("elphel.slf4j.level");
if (value == null || value.isEmpty()) {
return;
}
try {
Object factory = org.slf4j.LoggerFactory.getILoggerFactory();
if (factory instanceof ch.qos.logback.classic.LoggerContext) {
ch.qos.logback.classic.Logger root =
((ch.qos.logback.classic.LoggerContext) factory).getLogger(
org.slf4j.Logger.ROOT_LOGGER_NAME);
ch.qos.logback.classic.Level level =
ch.qos.logback.classic.Level.toLevel(value, ch.qos.logback.classic.Level.ERROR);
root.setLevel(level);
// also quiet common Bio-Formats namespaces
((ch.qos.logback.classic.LoggerContext) factory).getLogger("loci").setLevel(level);
((ch.qos.logback.classic.LoggerContext) factory).getLogger("ome").setLevel(level);
((ch.qos.logback.classic.LoggerContext) factory).getLogger("org.openmicroscopy").setLevel(level);
((ch.qos.logback.classic.LoggerContext) factory)
.getLogger("loci.common.services.ServiceFactory").setLevel(level);
}
try {
loci.common.DebugTools.setRootLevel(value);
} catch (Throwable t2) {
System.out.println("loci.common not yet available: "+t2.getMessage());
// ignore if loci.common not yet available
}
applyJulRootLevel(value);
} catch (Throwable t) {
System.out.println("SLF4J level override failed: " + t.getMessage());
}
}
// codex 2026-01-25: reduce java.util.logging output if Bio-Formats uses JUL
private void applyJulRootLevel(String value) {
java.util.logging.Level level = julLevel(value);
java.util.logging.Logger root = java.util.logging.Logger.getLogger("");
root.setLevel(level);
for (java.util.logging.Handler h : root.getHandlers()) {
h.setLevel(level);
}
}
// codex 2026-01-25: map string to JUL level
private java.util.logging.Level julLevel(String value) {
if (value == null) {
return java.util.logging.Level.SEVERE;
}
String v = value.trim().toUpperCase();
if (v.equals("OFF")) return java.util.logging.Level.OFF;
if (v.equals("ERROR") || v.equals("SEVERE")) return java.util.logging.Level.SEVERE;
if (v.equals("WARN") || v.equals("WARNING")) return java.util.logging.Level.WARNING;
if (v.equals("INFO")) return java.util.logging.Level.INFO;
if (v.equals("DEBUG") || v.equals("FINE")) return java.util.logging.Level.FINE;
if (v.equals("TRACE") || v.equals("FINER")) return java.util.logging.Level.FINER;
return java.util.logging.Level.SEVERE;
}
public void processFiles() {
......@@ -2054,27 +2148,41 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
} else if (label.equals("Save") || label.equals("Save Clean")) {
// If saved just after restore, QUAD_CLT==null and QUAD_CLT_AUX==null and are
// not saved
int dbg_magic = 4;
System.out.println("dbg_magic="+dbg_magic);
if (QUAD_CLT == null) {
QUAD_CLT = new QuadCLT(QuadCLT.PREFIX, PROPERTIES, EYESIS_CORRECTIONS, CORRECTION_PARAMETERS);
if (DEBUG_LEVEL > 0) {
System.out.println("Created new QuadCLT instance, will need to read CLT kernels");
}
}
if (dbg_magic == 1) {
return;
}
if (QUAD_CLT_AUX == null) {
if (EYESIS_CORRECTIONS_AUX == null) {
EYESIS_CORRECTIONS_AUX = new EyesisCorrections(SYNC_COMMAND.stopRequested,
CORRECTION_PARAMETERS.getAux());
}
if (dbg_magic == 2) {
return;
}
QUAD_CLT_AUX = new QuadCLT(QuadCLT.PREFIX_AUX, PROPERTIES, EYESIS_CORRECTIONS_AUX,
CORRECTION_PARAMETERS.getAux());
if (DEBUG_LEVEL > 0) {
System.out.println("Created new QuadCLT instance, will need to read CLT kernels for aux camera");
}
if (dbg_magic == 3) {
return;
}
}
if (label.equals("Save Clean")) {
PROPERTIES = new Properties();
}
if (dbg_magic == 4) {
return;
}
saveProperties(
null,
CORRECTION_PARAMETERS.resultsDirectory,
......@@ -5699,8 +5807,24 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
/* ======================================================================== */
} else if (label.equals("Aux Build Series")) {
DEBUG_LEVEL = MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
/// EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
CLT_PARAMETERS.batch_run = true;
/*
if (QUAD_CLT == null) {
QUAD_CLT = new QuadCLT(QuadCLT.PREFIX, PROPERTIES, EYESIS_CORRECTIONS, CORRECTION_PARAMETERS);
if (DEBUG_LEVEL > 0) {
System.out.println("Created new QuadCLT instance, will need to read CLT kernels");
}
}
if (QUAD_CLT_AUX == null) {
if (EYESIS_CORRECTIONS_AUX == null) {
EYESIS_CORRECTIONS_AUX = new EyesisCorrections(SYNC_COMMAND.stopRequested,
CORRECTION_PARAMETERS.getAux());
}
QUAD_CLT_AUX = new QuadCLT(QuadCLT.PREFIX_AUX, PROPERTIES, EYESIS_CORRECTIONS_AUX,
CORRECTION_PARAMETERS.getAux());
}
*/
buildSeries(
true,
0); // int cuas_proc_mode); // 0 - old, 1 combine scene series) {);
......
......@@ -83,7 +83,7 @@ public class ElphelJp4Reader extends ImageIOReader{
/** Logger for this class. */
private static final Logger LOGGER =
LoggerFactory.getLogger(ElphelTiffReader.class);
LoggerFactory.getLogger(ElphelJp4Reader.class); // ElphelTiffReader.class);
// -- Fields --
private URL url = null; // save here actual URL when reading file to memory
......@@ -107,7 +107,7 @@ public class ElphelJp4Reader extends ImageIOReader{
// or these readers are combined with all other readers in readers.txt
suffixNecessary = true; // false
suffixSufficient = true; // false;
LOGGER.info("ElphelTiffReader(), after super()");
LOGGER.debug("ElphelTiffReader(), after super()");
if (REPLACEMENT_TAG_MAP == null) {
REPLACEMENT_TAG_MAP = new HashMap<String,String>();
for (String [] line: REPLACEMENT_TAGS) {
......@@ -156,15 +156,15 @@ public class ElphelJp4Reader extends ImageIOReader{
public void setId(String id) throws FormatException, IOException { // same as for tiff?
image_bytes = null;
// buffered_data = null;
LOGGER.info("setId("+id+"). before super" );
LOGGER.debug("setId("+id+"). before super" );
file_initialized = false;
mapped_externally = false;
if (Location.getIdMap().containsKey(id)) {
LOGGER.info("id '"+id+"' is already mapped" );
LOGGER.debug("id '"+id+"' is already mapped" );
content_fileName = id; // id; // maybe set to null to handle externally?
mapped_externally = true;
LOGGER.info("Starting initFile() method, read file directly");
LOGGER.debug("Starting initFile() method, read file directly");
super.setId(id);
} else {
// If URL, then read to memory, if normal file - use direct access
......@@ -177,7 +177,7 @@ public class ElphelJp4Reader extends ImageIOReader{
// LOGGER.warn("Bad URL1: " + id); // will try direct file, not an error
}
if (url != null) {
LOGGER.info("Starting initFile() method, read "+ id +" to memory first");
LOGGER.debug("Starting initFile() method, read "+ id +" to memory first");
//https://www.rgagnon.com/javadetails/java-0487.html
URLConnection connection = url.openConnection();
......@@ -194,44 +194,44 @@ public class ElphelJp4Reader extends ImageIOReader{
content_fileName = "unknown." + suffix;
}
// currentId = fileName; //???
// LOGGER.info("Mime type = "+mime);
// LOGGER.debug("Mime type = "+mime);
// https://stackoverflow.com/questions/2793150/how-to-use-java-net-urlconnection-to-fire-and-handle-http-requests
//https://stackoverflow.com/questions/2295221/java-net-url-read-stream-to-byte
InputStream is = url.openStream (); //
byte[] inBytes = IOUtils.toByteArray(is);
if (is != null) is.close();
LOGGER.info("Bytes read: "+ inBytes.length);
LOGGER.debug("Bytes read: "+ inBytes.length);
Location.mapFile(content_fileName, new ByteArrayHandle(inBytes));
// HashMap<String,Object> dbg_loc = Location.getIdMap();
super.setId(content_fileName);
} else { // read file normally
content_fileName = id;
LOGGER.info("read file directly");
LOGGER.debug("read file directly");
super.setId(id);
}
}
//getReader
// super.setId(id);
LOGGER.info("setId("+id+"). after super" );
LOGGER.debug("setId("+id+"). after super" );
file_initialized = true;
}
/* @see loci.formats.FormatReader#initFile(String) */
@Override
protected void initFile(String id) throws FormatException, IOException {
LOGGER.info("initFile("+id+"), currentId="+currentId+", before super" );
LOGGER.debug("initFile("+id+"), currentId="+currentId+", before super" );
try {
super.initFile(id); // fails class_not_found
}
catch (IllegalArgumentException e) {
throw new FormatException(e);
}
LOGGER.info("initFile("+id+"), currentId="+currentId+", after super" );
LOGGER.debug("initFile("+id+"), currentId="+currentId+", after super" );
// Below needs to be modified - EXIFService does not work with mapFile
MetadataStore store = makeFilterMetadata();
LOGGER.info("Parsing JPEG EXIF data");
LOGGER.debug("Parsing JPEG EXIF data");
HashMap<String, String> tags = null;
try {
// Reimplementing ExifServiceImpl as original does not have ExifIFD0Directory
......@@ -295,7 +295,7 @@ public class ElphelJp4Reader extends ImageIOReader{
}
catch (ServiceException e) {
LOGGER.info("Could not parse EXIF data", e);
LOGGER.debug("Could not parse EXIF data", e);
}
long [] maker_note = null;
double exposure = Double.NaN;
......@@ -324,14 +324,14 @@ public class ElphelJp4Reader extends ImageIOReader{
int bytes_per_pixel = 1;
Hashtable<String, String> property_table = ElphelMeta.getMeta(
null, maker_note, exposure, date_time, bytes_per_pixel, true );
LOGGER.info("Created elphelMeta table, size="+property_table.size());
LOGGER.debug("Created elphelMeta table, size="+property_table.size());
for (String key:property_table.keySet()) {
addGlobalMeta(ELPHEL_PROPERTY_PREFIX+key,property_table.get(key));
}
MetadataLevel level = getMetadataOptions().getMetadataLevel();
if (level != MetadataLevel.MINIMUM) {
// Integer[] tags = ifds.get(0).keySet().toArray(new Integer[0]);
// LOGGER.info("initStandardMetadata() - got "+tags.length+" tags");
// LOGGER.debug("initStandardMetadata() - got "+tags.length+" tags");
}
addGlobalMeta(ELPHEL_PROPERTY_PREFIX+CONTENT_FILENAME,content_fileName);
}
......@@ -343,9 +343,9 @@ public class ElphelJp4Reader extends ImageIOReader{
// HashMap<String,Object> dbg_loc = Location.getIdMap();
String saveCurrentId = currentId;
currentId = null;
LOGGER.info("close("+fileOnly+") before super");
LOGGER.debug("close("+fileOnly+") before super");
super.close(fileOnly); // curerent_id == null only during actual close?
LOGGER.info("close("+fileOnly+") after super");
LOGGER.debug("close("+fileOnly+") after super");
currentId = saveCurrentId;
// if ((content_fileName != null) && file_initialized){
if (!mapped_externally && file_initialized){ // will try to unmap non-mapped file, OK
......@@ -385,7 +385,7 @@ public class ElphelJp4Reader extends ImageIOReader{
public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h)
throws FormatException, IOException
{
LOGGER.info("openBytes() - before super()");
LOGGER.debug("openBytes() - before super()");
FormatTools.checkPlaneParameters(this, no, buf.length, x, y, w, h);
if (image_bytes == null) {
jp4Decode(no);
......@@ -401,7 +401,7 @@ public class ElphelJp4Reader extends ImageIOReader{
w);
dest += w;
}
LOGGER.info("openBytes() - after super()");
LOGGER.debug("openBytes() - after super()");
return buf;
}
public void jp4Decode(int no) throws FormatException, IOException {
......@@ -436,7 +436,7 @@ public class ElphelJp4Reader extends ImageIOReader{
} else {
image_bytes = ib; // temporary
}
LOGGER.info("jp4Decode()");
LOGGER.debug("jp4Decode()");
}
}
......@@ -181,7 +181,7 @@ public class ElphelTiffReader extends TiffReader{ // BaseTiffReader {
suffixNecessary = true; // false
suffixSufficient = true; // false;
/// mergeSubIFDs = true; // false;
LOGGER.info("ElphelTiffReader(), after supper(), mergeSubIFDs = true;");
LOGGER.debug("ElphelTiffReader(), after supper(), mergeSubIFDs = true;");
if (REPLACEMENT_TAG_MAP == null) {
REPLACEMENT_TAG_MAP = new HashMap<String,String>();
for (String [] line: REPLACEMENT_TAGS) {
......@@ -227,14 +227,14 @@ public class ElphelTiffReader extends TiffReader{ // BaseTiffReader {
@Override
public void setId(String id) throws FormatException, IOException {
LOGGER.info("setId("+id+"). before super" );
LOGGER.debug("setId("+id+"). before super" );
file_initialized = false;
mapped_externally = false;
if (Location.getIdMap().containsKey(id)) {
LOGGER.info("id '"+id+"' is already mapped" );
LOGGER.debug("id '"+id+"' is already mapped" );
content_fileName = id; // id; // maybe set to null to handle externally?
mapped_externally = true;
LOGGER.info("Starting setId() method, read file directly");
LOGGER.debug("Starting setId() method, read file directly");
super.setId(id);
} else {
// If URL, then read to memory, if normal file - use direct access
......@@ -260,7 +260,7 @@ public class ElphelTiffReader extends TiffReader{ // BaseTiffReader {
}
if (url != null) {
LOGGER.info("Starting initFile() method, read "+ id +" to memory first");
LOGGER.debug("Starting initFile() method, read "+ id +" to memory first");
//https://www.rgagnon.com/javadetails/java-0487.html
URLConnection connection = url.openConnection();
......@@ -277,27 +277,27 @@ public class ElphelTiffReader extends TiffReader{ // BaseTiffReader {
content_fileName = "unknown." + suffix;
}
// currentId = fileName; //???
// LOGGER.info("Mime type = "+mime);
// LOGGER.debug("Mime type = "+mime);
// https://stackoverflow.com/questions/2793150/how-to-use-java-net-urlconnection-to-fire-and-handle-http-requests
//https://stackoverflow.com/questions/2295221/java-net-url-read-stream-to-byte
InputStream is = url.openStream (); //
byte[] inBytes = IOUtils.toByteArray(is);
if (is != null) is.close();
LOGGER.info("Bytes read: "+ inBytes.length);
LOGGER.debug("Bytes read: "+ inBytes.length);
Location.mapFile(content_fileName, new ByteArrayHandle(inBytes));
// HashMap<String,Object> dbg_loc = Location.getIdMap();
super.setId(content_fileName);
} else { // read file normally
content_fileName = id;
LOGGER.info("read file directly");
LOGGER.debug("read file directly");
super.setId(id);
}
}
//getReader
// super.setId(id);
LOGGER.info("setId("+id+"). after super" );
LOGGER.debug("setId("+id+"). after super" );
file_initialized = true;
}
......@@ -308,26 +308,26 @@ public class ElphelTiffReader extends TiffReader{ // BaseTiffReader {
{
// Trying ServiceFactory before it is going to be initialized, so static defaultFactory will be initialized
// with small set of services - only needed for Elphel
LOGGER.info("Starting initFile() method");
LOGGER.debug("Starting initFile() method");
super.initFile(id);
LOGGER.info("Ending initFile() method");
LOGGER.debug("Ending initFile() method");
}
/* @see loci.formats.FormatReader#initFile(String) */
// copied from ElphelJp4Reader
@Override
protected void initFile(String id) throws FormatException, IOException {
LOGGER.info("initFile("+id+"), currentId="+currentId+", before super" );
LOGGER.debug("initFile("+id+"), currentId="+currentId+", before super" );
try {
super.initFile(id); // fails class_not_found
}
catch (IllegalArgumentException e) {
throw new FormatException(e);
}
LOGGER.info("initFile("+id+"), currentId="+currentId+", after super" );
LOGGER.debug("initFile("+id+"), currentId="+currentId+", after super" );
// Below needs to be modified - EXIFService does not work with mapFile
MetadataStore store = makeFilterMetadata();
LOGGER.info("Parsing TIFF EXIF data");
LOGGER.debug("Parsing TIFF EXIF data");
HashMap<String, String> tags = null;
try {
// Reimplementing ExifServiceImpl as original does not have ExifIFD0Directory
......@@ -394,7 +394,7 @@ public class ElphelTiffReader extends TiffReader{ // BaseTiffReader {
}
catch (ServiceException e) {
LOGGER.info("Could not parse EXIF data", e);
LOGGER.debug("Could not parse EXIF data", e);
}
long [] maker_note = null;
double exposure = Double.NaN;
......@@ -425,14 +425,14 @@ public class ElphelTiffReader extends TiffReader{ // BaseTiffReader {
int bytes_per_pixel = (bpp + 7) / 9;
Hashtable<String, String> property_table = ElphelMeta.getMeta(
null, maker_note, exposure, date_time, bytes_per_pixel, true );
LOGGER.info("Created elphelMeta table, size="+property_table.size());
LOGGER.debug("Created elphelMeta table, size="+property_table.size());
for (String key:property_table.keySet()) {
addGlobalMeta(ELPHEL_PROPERTY_PREFIX+key,property_table.get(key));
}
MetadataLevel level = getMetadataOptions().getMetadataLevel();
if (level != MetadataLevel.MINIMUM) {
// Integer[] tags = ifds.get(0).keySet().toArray(new Integer[0]);
// LOGGER.info("initStandardMetadata() - got "+tags.length+" tags");
// LOGGER.debug("initStandardMetadata() - got "+tags.length+" tags");
}
addGlobalMeta(ELPHEL_PROPERTY_PREFIX+CONTENT_FILENAME,content_fileName);
}
......@@ -452,9 +452,9 @@ public class ElphelTiffReader extends TiffReader{ // BaseTiffReader {
/* @see loci.formats.IFormatReader#close(boolean) */
@Override
public void close(boolean fileOnly) throws IOException {
LOGGER.info("close("+fileOnly+") before super");
LOGGER.debug("close("+fileOnly+") before super");
super.close(fileOnly); // curerent_id == null only during actual close?
LOGGER.info("close("+fileOnly+") after super");
LOGGER.debug("close("+fileOnly+") after super");
// if ((content_fileName != null) && file_initialized){
if (!mapped_externally && file_initialized){ // will try to unmap non-mapped file, OK
Location.mapFile(content_fileName, null);
......@@ -479,10 +479,10 @@ public class ElphelTiffReader extends TiffReader{ // BaseTiffReader {
/* Removed 08/03/2021 to match IP4
@Override
protected void initStandardMetadata() throws FormatException, IOException {
LOGGER.info("initStandardMetadata() - before super()");
LOGGER.debug("initStandardMetadata() - before super()");
super.initStandardMetadata();
String comment = ifds.get(0).getComment(); // IMAGE_DESCRIPTION
LOGGER.info("initStandardMetadata() - after super()");
LOGGER.debug("initStandardMetadata() - after super()");
long[] maker_note = null;
double exposure = Double.NaN;
String date_time = null;
......@@ -521,14 +521,14 @@ public class ElphelTiffReader extends TiffReader{ // BaseTiffReader {
null, maker_note, exposure, date_time, bytes_per_pixel, true );
LOGGER.info("Created elphelMeta table, size="+property_table.size());
LOGGER.debug("Created elphelMeta table, size="+property_table.size());
for (String key:property_table.keySet()) {
addGlobalMeta(ELPHEL_PROPERTY_PREFIX+key,property_table.get(key));
}
MetadataLevel level = getMetadataOptions().getMetadataLevel();
if (level != MetadataLevel.MINIMUM) {
Integer[] tags = ifds.get(0).keySet().toArray(new Integer[0]);
LOGGER.info("initStandardMetadata() - got "+tags.length+" tags");
LOGGER.debug("initStandardMetadata() - got "+tags.length+" tags");
}
addGlobalMeta(ELPHEL_PROPERTY_PREFIX+CONTENT_FILENAME,content_fileName);
// convert MAKER_NOTE to the same text format as in com.drew.metadata
......@@ -565,9 +565,9 @@ public class ElphelTiffReader extends TiffReader{ // BaseTiffReader {
public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h)
throws FormatException, IOException
{
LOGGER.info("openBytes() - before super()");
LOGGER.debug("openBytes() - before super()");
super.openBytes(no, buf, x, y, w, h);
LOGGER.info("openBytes() - after super()");
LOGGER.debug("openBytes() - after super()");
return buf;
}
......
......@@ -88,7 +88,11 @@ import loci.formats.tiff.TiffSaver;
public class EyesisTiff {
private static ClassList<IFormatReader> defaultClasses;
private static final Logger LOGGER = LoggerFactory.getLogger(ClassList.class);
private static final Logger LOGGER =
LoggerFactory.getLogger(ClassList.class);
// codex 2026-01-25: reuse ServiceFactory/OMEXMLService to avoid repeated service init
private static ServiceFactory SERVICE_FACTORY = null;
private static OMEXMLService OME_XML_SERVICE = null;
public static ClassList<IFormatReader> getCustomReaderClasses() {
defaultClasses = null;
if (defaultClasses == null) {
......@@ -102,11 +106,11 @@ public class EyesisTiff {
}
catch (IOException exc) {
defaultClasses = new ClassList<IFormatReader>(IFormatReader.class);
LOGGER.info("Could not parse class list; using default classes", exc);
LOGGER.debug("Could not parse class list; using default classes", exc);
}
}
// ClassList<IFormatReader> dc = defaultClasses;
LOGGER.info("Loaded "+defaultClasses.getClasses().length+" classes");
LOGGER.debug("Loaded "+defaultClasses.getClasses().length+" classes");
return defaultClasses;
}
......@@ -128,29 +132,16 @@ public class EyesisTiff {
String inId = null;
inId = path;
ServiceFactory factory = null;
try {
factory = new ServiceFactory();
} catch (DependencyException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
OMEXMLService service = null;
try {
service = factory.getInstance(OMEXMLService.class);
} catch (DependencyException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
OMEXMLService service = getOmexmlService();
IMetadata omeMeta = null;
try {
omeMeta = service.createOMEXMLMetadata();
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (service != null) {
try {
omeMeta = service.createOMEXMLMetadata();
} catch (ServiceException e) {
e.printStackTrace();
}
}
// final Class<? extends IFormatReader>[] defaultClasses =
// ImageReader.getDefaultReaderClasses().getClasses();
......@@ -165,7 +156,9 @@ public class EyesisTiff {
classList.addClass(com.elphel.imagej.readers.ElphelTiffReader.class);
ImageReader reader = new ImageReader(getCustomReaderClasses());
// ImageReader reader = new ImageReader(classList);
reader.setMetadataStore(omeMeta);
if (omeMeta != null) {
reader.setMetadataStore(omeMeta);
}
try {
reader.setId(inId);
} catch (FormatException e) {
......@@ -238,7 +231,29 @@ public class EyesisTiff {
// TODO Auto-generated catch block
e.printStackTrace();
}
return imp;
return imp;
}
// codex 2026-01-25: singleton OMEXMLService to avoid repeated ServiceFactory init
private static synchronized OMEXMLService getOmexmlService() {
if (OME_XML_SERVICE != null) {
return OME_XML_SERVICE;
}
if (SERVICE_FACTORY == null) {
try {
SERVICE_FACTORY = new ServiceFactory();
} catch (DependencyException e) {
e.printStackTrace();
return null;
}
}
try {
OME_XML_SERVICE = SERVICE_FACTORY.getInstance(OMEXMLService.class);
} catch (DependencyException e) {
e.printStackTrace();
return null;
}
return OME_XML_SERVICE;
}
/*
......
......@@ -64,6 +64,7 @@ import com.elphel.imagej.common.ShowDoubleFloatArrays;
import com.elphel.imagej.tileprocessor.ImageDtt;
import com.elphel.imagej.tileprocessor.TileNeibs;
import ch.qos.logback.classic.Level;
import ij.ImagePlus;
import ij.process.FloatProcessor;
import ij.process.ImageProcessor;
......@@ -83,7 +84,9 @@ public class ImagejJp4Tiff {
// -- Constants --
private static final Logger LOGGER = LoggerFactory.getLogger(ClassList.class);
// private static final Logger LOGGER = null;
private static final Logger LOGGER =
LoggerFactory.getLogger(ClassList.class);
private static final boolean BYPASS_SERVICES = false; // true;
private static final String TELEMETRY_PREFIX = "TLM_";
private static final String SERVICES_PATH = "services.properties.forelphel";
......@@ -106,12 +109,26 @@ public class ImagejJp4Tiff {
private static final String FIXCH5_LATEST = "2025-11-01 00:00:00.000"; // finally fixed
private static final int FIXCH5_CHANNEL = 1;
/*
public static boolean setLogger() {
if (LOGGER == null) {
LOGGER =
LoggerFactory.getLogger(ClassList.class);
return true;
} else {
return false;
}
}
*/
// -- Fields --
private ImageReader reader = null;
private String content_fileName = "undefined"; // from Content-disposition
private URL url = null; // save here actual URL when reading file to memory
IMetadata omeMeta = null;
// codex 2026-01-25: reuse ServiceFactory/OMEXMLService to avoid repeated service init
private static ServiceFactory SERVICE_FACTORY = null;
private static OMEXMLService OME_XML_SERVICE = null;
// -- Constructor --
......@@ -127,41 +144,41 @@ public class ImagejJp4Tiff {
// URL u = this.getClass().getResource("/"+SERVICES_PATH);
if (!BYPASS_SERVICES) {
ServiceFactory factory = null;
try {
// factory = new ServiceFactory();
// Still does not work - during initFile->populatePixels it loads all
// services, including buggy ones
factory = new ServiceFactory(); // "/"+SERVICES_PATH);
} catch (DependencyException e) {
// TODO Auto-generated catch block
e.printStackTrace();
OMEXMLService service = getOmexmlService();
if (service != null) {
try {
omeMeta = service.createOMEXMLMetadata();
} catch (ServiceException e) {
e.printStackTrace();
}
}
}
reader = new ImageReader(classList); // tries to initialize static LOGGER
if (!BYPASS_SERVICES) {
reader.setMetadataStore(omeMeta);
}
}
OMEXMLService service = null;
// codex 2026-01-25: singleton OMEXMLService to avoid repeated ServiceFactory init
private static synchronized OMEXMLService getOmexmlService() {
if (OME_XML_SERVICE != null) {
return OME_XML_SERVICE;
}
if (SERVICE_FACTORY == null) {
try {
service = factory.getInstance(OMEXMLService.class);
SERVICE_FACTORY = new ServiceFactory();
} catch (DependencyException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
omeMeta = service.createOMEXMLMetadata();
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
reader = new ImageReader(classList);
if (!BYPASS_SERVICES) {
reader.setMetadataStore(omeMeta);
}
try {
OME_XML_SERVICE = SERVICE_FACTORY.getInstance(OMEXMLService.class);
} catch (DependencyException e) {
e.printStackTrace();
return null;
}
return OME_XML_SERVICE;
}
// -- API methods --
......@@ -199,7 +216,7 @@ public class ImagejJp4Tiff {
}
//https://stackoverflow.com/questions/39086500/read-http-response-header-and-body-from-one-http-request-in-java
if (url != null) {
LOGGER.info("Read "+ path_url +" to memory first");
LOGGER.debug("Read "+ path_url +" to memory first");
URLConnection connection = url.openConnection();
// Wrong - waits forever
String content_disposition = connection.getHeaderField("Content-Disposition"); // reads file
......@@ -218,13 +235,13 @@ public class ImagejJp4Tiff {
InputStream is = connection.getInputStream ();
byte[] inBytes = IOUtils.toByteArray(is);
if (is != null) is.close();
LOGGER.info("Bytes read: "+ inBytes.length);
LOGGER.debug("Bytes read: "+ inBytes.length);
Location.mapFile(content_fileName, new ByteArrayHandle(inBytes));
// HashMap<String,Object> dbg_loc = Location.getIdMap();
// super.setId(content_fileName);
} else { // read file normally
content_fileName = path_url;
LOGGER.info("read '"+path_url+"' file directly");
LOGGER.debug("read '"+path_url+"' file directly");
}
reader.setId(content_fileName);
byte [] bytes = null;
......
......@@ -40,10 +40,10 @@ import loci.formats.FormatException;
public class ImagejJp4TiffMulti {
private static final int MAX_THREADS = 100;
private static final Logger LOGGER = LoggerFactory.getLogger(ClassList.class);
private static final Logger LOGGER =
LoggerFactory.getLogger(ClassList.class);
private final ImagejJp4Tiff [] imagejJp4Tiff = new ImagejJp4Tiff [MAX_THREADS];
public ImagePlus [] getMultiImages(
final String [] urls,
final ImagePlus [] imps,
......
......@@ -29,7 +29,7 @@ import java.io.IOException;
import java.util.Properties;
import java.util.StringTokenizer;
import com.elphel.imagej.common.GenericJTabbedDialog;
import com.elphel.imagej.common.GenericJTabbedDialogMcp; // codex 2026-01-25
import com.elphel.imagej.cuas.CuasMotion;
import com.elphel.imagej.orthomosaic.ComboMatch;
import com.elphel.imagej.vegetation.VegetationLMA;
......@@ -1427,7 +1427,7 @@ min_str_neib_fpn 0.35
}
public void dialogQuestions(GenericJTabbedDialog gd) {
public void dialogQuestions(GenericJTabbedDialogMcp gd) { // codex 2026-01-25
// gd.addMessage ("Scene parameters selection");
// gd.addTab ("Inter-Match", "Parameters for full-resolution (no decimation/macrotiles) scene matching");
gd.addTab ("IMS", "IMS Integration for interscene matching");
......@@ -3590,7 +3590,7 @@ min_str_neib_fpn 0.35
gd.addCheckbox ("Add scene offsets", synth_add_offs, "Add scene offsets (vignetting corrcetion).");
}
public void dialogAnswers(GenericJTabbedDialog gd) {
public void dialogAnswers(GenericJTabbedDialogMcp gd) { // codex 2026-01-25
this.ims_use = gd.getNextBoolean();
this.ims_rebuild = gd.getNextBoolean();
this.ims_offset = gd.getNextNumber();
......@@ -8804,4 +8804,3 @@ min_str_neib_fpn 0.35
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment