Commit 1e93c781 authored by Andrey Filippov's avatar Andrey Filippov

Resolving slf4j issues

parent aaf90b6f
...@@ -91,8 +91,9 @@ public class EyesisCorrections { ...@@ -91,8 +91,9 @@ public class EyesisCorrections {
){ ){
this.correctionsParameters=correctionsParameters; this.correctionsParameters=correctionsParameters;
this.stopRequested=stopRequested; this.stopRequested=stopRequested;
setDebug(-2); // setDebug(-2);
} }
/*
public void setDebug(int debugLevel){ public void setDebug(int debugLevel){
this.debugLevel=debugLevel; this.debugLevel=debugLevel;
String LOG_LEVEL = "OFF"; String LOG_LEVEL = "OFF";
...@@ -114,9 +115,9 @@ public class EyesisCorrections { ...@@ -114,9 +115,9 @@ public class EyesisCorrections {
loci.common.DebugTools.setRootLevel(LOG_LEVEL); loci.common.DebugTools.setRootLevel(LOG_LEVEL);
// } // }
System.out.println("EyesisCorrections.setDebug("+debugLevel+"), LOG_LEVEL_SET="+LOG_LEVEL_SET+" LOG_LEVEL="+LOG_LEVEL); System.out.println("EyesisCorrections.setDebug("+debugLevel+"), LOG_LEVEL_SET="+LOG_LEVEL_SET+" LOG_LEVEL="+LOG_LEVEL);
*/
} }
*/
/*
public void setDebugOnce(int debugLevel){ public void setDebugOnce(int debugLevel){
this.debugLevel=debugLevel; this.debugLevel=debugLevel;
String LOG_LEVEL = "OFF"; String LOG_LEVEL = "OFF";
...@@ -135,7 +136,19 @@ public class EyesisCorrections { ...@@ -135,7 +136,19 @@ public class EyesisCorrections {
System.out.println("EyesisCorrections.setDebug("+debugLevel+"), LOG_LEVEL_SET="+LOG_LEVEL_SET+" LOG_LEVEL="+LOG_LEVEL); System.out.println("EyesisCorrections.setDebug("+debugLevel+"), LOG_LEVEL_SET="+LOG_LEVEL_SET+" LOG_LEVEL="+LOG_LEVEL);
return; return;
} }
*/
public static String stringLogLevel(int ilev) {
String LOG_LEVEL = "OFF";
switch (ilev) {
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";
}
return LOG_LEVEL;
}
public int getNumChannels(){return (this.usedChannels!=null)?this.usedChannels.length:0;} public int getNumChannels(){return (this.usedChannels!=null)?this.usedChannels.length:0;}
......
...@@ -185,7 +185,7 @@ public class Lwir16Reader { ...@@ -185,7 +185,7 @@ public class Lwir16Reader {
} catch (FormatException e) { } catch (FormatException e) {
LOGGER.error("readAllMultiple0:FormatException, priming"); LOGGER.error("readAllMultiple0:FormatException, priming");
} }
LOGGER.info("priming..."+(i+1)); LOGGER.debug("priming..."+(i+1));
try { try {
Thread.sleep(1000); Thread.sleep(1000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
...@@ -195,7 +195,7 @@ public class Lwir16Reader { ...@@ -195,7 +195,7 @@ public class Lwir16Reader {
} }
} }
for (int n = 0; n < num_frames; n++) { for (int n = 0; n < num_frames; n++) {
LOGGER.info("---- Acquiring frame set "+n); LOGGER.debug("---- Acquiring frame set "+n);
try { try {
// imagejJp4TiffMulti.getMultiImages( (n==0)? urls0:urls1, imps[n], telemetry, scale, std); // imagejJp4TiffMulti.getMultiImages( (n==0)? urls0:urls1, imps[n], telemetry, scale, std);
imagejJp4TiffMulti.getMultiImages( (n==0)? urls0:urls1, imps[n], scale, std); imagejJp4TiffMulti.getMultiImages( (n==0)? urls0:urls1, imps[n], scale, std);
...@@ -567,7 +567,7 @@ public class Lwir16Reader { ...@@ -567,7 +567,7 @@ public class Lwir16Reader {
FileSaver fs=new FileSaver(imp); FileSaver fs=new FileSaver(imp);
String path=set_path+Prefs.getFileSeparator()+fname; String path=set_path+Prefs.getFileSeparator()+fname;
IJ.showStatus("Saving "+path); IJ.showStatus("Saving "+path);
LOGGER.info("LWIR_ACQUIRE: 'Saving "+path ); LOGGER.debug("LWIR_ACQUIRE: 'Saving "+path );
fs.saveAsTiff(path); fs.saveAsTiff(path);
} }
} }
...@@ -1106,7 +1106,7 @@ public class Lwir16Reader { ...@@ -1106,7 +1106,7 @@ public class Lwir16Reader {
FileSaver fs=new FileSaver(imp); FileSaver fs=new FileSaver(imp);
String path=set_path+Prefs.getFileSeparator()+fname; String path=set_path+Prefs.getFileSeparator()+fname;
IJ.showStatus("Saving "+path); IJ.showStatus("Saving "+path);
LOGGER.info("LWIR_ACQUIRE: 'Saving "+path ); LOGGER.debug("LWIR_ACQUIRE: 'Saving "+path );
fs.saveAsTiff(path); fs.saveAsTiff(path);
} }
} }
...@@ -1144,7 +1144,7 @@ public class Lwir16Reader { ...@@ -1144,7 +1144,7 @@ public class Lwir16Reader {
if (imagejJp4TiffMulti == null) { if (imagejJp4TiffMulti == null) {
imagejJp4TiffMulti = new ImagejJp4TiffMulti(); imagejJp4TiffMulti = new ImagejJp4TiffMulti();
} }
LOGGER.info("---- Acquiring frame set "+dbgtxt); LOGGER.debug("---- Acquiring frame set "+dbgtxt);
try { try {
imagejJp4TiffMulti.getMultiImages(urls, imps, scale, std); imagejJp4TiffMulti.getMultiImages(urls, imps, scale, std);
} catch (IOException e) { } catch (IOException e) {
......
...@@ -158,7 +158,7 @@ public class LwirReader { ...@@ -158,7 +158,7 @@ public class LwirReader {
} catch (FormatException e) { } catch (FormatException e) {
LOGGER.error("readAllMultiple0:FormatException, priming"); LOGGER.error("readAllMultiple0:FormatException, priming");
} }
LOGGER.info("priming..."+(i+1)); LOGGER.debug("priming..."+(i+1));
try { try {
Thread.sleep(1000); Thread.sleep(1000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
...@@ -168,7 +168,7 @@ public class LwirReader { ...@@ -168,7 +168,7 @@ public class LwirReader {
} }
} }
for (int n = 0; n < num_frames; n++) { for (int n = 0; n < num_frames; n++) {
LOGGER.info("---- Acquiring frame set "+n); LOGGER.debug("---- Acquiring frame set "+n);
try { try {
// imagejJp4TiffMulti.getMultiImages( (n==0)? urls0:urls1, imps[n], telemetry, scale, std); // imagejJp4TiffMulti.getMultiImages( (n==0)? urls0:urls1, imps[n], telemetry, scale, std);
imagejJp4TiffMulti.getMultiImages( (n==0)? urls0:urls1, imps[n], scale, std); imagejJp4TiffMulti.getMultiImages( (n==0)? urls0:urls1, imps[n], scale, std);
...@@ -572,7 +572,7 @@ public class LwirReader { ...@@ -572,7 +572,7 @@ public class LwirReader {
FileSaver fs=new FileSaver(imp); FileSaver fs=new FileSaver(imp);
String path=set_path+Prefs.getFileSeparator()+fname; String path=set_path+Prefs.getFileSeparator()+fname;
IJ.showStatus("Saving "+path); IJ.showStatus("Saving "+path);
LOGGER.info("LWIR_ACQUIRE: 'Saving "+path ); LOGGER.debug("LWIR_ACQUIRE: 'Saving "+path );
fs.saveAsTiff(path); fs.saveAsTiff(path);
} }
} }
......
...@@ -109,24 +109,12 @@ public class ImagejJp4Tiff { ...@@ -109,24 +109,12 @@ public class ImagejJp4Tiff {
private static final String FIXCH5_LATEST = "2025-11-01 00:00:00.000"; // finally fixed private static final String FIXCH5_LATEST = "2025-11-01 00:00:00.000"; // finally fixed
private static final int FIXCH5_CHANNEL = 1; 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 -- // -- Fields --
private ImageReader reader = null; private ImageReader reader = null;
private String content_fileName = "undefined"; // from Content-disposition private String content_fileName = "undefined"; // from Content-disposition
private URL url = null; // save here actual URL when reading file to memory private URL url = null; // save here actual URL when reading file to memory
IMetadata omeMeta = null; IMetadata omeMeta = null;
// codex 2026-01-25: reuse ServiceFactory/OMEXMLService to avoid repeated service init
private static ServiceFactory SERVICE_FACTORY = null; private static ServiceFactory SERVICE_FACTORY = null;
private static OMEXMLService OME_XML_SERVICE = null; private static OMEXMLService OME_XML_SERVICE = null;
...@@ -144,7 +132,9 @@ public class ImagejJp4Tiff { ...@@ -144,7 +132,9 @@ public class ImagejJp4Tiff {
// URL u = this.getClass().getResource("/"+SERVICES_PATH); // URL u = this.getClass().getResource("/"+SERVICES_PATH);
if (!BYPASS_SERVICES) { if (!BYPASS_SERVICES) {
OMEXMLService service = getOmexmlService(); OMEXMLService service = useOmexmlSingleton()
? getOmexmlService()
: createOmexmlService();
if (service != null) { if (service != null) {
try { try {
omeMeta = service.createOMEXMLMetadata(); omeMeta = service.createOMEXMLMetadata();
...@@ -181,6 +171,30 @@ public class ImagejJp4Tiff { ...@@ -181,6 +171,30 @@ public class ImagejJp4Tiff {
return OME_XML_SERVICE; return OME_XML_SERVICE;
} }
private static OMEXMLService createOmexmlService() {
ServiceFactory factory = null;
try {
factory = new ServiceFactory();
} catch (DependencyException e) {
e.printStackTrace();
return null;
}
try {
return factory.getInstance(OMEXMLService.class);
} catch (DependencyException e) {
e.printStackTrace();
return null;
}
}
private static boolean useOmexmlSingleton() {
String value = System.getProperty("elphel.ome.singleton");
if (value == null || value.isEmpty()) {
return false;
}
return Boolean.parseBoolean(value);
}
// -- API methods -- // -- API methods --
public ImagePlus readTiffJp4(String path) throws IOException, FormatException { public ImagePlus readTiffJp4(String path) throws IOException, FormatException {
...@@ -216,7 +230,7 @@ public class ImagejJp4Tiff { ...@@ -216,7 +230,7 @@ public class ImagejJp4Tiff {
} }
//https://stackoverflow.com/questions/39086500/read-http-response-header-and-body-from-one-http-request-in-java //https://stackoverflow.com/questions/39086500/read-http-response-header-and-body-from-one-http-request-in-java
if (url != null) { if (url != null) {
LOGGER.debug("Read "+ path_url +" to memory first"); LOGGER.info("Read "+ path_url +" to memory first");
URLConnection connection = url.openConnection(); URLConnection connection = url.openConnection();
// Wrong - waits forever // Wrong - waits forever
String content_disposition = connection.getHeaderField("Content-Disposition"); // reads file String content_disposition = connection.getHeaderField("Content-Disposition"); // reads file
...@@ -241,7 +255,7 @@ public class ImagejJp4Tiff { ...@@ -241,7 +255,7 @@ public class ImagejJp4Tiff {
// super.setId(content_fileName); // super.setId(content_fileName);
} else { // read file normally } else { // read file normally
content_fileName = path_url; content_fileName = path_url;
LOGGER.debug("read '"+path_url+"' file directly"); LOGGER.info("read '"+path_url+"' file directly");
} }
reader.setId(content_fileName); reader.setId(content_fileName);
byte [] bytes = null; byte [] bytes = null;
......
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