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

Resolving slf4j issues

parent aaf90b6f
......@@ -91,8 +91,9 @@ public class EyesisCorrections {
){
this.correctionsParameters=correctionsParameters;
this.stopRequested=stopRequested;
setDebug(-2);
// setDebug(-2);
}
/*
public void setDebug(int debugLevel){
this.debugLevel=debugLevel;
String LOG_LEVEL = "OFF";
......@@ -114,9 +115,9 @@ public class EyesisCorrections {
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";
......@@ -135,7 +136,19 @@ public class EyesisCorrections {
System.out.println("EyesisCorrections.setDebug("+debugLevel+"), LOG_LEVEL_SET="+LOG_LEVEL_SET+" LOG_LEVEL="+LOG_LEVEL);
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;}
......
......@@ -185,7 +185,7 @@ public class Lwir16Reader {
} catch (FormatException e) {
LOGGER.error("readAllMultiple0:FormatException, priming");
}
LOGGER.info("priming..."+(i+1));
LOGGER.debug("priming..."+(i+1));
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
......@@ -195,7 +195,7 @@ public class Lwir16Reader {
}
}
for (int n = 0; n < num_frames; n++) {
LOGGER.info("---- Acquiring frame set "+n);
LOGGER.debug("---- Acquiring frame set "+n);
try {
// imagejJp4TiffMulti.getMultiImages( (n==0)? urls0:urls1, imps[n], telemetry, scale, std);
imagejJp4TiffMulti.getMultiImages( (n==0)? urls0:urls1, imps[n], scale, std);
......@@ -567,7 +567,7 @@ public class Lwir16Reader {
FileSaver fs=new FileSaver(imp);
String path=set_path+Prefs.getFileSeparator()+fname;
IJ.showStatus("Saving "+path);
LOGGER.info("LWIR_ACQUIRE: 'Saving "+path );
LOGGER.debug("LWIR_ACQUIRE: 'Saving "+path );
fs.saveAsTiff(path);
}
}
......@@ -1106,7 +1106,7 @@ public class Lwir16Reader {
FileSaver fs=new FileSaver(imp);
String path=set_path+Prefs.getFileSeparator()+fname;
IJ.showStatus("Saving "+path);
LOGGER.info("LWIR_ACQUIRE: 'Saving "+path );
LOGGER.debug("LWIR_ACQUIRE: 'Saving "+path );
fs.saveAsTiff(path);
}
}
......@@ -1144,7 +1144,7 @@ public class Lwir16Reader {
if (imagejJp4TiffMulti == null) {
imagejJp4TiffMulti = new ImagejJp4TiffMulti();
}
LOGGER.info("---- Acquiring frame set "+dbgtxt);
LOGGER.debug("---- Acquiring frame set "+dbgtxt);
try {
imagejJp4TiffMulti.getMultiImages(urls, imps, scale, std);
} catch (IOException e) {
......
......@@ -158,7 +158,7 @@ public class LwirReader {
} catch (FormatException e) {
LOGGER.error("readAllMultiple0:FormatException, priming");
}
LOGGER.info("priming..."+(i+1));
LOGGER.debug("priming..."+(i+1));
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
......@@ -168,7 +168,7 @@ public class LwirReader {
}
}
for (int n = 0; n < num_frames; n++) {
LOGGER.info("---- Acquiring frame set "+n);
LOGGER.debug("---- Acquiring frame set "+n);
try {
// imagejJp4TiffMulti.getMultiImages( (n==0)? urls0:urls1, imps[n], telemetry, scale, std);
imagejJp4TiffMulti.getMultiImages( (n==0)? urls0:urls1, imps[n], scale, std);
......@@ -572,7 +572,7 @@ public class LwirReader {
FileSaver fs=new FileSaver(imp);
String path=set_path+Prefs.getFileSeparator()+fname;
IJ.showStatus("Saving "+path);
LOGGER.info("LWIR_ACQUIRE: 'Saving "+path );
LOGGER.debug("LWIR_ACQUIRE: 'Saving "+path );
fs.saveAsTiff(path);
}
}
......
......@@ -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 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;
......@@ -144,7 +132,9 @@ public class ImagejJp4Tiff {
// URL u = this.getClass().getResource("/"+SERVICES_PATH);
if (!BYPASS_SERVICES) {
OMEXMLService service = getOmexmlService();
OMEXMLService service = useOmexmlSingleton()
? getOmexmlService()
: createOmexmlService();
if (service != null) {
try {
omeMeta = service.createOMEXMLMetadata();
......@@ -181,6 +171,30 @@ public class ImagejJp4Tiff {
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 --
public ImagePlus readTiffJp4(String path) throws IOException, FormatException {
......@@ -216,7 +230,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.debug("Read "+ path_url +" to memory first");
LOGGER.info("Read "+ path_url +" to memory first");
URLConnection connection = url.openConnection();
// Wrong - waits forever
String content_disposition = connection.getHeaderField("Content-Disposition"); // reads file
......@@ -241,7 +255,7 @@ public class ImagejJp4Tiff {
// super.setId(content_fileName);
} else { // read file normally
content_fileName = path_url;
LOGGER.debug("read '"+path_url+"' file directly");
LOGGER.info("read '"+path_url+"' file directly");
}
reader.setId(content_fileName);
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