Loading src/main/java/JP46_Reader_camera0.java +62 −4 Original line number Original line Diff line number Diff line Loading @@ -55,6 +55,8 @@ import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXException; import com.elphel.imagej.readers.ImagejJp4Tiff; import ij.IJ; import ij.IJ; import ij.ImageJ; import ij.ImageJ; import ij.ImagePlus; import ij.ImagePlus; Loading @@ -69,6 +71,7 @@ import ij.plugin.frame.PlugInFrame; import ij.process.ImageConverter; import ij.process.ImageConverter; import ij.process.ImageProcessor; import ij.process.ImageProcessor; import ij.text.TextWindow; import ij.text.TextWindow; import loci.formats.FormatException; Loading @@ -87,6 +90,8 @@ public class JP46_Reader_camera0 extends PlugInFrame implements ActionListener { static File dir; static File dir; ImagejJp4Tiff imagejJp4Tiff = new ImagejJp4Tiff(); public String camera_url = "http://192.168.0.236:8081/"; public String camera_url = "http://192.168.0.236:8081/"; public String camera_img = "bimg"; public String camera_img = "bimg"; public String camera_img_new = "towp/wait/bimg"; // will always wait for the next image (repetitive acquisitions get new images) public String camera_img_new = "towp/wait/bimg"; // will always wait for the next image (repetitive acquisitions get new images) Loading @@ -109,8 +114,9 @@ public class JP46_Reader_camera0 extends PlugInFrame implements ActionListener { panel1 = new Panel(); panel1 = new Panel(); panel1.setLayout(new GridLayout(6, 1, 50, 5)); panel1.setLayout(new GridLayout(8, 1, 50, 5)); addButton("Open JP4/Tiff...",panel1); addButton("Open JP4/JP46...",panel1); addButton("Open JP4/JP46...",panel1); addButton("Open JP4/JP46 from camera",panel1); addButton("Open JP4/JP46 from camera",panel1); addButton("Configure...",panel1); addButton("Configure...",panel1); Loading @@ -137,8 +143,8 @@ public class JP46_Reader_camera0 extends PlugInFrame implements ActionListener { panel1 = new Panel(); panel1 = new Panel(); panel1.setLayout(new GridLayout(6, 1, 50, 5)); panel1.setLayout(new GridLayout(8, 1, 50, 5)); addButton("Open JP4/Tiff...",panel1); addButton("Open JP4/JP46...",panel1); addButton("Open JP4/JP46...",panel1); addButton("Open JP4/JP46 from camera",panel1); addButton("Open JP4/JP46 from camera",panel1); addButton("Configure...",panel1); addButton("Configure...",panel1); Loading Loading @@ -169,7 +175,11 @@ public class JP46_Reader_camera0 extends PlugInFrame implements ActionListener { if (label==null) return; if (label==null) return; /* button */ /* button */ if (label.equals("Open JP4/JP46...")) { if (label.equals("Open JP4/Tiff...")) { read_jp4Tiff(arg,true); }else if (label.equals("Open JP4/Tiff (no scale)...")) { read_jp4Tiff(arg,false); }else if (label.equals("Open JP4/JP46...")) { read_jp46(arg,true); read_jp46(arg,true); }else if (label.equals("Open JP4/JP46 (no scale)...")) { }else if (label.equals("Open JP4/JP46 (no scale)...")) { read_jp46(arg,false); read_jp46(arg,false); Loading Loading @@ -227,7 +237,54 @@ public class JP46_Reader_camera0 extends PlugInFrame implements ActionListener { imp_stack.getProcessor().resetMinAndMax(); imp_stack.getProcessor().resetMinAndMax(); imp_stack.show(); imp_stack.show(); } } public void read_jp4Tiff(String arg, // not used? boolean scale) { String LOG_LEVEL = ABSOLUTELY_SILENT? "OFF" : (IS_SILENT?"ERROR":"INFO"); boolean LOG_LEVEL_SET = loci.common.DebugTools.enableLogging(LOG_LEVEL); if (!LOG_LEVEL_SET) { // only first time true loci.common.DebugTools.setRootLevel(LOG_LEVEL); } JFileChooser fc=null; //try {fc = new JFileChooser();} fc = new JFileChooser(); //catch (Throwable e) {IJ.error("This plugin requires Java 2 or Swing."); return;} fc.setMultiSelectionEnabled(true); if (dir==null) { String sdir = OpenDialog.getDefaultDirectory(); if (sdir!=null) dir = new File(sdir); } if (dir!=null) fc.setCurrentDirectory(dir); int returnVal = fc.showOpenDialog(IJ.getInstance()); if (returnVal!=JFileChooser.APPROVE_OPTION) return; File[] files = fc.getSelectedFiles(); if (files.length==0) { // getSelectedFiles does not work on some JVMs files = new File[1]; files[0] = fc.getSelectedFile(); } String path = fc.getCurrentDirectory().getPath()+Prefs.getFileSeparator(); dir = fc.getCurrentDirectory(); for (int i=0; i<files.length; i++) { try { ImagePlus imp = imagejJp4Tiff.readTiffJp4(path + files[i].getName(), scale); // imp.updateAndDraw(); imp.show(); } catch (IOException | FormatException e) { // TODO Auto-generated catch block e.printStackTrace(); } // throws IOException, FormatException { // std - include non-elphel properties with prefix std // open(path, files[i].getName(), arg, scale); } } public void read_jp46(String arg, boolean scale) { public void read_jp46(String arg, boolean scale) { JFileChooser fc=null; JFileChooser fc=null; //try {fc = new JFileChooser();} //try {fc = new JFileChooser();} Loading Loading @@ -274,6 +331,7 @@ public class JP46_Reader_camera0 extends PlugInFrame implements ActionListener { confpanel = new Panel(); confpanel = new Panel(); gd.addPanel(confpanel); gd.addPanel(confpanel); addButton("Open JP4/Tiff (no scale)...", confpanel); addButton("Open JP4/JP46 (no scale)...", confpanel); addButton("Open JP4/JP46 (no scale)...", confpanel); addButton("Open JP4/JP46 from camera (no scale)", confpanel); addButton("Open JP4/JP46 from camera (no scale)", confpanel); Loading Loading
src/main/java/JP46_Reader_camera0.java +62 −4 Original line number Original line Diff line number Diff line Loading @@ -55,6 +55,8 @@ import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXException; import com.elphel.imagej.readers.ImagejJp4Tiff; import ij.IJ; import ij.IJ; import ij.ImageJ; import ij.ImageJ; import ij.ImagePlus; import ij.ImagePlus; Loading @@ -69,6 +71,7 @@ import ij.plugin.frame.PlugInFrame; import ij.process.ImageConverter; import ij.process.ImageConverter; import ij.process.ImageProcessor; import ij.process.ImageProcessor; import ij.text.TextWindow; import ij.text.TextWindow; import loci.formats.FormatException; Loading @@ -87,6 +90,8 @@ public class JP46_Reader_camera0 extends PlugInFrame implements ActionListener { static File dir; static File dir; ImagejJp4Tiff imagejJp4Tiff = new ImagejJp4Tiff(); public String camera_url = "http://192.168.0.236:8081/"; public String camera_url = "http://192.168.0.236:8081/"; public String camera_img = "bimg"; public String camera_img = "bimg"; public String camera_img_new = "towp/wait/bimg"; // will always wait for the next image (repetitive acquisitions get new images) public String camera_img_new = "towp/wait/bimg"; // will always wait for the next image (repetitive acquisitions get new images) Loading @@ -109,8 +114,9 @@ public class JP46_Reader_camera0 extends PlugInFrame implements ActionListener { panel1 = new Panel(); panel1 = new Panel(); panel1.setLayout(new GridLayout(6, 1, 50, 5)); panel1.setLayout(new GridLayout(8, 1, 50, 5)); addButton("Open JP4/Tiff...",panel1); addButton("Open JP4/JP46...",panel1); addButton("Open JP4/JP46...",panel1); addButton("Open JP4/JP46 from camera",panel1); addButton("Open JP4/JP46 from camera",panel1); addButton("Configure...",panel1); addButton("Configure...",panel1); Loading @@ -137,8 +143,8 @@ public class JP46_Reader_camera0 extends PlugInFrame implements ActionListener { panel1 = new Panel(); panel1 = new Panel(); panel1.setLayout(new GridLayout(6, 1, 50, 5)); panel1.setLayout(new GridLayout(8, 1, 50, 5)); addButton("Open JP4/Tiff...",panel1); addButton("Open JP4/JP46...",panel1); addButton("Open JP4/JP46...",panel1); addButton("Open JP4/JP46 from camera",panel1); addButton("Open JP4/JP46 from camera",panel1); addButton("Configure...",panel1); addButton("Configure...",panel1); Loading Loading @@ -169,7 +175,11 @@ public class JP46_Reader_camera0 extends PlugInFrame implements ActionListener { if (label==null) return; if (label==null) return; /* button */ /* button */ if (label.equals("Open JP4/JP46...")) { if (label.equals("Open JP4/Tiff...")) { read_jp4Tiff(arg,true); }else if (label.equals("Open JP4/Tiff (no scale)...")) { read_jp4Tiff(arg,false); }else if (label.equals("Open JP4/JP46...")) { read_jp46(arg,true); read_jp46(arg,true); }else if (label.equals("Open JP4/JP46 (no scale)...")) { }else if (label.equals("Open JP4/JP46 (no scale)...")) { read_jp46(arg,false); read_jp46(arg,false); Loading Loading @@ -227,7 +237,54 @@ public class JP46_Reader_camera0 extends PlugInFrame implements ActionListener { imp_stack.getProcessor().resetMinAndMax(); imp_stack.getProcessor().resetMinAndMax(); imp_stack.show(); imp_stack.show(); } } public void read_jp4Tiff(String arg, // not used? boolean scale) { String LOG_LEVEL = ABSOLUTELY_SILENT? "OFF" : (IS_SILENT?"ERROR":"INFO"); boolean LOG_LEVEL_SET = loci.common.DebugTools.enableLogging(LOG_LEVEL); if (!LOG_LEVEL_SET) { // only first time true loci.common.DebugTools.setRootLevel(LOG_LEVEL); } JFileChooser fc=null; //try {fc = new JFileChooser();} fc = new JFileChooser(); //catch (Throwable e) {IJ.error("This plugin requires Java 2 or Swing."); return;} fc.setMultiSelectionEnabled(true); if (dir==null) { String sdir = OpenDialog.getDefaultDirectory(); if (sdir!=null) dir = new File(sdir); } if (dir!=null) fc.setCurrentDirectory(dir); int returnVal = fc.showOpenDialog(IJ.getInstance()); if (returnVal!=JFileChooser.APPROVE_OPTION) return; File[] files = fc.getSelectedFiles(); if (files.length==0) { // getSelectedFiles does not work on some JVMs files = new File[1]; files[0] = fc.getSelectedFile(); } String path = fc.getCurrentDirectory().getPath()+Prefs.getFileSeparator(); dir = fc.getCurrentDirectory(); for (int i=0; i<files.length; i++) { try { ImagePlus imp = imagejJp4Tiff.readTiffJp4(path + files[i].getName(), scale); // imp.updateAndDraw(); imp.show(); } catch (IOException | FormatException e) { // TODO Auto-generated catch block e.printStackTrace(); } // throws IOException, FormatException { // std - include non-elphel properties with prefix std // open(path, files[i].getName(), arg, scale); } } public void read_jp46(String arg, boolean scale) { public void read_jp46(String arg, boolean scale) { JFileChooser fc=null; JFileChooser fc=null; //try {fc = new JFileChooser();} //try {fc = new JFileChooser();} Loading Loading @@ -274,6 +331,7 @@ public class JP46_Reader_camera0 extends PlugInFrame implements ActionListener { confpanel = new Panel(); confpanel = new Panel(); gd.addPanel(confpanel); gd.addPanel(confpanel); addButton("Open JP4/Tiff (no scale)...", confpanel); addButton("Open JP4/JP46 (no scale)...", confpanel); addButton("Open JP4/JP46 (no scale)...", confpanel); addButton("Open JP4/JP46 from camera (no scale)", confpanel); addButton("Open JP4/JP46 from camera (no scale)", confpanel); Loading