Commit a0b7dae3 authored by Andrey Filippov's avatar Andrey Filippov
Browse files

Switched to bioformats 6.1.0 jar (minimal needed), set logging

parent a17be71e
Loading
Loading
Loading
Loading
+28 −26
Original line number Diff line number Diff line
@@ -12,9 +12,11 @@
		<relativePath/>
        </parent>

<!-- 
	<properties>
		<imagej.app.directory>/home/foxel/Desktop/Fiji.app</imagej.app.directory>
	</properties>
 -->	

	<groupId>com.elphel</groupId>
 	<artifactId>imagej-elphel</artifactId>
@@ -88,8 +90,7 @@
			<dependency>
				<groupId>ome</groupId>
				<artifactId>loci_tools</artifactId>
			<version>6.1.0-SNAPSHOT</version>
			<type>java-source</type>
				<version>6.1.0</version>
			</dependency>
			<dependency>
			  <groupId>com.drewnoakes</groupId>
@@ -97,6 +98,7 @@
			  <version>2.11.0</version>
			  <type>java-source</type>
			</dependency>
			
		</dependencies>

	<build>
@@ -207,7 +209,7 @@
                                    <format>Build {0,date,yyyy-MM-dd} {0,time,HH:MM:SS} on host {1}</format>
                                    <items>
                                        <item>timestamp</item>
                                        <item>foxel-MRHM7AP</item>
<!--                                         <item>foxel-MRHM7AP</item>  -->
                                    </items>
				</configuration>
                        </plugin>
