Loading ijplugins/JP46_Reader_camera.class 0 → 100644 +44.5 KiB File added.No diff preview for this file type. View file src/main/java/com/elphel/imagej/correction/Eyesis_Correction.java +1 −0 Original line number Diff line number Diff line Loading @@ -4838,6 +4838,7 @@ private Panel panel1, } ImagePlus [][] imps = LWIR_READER.readAllMultiple( 10, // final int num_frames, // true, // use LWIR telemetry true, // final boolean show, false); // true); // final boolean scale) for (ImagePlus imp: imps[0]) { Loading src/main/java/com/elphel/imagej/lwir/LwirReader.java +11 −1 Original line number Diff line number Diff line Loading @@ -65,6 +65,9 @@ public class LwirReader { public static final String SKIP_FRAME_URL= "/towp/wait/meta"; // Wit for the next frame, return meta data public static final int COLOR_JP4 = 5; public static final int COLOR_RAW = 15; public static final int LWIR_HEIGHT = 120; public static final int LWIR_TELEMETRY_LINES = 2; public static final int FRAMES_SKIP = 3; public static final int MAX_THREADS = 100; // combine from all classes? Loading Loading @@ -103,13 +106,16 @@ public class LwirReader { public ImagePlus[][] readAllMultiple( final int num_frames, // final boolean telemetry, final boolean show, final boolean scale) { return readAllMultiple(num_frames, show, scale, "STD_"); // return readAllMultiple(num_frames, telemetry, show, scale, "STD_"); } public ImagePlus[][] readAllMultiple( final int num_frames, // final boolean telemetry, final boolean show, final boolean scale, final String std) Loading @@ -125,6 +131,7 @@ public class LwirReader { imagejJp4TiffMulti = new ImagejJp4TiffMulti(); for (int i = 0; i < 2; i++) { try { // imagejJp4TiffMulti.getMultiImages(urls0, imps[0], telemetry, scale, std); imagejJp4TiffMulti.getMultiImages(urls0, imps[0], scale, std); } catch (IOException e) { LOGGER.error("readAllMultiple0: IOException, priming" ); Loading @@ -143,6 +150,7 @@ public class LwirReader { for (int n = 0; n < num_frames; n++) { LOGGER.info("---- 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); } catch (IOException e) { LOGGER.error("readAllMultiple0: IOException, n = " + n); Loading Loading @@ -365,6 +373,7 @@ public class LwirReader { int num_frames = lrp.avg_number + lrp.vnir_lag + 2 * lrp.max_frame_diff; ImagePlus [][] imps = readAllMultiple( num_frames, // lrp.lwir_telemetry, false, // final boolean show, lrp.vnir_scale); if (imps == null) { Loading Loading @@ -433,7 +442,8 @@ public class LwirReader { for (int chn:lrp.lwir_channels) { urls[chn] = "http://"+lrp.lwir_ip+"/parsedit.php?immediate&sensor_port="+chn+ "&BITS=16"+ "&COLOR="+COLOR_RAW; // +"*0"; // raw mode - delay 0 - breaks compressor "&COLOR="+COLOR_RAW+ // +"*0"; // raw mode - delay 0 - breaks compressor "&WOI_HEIGHT="+(LWIR_HEIGHT + (lrp.lwir_telemetry?LWIR_TELEMETRY_LINES:0)); if (chn == lwir_master_port) { urls[chn] +="&TRIG=0*0"+ "&TRIG_DELAY="+lrp.lwir_trig_dly+"*0"+ Loading src/main/java/com/elphel/imagej/lwir/LwirReaderParameters.java +24 −16 Original line number Diff line number Diff line Loading @@ -33,11 +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 public boolean avg_all = 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_telemetry = true; protected double vnir_quality = 98.0; protected boolean vnir_scale = false; // restore sensor pixel values, undo camera white balancing protected boolean vnir_autoexp = false; Loading Loading @@ -77,6 +78,7 @@ public class LwirReaderParameters { properties.setProperty(prefix+"vnir_ip", this.vnir_ip+""); properties.setProperty(prefix+"lwir_channels", arr_to_str(this.lwir_channels)); properties.setProperty(prefix+"vnir_channels", arr_to_str(this.vnir_channels)); properties.setProperty(prefix+"lwir_telemetry", this.lwir_telemetry+""); properties.setProperty(prefix+"vnir_quality", this.vnir_quality+""); properties.setProperty(prefix+"vnir_scale", this.vnir_scale+""); properties.setProperty(prefix+"vnir_autoexp", this.vnir_autoexp+""); Loading @@ -101,6 +103,7 @@ public class LwirReaderParameters { if (properties.getProperty(prefix+"vnir_ip")!=null) this.vnir_ip= properties.getProperty(prefix+"vnir_ip"); if (properties.getProperty(prefix+"lwir_channels")!=null) this.lwir_channels=str_to_iarr(properties.getProperty(prefix+"lwir_channels")); if (properties.getProperty(prefix+"vnir_channels")!=null) this.vnir_channels=str_to_iarr(properties.getProperty(prefix+"vnir_channels")); if (properties.getProperty(prefix+"lwir_telemetry")!=null) this.lwir_telemetry= Boolean.parseBoolean(properties.getProperty(prefix+"lwir_telemetry")); if (properties.getProperty(prefix+"vnir_quality")!=null) this.vnir_quality=Double.parseDouble(properties.getProperty(prefix+"vnir_quality")); if (properties.getProperty(prefix+"vnir_scale")!=null) this.vnir_scale= Boolean.parseBoolean(properties.getProperty(prefix+"vnir_scale")); if (properties.getProperty(prefix+"vnir_autoexp")!=null) this.vnir_autoexp= Boolean.parseBoolean(properties.getProperty(prefix+"vnir_autoexp")); Loading @@ -127,6 +130,7 @@ public class LwirReaderParameters { lrp.vnir_ip= this.vnir_ip; lrp.lwir_channels= this.lwir_channels.clone(); lrp.vnir_channels= this.vnir_channels.clone(); lrp.lwir_telemetry= this.lwir_telemetry; lrp.vnir_quality= this.vnir_quality; lrp.vnir_scale= this.vnir_scale; lrp.vnir_autoexp= this.vnir_autoexp; Loading Loading @@ -160,6 +164,7 @@ public class LwirReaderParameters { (lrp.vnir_ip.equals(this.vnir_ip)) && (java.util.Arrays.equals(lrp.lwir_channels, this.lwir_channels)) && (java.util.Arrays.equals(lrp.vnir_channels, this.vnir_channels)) && (lrp.lwir_telemetry == this.lwir_telemetry) && (lrp.vnir_quality == this.vnir_quality) && (lrp.vnir_scale == this.vnir_scale) && (lrp.vnir_autoexp == this.vnir_autoexp) && Loading Loading @@ -187,6 +192,7 @@ public class LwirReaderParameters { result = prime * result + vnir_ip.hashCode(); result = prime * result + arr_to_str(lwir_channels).hashCode(); result = prime * result + arr_to_str(vnir_channels).hashCode(); result = prime * result + (lwir_telemetry?1:0); result = prime * result + (new Double(vnir_quality)).hashCode(); result = prime * result + (vnir_scale?1:0); result = prime * result + (vnir_autoexp?1:0); Loading @@ -213,6 +219,7 @@ public class LwirReaderParameters { gd.addStringField ("VNIR IP", this.vnir_ip, 20, "Visible range high resolution camera IP address"); gd.addStringField ("LWIR channels", arr_to_str(this.lwir_channels), 20, "Space-separated list of used LWIR camera channels, such as '0 1 2 3'"); gd.addStringField ("VNIR channels", arr_to_str(this.vnir_channels), 20, "Space-separated list of used visible range camera channels, such as '0 1 2 3'"); gd.addCheckbox ("LWIR telemetry", this.lwir_telemetry, "Set LWIR sesnors to provide telemetry data in the last 2 lines (may become mandatory later)"); gd.addNumericField("VNIR quality", this.vnir_quality, 3,6,"ms", "Visible range camera JPEG compression quality (all channels)"); gd.addCheckbox ("VNIR undo white balance", this.vnir_scale, "Undo in-camera white balancing"); gd.addCheckbox ("VNIR autoexposure", this.vnir_autoexp, "Enable autoexposure for the visible range camera"); Loading @@ -237,6 +244,7 @@ public class LwirReaderParameters { this.vnir_ip = gd.getNextString(); this.lwir_channels = str_to_iarr(gd.getNextString()); this.vnir_channels = str_to_iarr(gd.getNextString()); this.lwir_telemetry = gd.getNextBoolean(); this.vnir_quality = gd.getNextNumber(); this.vnir_scale = gd.getNextBoolean(); this.vnir_autoexp = gd.getNextBoolean(); Loading src/main/java/com/elphel/imagej/readers/ImagejJp4Tiff.java +25 −4 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import java.net.URL; import java.net.URLConnection; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; import java.util.Properties; Loading Loading @@ -65,8 +66,10 @@ public class ImagejJp4Tiff { 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"; private static final boolean KEEP_EXTENSION = false; // remove extension for ImagePlus title private static final boolean BOTTOM_TELEMETRY = true; // telemetry (if present) is at the bottom of the image // -- Fields -- Loading Loading @@ -186,12 +189,13 @@ public class ImagejJp4Tiff { boolean is_le = reader.isLittleEndian(); int bytes_per_pixel = (bpp + 7) / 9; float [] pixels = new float [bytes.length/bytes_per_pixel]; ByteBuffer bb = null; if (bytes_per_pixel == 1) { for (int i = 0; i < pixels.length; i++) { pixels[i] = ((bytes[i])) & 0xff; } } else { ByteBuffer bb = ByteBuffer.wrap(bytes); bb = ByteBuffer.wrap(bytes); if (is_le) { bb.order( ByteOrder.LITTLE_ENDIAN); } else { Loading @@ -208,9 +212,20 @@ public class ImagejJp4Tiff { LOGGER.error("Problem degamma/scaling of "+content_fileName); } ImageProcessor ip=new FloatProcessor(reader.getSizeX(), reader.getSizeY()); boolean telemetry = (bytes_per_pixel == 2); Lepton3Telemetry lepton3Telemetry = null; if (telemetry) { lepton3Telemetry = new Lepton3Telemetry(bb,pixels, true); // bottom telemetry = lepton3Telemetry.hasTelemetry(); } ImageProcessor ip = null; if (telemetry) { ip=new FloatProcessor(Lepton3Telemetry.LEPTON3_IMAGE_WIDTH, Lepton3Telemetry.LEPTON3_IMAGE_HEIGHT); ip.setPixels(lepton3Telemetry.getPixels()); // bo } else { ip=new FloatProcessor(reader.getSizeX(), reader.getSizeY()); ip.setPixels(pixels); } ip.resetMinAndMax(); String prefix = ElphelTiffReader.ELPHEL_PROPERTY_PREFIX; String imageName = content_fileName; // path; Loading @@ -234,6 +249,12 @@ public class ImagejJp4Tiff { imp.setProperty(std+(key.replace(" ","_").replace("/","_")), meta_hash.get(key).toString()); } } if (telemetry) { HashMap<String, String> telemetryMap = lepton3Telemetry.parseTelemetry(); for (String key:telemetryMap.keySet()) { imp.setProperty(TELEMETRY_PREFIX+key, telemetryMap.get(key)); } } encodeProperiesToInfo(imp); Location.mapFile(content_fileName, null); return imp; Loading Loading
ijplugins/JP46_Reader_camera.class 0 → 100644 +44.5 KiB File added.No diff preview for this file type. View file
src/main/java/com/elphel/imagej/correction/Eyesis_Correction.java +1 −0 Original line number Diff line number Diff line Loading @@ -4838,6 +4838,7 @@ private Panel panel1, } ImagePlus [][] imps = LWIR_READER.readAllMultiple( 10, // final int num_frames, // true, // use LWIR telemetry true, // final boolean show, false); // true); // final boolean scale) for (ImagePlus imp: imps[0]) { Loading
src/main/java/com/elphel/imagej/lwir/LwirReader.java +11 −1 Original line number Diff line number Diff line Loading @@ -65,6 +65,9 @@ public class LwirReader { public static final String SKIP_FRAME_URL= "/towp/wait/meta"; // Wit for the next frame, return meta data public static final int COLOR_JP4 = 5; public static final int COLOR_RAW = 15; public static final int LWIR_HEIGHT = 120; public static final int LWIR_TELEMETRY_LINES = 2; public static final int FRAMES_SKIP = 3; public static final int MAX_THREADS = 100; // combine from all classes? Loading Loading @@ -103,13 +106,16 @@ public class LwirReader { public ImagePlus[][] readAllMultiple( final int num_frames, // final boolean telemetry, final boolean show, final boolean scale) { return readAllMultiple(num_frames, show, scale, "STD_"); // return readAllMultiple(num_frames, telemetry, show, scale, "STD_"); } public ImagePlus[][] readAllMultiple( final int num_frames, // final boolean telemetry, final boolean show, final boolean scale, final String std) Loading @@ -125,6 +131,7 @@ public class LwirReader { imagejJp4TiffMulti = new ImagejJp4TiffMulti(); for (int i = 0; i < 2; i++) { try { // imagejJp4TiffMulti.getMultiImages(urls0, imps[0], telemetry, scale, std); imagejJp4TiffMulti.getMultiImages(urls0, imps[0], scale, std); } catch (IOException e) { LOGGER.error("readAllMultiple0: IOException, priming" ); Loading @@ -143,6 +150,7 @@ public class LwirReader { for (int n = 0; n < num_frames; n++) { LOGGER.info("---- 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); } catch (IOException e) { LOGGER.error("readAllMultiple0: IOException, n = " + n); Loading Loading @@ -365,6 +373,7 @@ public class LwirReader { int num_frames = lrp.avg_number + lrp.vnir_lag + 2 * lrp.max_frame_diff; ImagePlus [][] imps = readAllMultiple( num_frames, // lrp.lwir_telemetry, false, // final boolean show, lrp.vnir_scale); if (imps == null) { Loading Loading @@ -433,7 +442,8 @@ public class LwirReader { for (int chn:lrp.lwir_channels) { urls[chn] = "http://"+lrp.lwir_ip+"/parsedit.php?immediate&sensor_port="+chn+ "&BITS=16"+ "&COLOR="+COLOR_RAW; // +"*0"; // raw mode - delay 0 - breaks compressor "&COLOR="+COLOR_RAW+ // +"*0"; // raw mode - delay 0 - breaks compressor "&WOI_HEIGHT="+(LWIR_HEIGHT + (lrp.lwir_telemetry?LWIR_TELEMETRY_LINES:0)); if (chn == lwir_master_port) { urls[chn] +="&TRIG=0*0"+ "&TRIG_DELAY="+lrp.lwir_trig_dly+"*0"+ Loading
src/main/java/com/elphel/imagej/lwir/LwirReaderParameters.java +24 −16 Original line number Diff line number Diff line Loading @@ -33,11 +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 public boolean avg_all = 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_telemetry = true; protected double vnir_quality = 98.0; protected boolean vnir_scale = false; // restore sensor pixel values, undo camera white balancing protected boolean vnir_autoexp = false; Loading Loading @@ -77,6 +78,7 @@ public class LwirReaderParameters { properties.setProperty(prefix+"vnir_ip", this.vnir_ip+""); properties.setProperty(prefix+"lwir_channels", arr_to_str(this.lwir_channels)); properties.setProperty(prefix+"vnir_channels", arr_to_str(this.vnir_channels)); properties.setProperty(prefix+"lwir_telemetry", this.lwir_telemetry+""); properties.setProperty(prefix+"vnir_quality", this.vnir_quality+""); properties.setProperty(prefix+"vnir_scale", this.vnir_scale+""); properties.setProperty(prefix+"vnir_autoexp", this.vnir_autoexp+""); Loading @@ -101,6 +103,7 @@ public class LwirReaderParameters { if (properties.getProperty(prefix+"vnir_ip")!=null) this.vnir_ip= properties.getProperty(prefix+"vnir_ip"); if (properties.getProperty(prefix+"lwir_channels")!=null) this.lwir_channels=str_to_iarr(properties.getProperty(prefix+"lwir_channels")); if (properties.getProperty(prefix+"vnir_channels")!=null) this.vnir_channels=str_to_iarr(properties.getProperty(prefix+"vnir_channels")); if (properties.getProperty(prefix+"lwir_telemetry")!=null) this.lwir_telemetry= Boolean.parseBoolean(properties.getProperty(prefix+"lwir_telemetry")); if (properties.getProperty(prefix+"vnir_quality")!=null) this.vnir_quality=Double.parseDouble(properties.getProperty(prefix+"vnir_quality")); if (properties.getProperty(prefix+"vnir_scale")!=null) this.vnir_scale= Boolean.parseBoolean(properties.getProperty(prefix+"vnir_scale")); if (properties.getProperty(prefix+"vnir_autoexp")!=null) this.vnir_autoexp= Boolean.parseBoolean(properties.getProperty(prefix+"vnir_autoexp")); Loading @@ -127,6 +130,7 @@ public class LwirReaderParameters { lrp.vnir_ip= this.vnir_ip; lrp.lwir_channels= this.lwir_channels.clone(); lrp.vnir_channels= this.vnir_channels.clone(); lrp.lwir_telemetry= this.lwir_telemetry; lrp.vnir_quality= this.vnir_quality; lrp.vnir_scale= this.vnir_scale; lrp.vnir_autoexp= this.vnir_autoexp; Loading Loading @@ -160,6 +164,7 @@ public class LwirReaderParameters { (lrp.vnir_ip.equals(this.vnir_ip)) && (java.util.Arrays.equals(lrp.lwir_channels, this.lwir_channels)) && (java.util.Arrays.equals(lrp.vnir_channels, this.vnir_channels)) && (lrp.lwir_telemetry == this.lwir_telemetry) && (lrp.vnir_quality == this.vnir_quality) && (lrp.vnir_scale == this.vnir_scale) && (lrp.vnir_autoexp == this.vnir_autoexp) && Loading Loading @@ -187,6 +192,7 @@ public class LwirReaderParameters { result = prime * result + vnir_ip.hashCode(); result = prime * result + arr_to_str(lwir_channels).hashCode(); result = prime * result + arr_to_str(vnir_channels).hashCode(); result = prime * result + (lwir_telemetry?1:0); result = prime * result + (new Double(vnir_quality)).hashCode(); result = prime * result + (vnir_scale?1:0); result = prime * result + (vnir_autoexp?1:0); Loading @@ -213,6 +219,7 @@ public class LwirReaderParameters { gd.addStringField ("VNIR IP", this.vnir_ip, 20, "Visible range high resolution camera IP address"); gd.addStringField ("LWIR channels", arr_to_str(this.lwir_channels), 20, "Space-separated list of used LWIR camera channels, such as '0 1 2 3'"); gd.addStringField ("VNIR channels", arr_to_str(this.vnir_channels), 20, "Space-separated list of used visible range camera channels, such as '0 1 2 3'"); gd.addCheckbox ("LWIR telemetry", this.lwir_telemetry, "Set LWIR sesnors to provide telemetry data in the last 2 lines (may become mandatory later)"); gd.addNumericField("VNIR quality", this.vnir_quality, 3,6,"ms", "Visible range camera JPEG compression quality (all channels)"); gd.addCheckbox ("VNIR undo white balance", this.vnir_scale, "Undo in-camera white balancing"); gd.addCheckbox ("VNIR autoexposure", this.vnir_autoexp, "Enable autoexposure for the visible range camera"); Loading @@ -237,6 +244,7 @@ public class LwirReaderParameters { this.vnir_ip = gd.getNextString(); this.lwir_channels = str_to_iarr(gd.getNextString()); this.vnir_channels = str_to_iarr(gd.getNextString()); this.lwir_telemetry = gd.getNextBoolean(); this.vnir_quality = gd.getNextNumber(); this.vnir_scale = gd.getNextBoolean(); this.vnir_autoexp = gd.getNextBoolean(); Loading
src/main/java/com/elphel/imagej/readers/ImagejJp4Tiff.java +25 −4 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import java.net.URL; import java.net.URLConnection; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; import java.util.Properties; Loading Loading @@ -65,8 +66,10 @@ public class ImagejJp4Tiff { 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"; private static final boolean KEEP_EXTENSION = false; // remove extension for ImagePlus title private static final boolean BOTTOM_TELEMETRY = true; // telemetry (if present) is at the bottom of the image // -- Fields -- Loading Loading @@ -186,12 +189,13 @@ public class ImagejJp4Tiff { boolean is_le = reader.isLittleEndian(); int bytes_per_pixel = (bpp + 7) / 9; float [] pixels = new float [bytes.length/bytes_per_pixel]; ByteBuffer bb = null; if (bytes_per_pixel == 1) { for (int i = 0; i < pixels.length; i++) { pixels[i] = ((bytes[i])) & 0xff; } } else { ByteBuffer bb = ByteBuffer.wrap(bytes); bb = ByteBuffer.wrap(bytes); if (is_le) { bb.order( ByteOrder.LITTLE_ENDIAN); } else { Loading @@ -208,9 +212,20 @@ public class ImagejJp4Tiff { LOGGER.error("Problem degamma/scaling of "+content_fileName); } ImageProcessor ip=new FloatProcessor(reader.getSizeX(), reader.getSizeY()); boolean telemetry = (bytes_per_pixel == 2); Lepton3Telemetry lepton3Telemetry = null; if (telemetry) { lepton3Telemetry = new Lepton3Telemetry(bb,pixels, true); // bottom telemetry = lepton3Telemetry.hasTelemetry(); } ImageProcessor ip = null; if (telemetry) { ip=new FloatProcessor(Lepton3Telemetry.LEPTON3_IMAGE_WIDTH, Lepton3Telemetry.LEPTON3_IMAGE_HEIGHT); ip.setPixels(lepton3Telemetry.getPixels()); // bo } else { ip=new FloatProcessor(reader.getSizeX(), reader.getSizeY()); ip.setPixels(pixels); } ip.resetMinAndMax(); String prefix = ElphelTiffReader.ELPHEL_PROPERTY_PREFIX; String imageName = content_fileName; // path; Loading @@ -234,6 +249,12 @@ public class ImagejJp4Tiff { imp.setProperty(std+(key.replace(" ","_").replace("/","_")), meta_hash.get(key).toString()); } } if (telemetry) { HashMap<String, String> telemetryMap = lepton3Telemetry.parseTelemetry(); for (String key:telemetryMap.keySet()) { imp.setProperty(TELEMETRY_PREFIX+key, telemetryMap.get(key)); } } encodeProperiesToInfo(imp); Location.mapFile(content_fileName, null); return imp; Loading