+16 −4
Original line number Diff line number Diff line
@@ -897,8 +897,22 @@ private Panel panel1,
	if (DEBUG_LEVEL>0) System.out.println("--- Free memory="+runtime.freeMemory()+" (of "+runtime.totalMemory()+")");
	CLT_PARAMETERS.batch_run = false;
    if (label==null) return;
    System.out.println("DEBUG_LEVEL = "+DEBUG_LEVEL+", MASTER_DEBUG_LEVEL = "+MASTER_DEBUG_LEVEL);
	loci.common.DebugTools.enableLogging((MASTER_DEBUG_LEVEL > 1)?"DEBUG":((MASTER_DEBUG_LEVEL > 0)?"INFO":"ERROR")); // INFO"); // ERROR");
    String LOG_LEVEL;
    switch (MASTER_DEBUG_LEVEL) {
    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("DEBUG_LEVEL = "+DEBUG_LEVEL+", MASTER_DEBUG_LEVEL = "+MASTER_DEBUG_LEVEL+
    		" LOG_LEVEL="+LOG_LEVEL+"LOG_LEVEL_SET="+LOG_LEVEL_SET);

/* ======================================================================== */
    if (label.equals("Configure spilt")) {
@@ -4831,7 +4845,6 @@ private Panel panel1,
/* ======================================================================== */
    } else if (label.equals("LWIR_TEST")) {
        DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
//		loci.common.DebugTools.enableLogging((DEBUG_LEVEL > 1)?"DEBUG":((DEBUG_LEVEL > 0)?"INFO":"ERROR")); // INFO"); // ERROR");
		//   public static LwirReader       LWIR_READER = null;
		if (LWIR_READER == null) {
			LWIR_READER =  new LwirReader(CLT_PARAMETERS.lwir);
@@ -4856,7 +4869,6 @@ private Panel panel1,
/* ======================================================================== */
    } else if (label.equals("LWIR_ACQUIRE")) {
        DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
//		loci.common.DebugTools.enableLogging((DEBUG_LEVEL > 1)?"DEBUG":((DEBUG_LEVEL > 0)?"INFO":"ERROR")); // INFO"); // ERROR");
		//   public static LwirReader       LWIR_READER = null;
		if (LWIR_READER == null) {
			LWIR_READER =  new LwirReader(CLT_PARAMETERS.lwir);
+1 −1
Original line number Diff line number Diff line
@@ -318,6 +318,7 @@ public class LwirReader {
	}

	public boolean calibrate(LwirReaderParameters lrp) {
		// FFC takes 15 frames that are not output (so no need to check operation is over)
		if (lrp.lwir_channels.length == 0) {
			LOGGER.error("calibrate(): No LWIR channels are configured");
			return false;
@@ -328,7 +329,6 @@ public class LwirReader {
			channels |= 1 << c;
		}
		String hex_chan = String.format("%x", channels);
		System.out.println("Channels = "+channels+" (0x"+hex_chan);

		String url = "http://"+lrp.lwir_ip+"/parsedit.php?immediate&sensor_port="+chn+
				"&SENSOR_REGS67=0!"+hex_chan;
+8 −1
Original line number Diff line number Diff line
@@ -33,12 +33,12 @@ import com.elphel.imagej.common.GenericJTabbedDialog;
public class LwirReaderParameters {
	private boolean parameters_updated = false;
	protected int     avg_number =            4; // number of measurements to average
	protected boolean lwir_ffc =              true;
	protected boolean avg_all =               true;
	protected String  lwir_ip =               "192.168.0.36";
	protected String  vnir_ip =               "192.168.0.38";
	protected int []  lwir_channels =         {0, 1, 2 ,3};
	protected int []  vnir_channels =         {0, 1, 2 ,3};
	protected boolean lwir_ffc =              true;
	protected boolean lwir_telemetry =        true;
	protected double  vnir_quality =          98.0;
	protected boolean vnir_scale =           false; // restore sensor pixel values, undo camera white balancing
@@ -74,6 +74,7 @@ public class LwirReaderParameters {
	// --- interface methods
	public void setProperties(String prefix,Properties properties){
		properties.setProperty(prefix+"avg_number",          this.avg_number+"");
		properties.setProperty(prefix+"lwir_ffc",            this.lwir_ffc+"");
		properties.setProperty(prefix+"avg_all",             this.avg_all+"");
		properties.setProperty(prefix+"lwir_ip",             this.lwir_ip+"");
		properties.setProperty(prefix+"vnir_ip",             this.vnir_ip+"");
@@ -99,6 +100,7 @@ public class LwirReaderParameters {

	public void getProperties(String prefix,Properties properties){
		if (properties.getProperty(prefix+"avg_number")!=null)          this.avg_number=Integer.parseInt(properties.getProperty(prefix+"avg_number"));
		if (properties.getProperty(prefix+"lwir_ffc")!=null)            this.lwir_ffc= Boolean.parseBoolean(properties.getProperty(prefix+"lwir_ffc"));
		if (properties.getProperty(prefix+"avg_all")!=null)             this.avg_all= Boolean.parseBoolean(properties.getProperty(prefix+"avg_all"));
		if (properties.getProperty(prefix+"lwir_ip")!=null)             this.lwir_ip=      properties.getProperty(prefix+"lwir_ip");
		if (properties.getProperty(prefix+"vnir_ip")!=null)             this.vnir_ip=      properties.getProperty(prefix+"vnir_ip");
@@ -126,6 +128,7 @@ public class LwirReaderParameters {
	public LwirReaderParameters clone() { //  throws CloneNotSupportedException {
		LwirReaderParameters lrp =       new LwirReaderParameters();
		lrp.avg_number=                this.avg_number;
		lrp.lwir_ffc=                  this.lwir_ffc;
		lrp.avg_all=                   this.avg_all;
		lrp.lwir_ip=                   this.lwir_ip;
		lrp.vnir_ip=                   this.vnir_ip;
@@ -160,6 +163,7 @@ public class LwirReaderParameters {
		}
		LwirReaderParameters lrp = (LwirReaderParameters) o;
		return  (lrp.avg_number == this.avg_number) &&
				(lrp.lwir_ffc == this.lwir_ffc) &&
				(lrp.avg_all == this.avg_all) &&
				(lrp.lwir_ip.equals(this.lwir_ip)) &&
				(lrp.vnir_ip.equals(this.vnir_ip)) &&
@@ -188,6 +192,7 @@ public class LwirReaderParameters {
		int prime = 31;
		int result = 1;
		result = prime * result + (new Integer(avg_number)).hashCode();
		result = prime * result + (lwir_ffc?1:0);
		result = prime * result + (avg_all?1:0);
		result = prime * result + lwir_ip.hashCode();
		result = prime * result + vnir_ip.hashCode();
@@ -215,6 +220,7 @@ public class LwirReaderParameters {

	public void dialogQuestions(GenericJTabbedDialog gd) {
		gd.addNumericField("Number to average",this.avg_number,     0,3,"","Number of acquired consecutive images to average");
		gd.addCheckbox    ("Run FFC",       this.lwir_ffc, "Perform calibration before each measurements to average (takes ~1.6 sec, 15 frames)");
		gd.addCheckbox    ("Average all",   this.avg_all, "Average all simultaneously acquired images (unchecked - only requested number to average)");
		gd.addStringField ("LWIR IP",       this.lwir_ip, 20, "LWIR camera IP address");
		gd.addStringField ("VNIR IP",       this.vnir_ip, 20, "Visible range high resolution camera IP address");
@@ -240,6 +246,7 @@ public class LwirReaderParameters {

	public void dialogAnswers(GenericJTabbedDialog gd) {
		this.avg_number =             (int) gd.getNextNumber();
		this.lwir_ffc =                      gd.getNextBoolean();
		this.avg_all =                      gd.getNextBoolean();
		this.lwir_ip =                      gd.getNextString();
		this.vnir_ip =                      gd.getNextString();
+1 −3
Original line number Diff line number Diff line
@@ -91,8 +91,6 @@ public class ImagejJp4Tiff {
		//URL u = this.getClass().getResource(SERVICES_PATH);
//		URL u = this.getClass().getResource("/"+SERVICES_PATH);

//		loci.common.DebugTools.enableLogging("ERROR");

		if (!BYPASS_SERVICES) {
			ServiceFactory factory = null;

@@ -153,7 +151,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.error("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