Ejemplo n.º 1
0
  @Override
  public void run(String args) {
    GenericDialogPlus gd = new GenericDialogPlus("Fuse from 2 cameras");
    gd.addDirectoryField("Input folder", "");
    gd.addNumericField("#angles", 1, 0);
    gd.addNumericField("#angleInc", 45, 0);
    gd.addNumericField("#layers", 1, 0);
    gd.addFileField("Transformations", "");
    gd.addCheckbox("Adjust modes to compensate for intensity differences", false);
    gd.showDialog();
    if (gd.wasCanceled()) return;

    String folder = gd.getNextString();
    int nAngles = (int) gd.getNextNumber();
    int angleInc = (int) gd.getNextNumber();
    int nLayers = (int) gd.getNextNumber();
    String transformationFile = gd.getNextString();
    boolean adjustModes = gd.getNextBoolean();

    Matrix4f[] transformations = new Matrix4f[1];
    if (nAngles > 1) {
      try {
        transformations = TwoCameraSphericalMaxProjection.loadTransformations(transformationFile);
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
    final int[][][] colors = new int[2][2][nAngles];
    //		final Button[][][] buttons = new Button[2][2][nAngles];
    //		class ColorActionListener implements ActionListener {
    //			private final int cam, ill, a;
    //			public ColorActionListener(int cam, int ill, int a) {
    //				this.cam = cam; this.ill = ill; this.a = a;
    //			}
    //			@Override
    //			public void actionPerformed(ActionEvent e) {
    //				Color c = JColorChooser.showDialog(
    //						null,
    //						"Choose Background Color",
    //						Color.RED);
    //				colors[cam][ill][a] = c.getRGB();
    //				buttons[cam][ill][a].setForeground(c);
    //			}
    //		}
    //		gd = new GenericDialogPlus("Colors");
    //		for(int a = 0; a < nAngles; a++) {
    //			gd.addButton("Camera1_Left_Illumination", new ColorActionListener(CAMERA1, LEFT, a));
    //			buttons[CAMERA1][LEFT] [a] = (Button)gd.getComponent(gd.getComponentCount() - 1);
    //			gd.addButton("Camera1_Right_Illumination", new ColorActionListener(CAMERA1, RIGHT, a));
    //			buttons[CAMERA1][RIGHT][a] = (Button)gd.getComponent(gd.getComponentCount() - 1);
    //			gd.addButton("Camera2_Left_Illumination", new ColorActionListener(CAMERA2, LEFT, a));
    //			buttons[CAMERA2][LEFT] [a] = (Button)gd.getComponent(gd.getComponentCount() - 1);
    //			gd.addButton("Camera2_Right_Illumination", new ColorActionListener(CAMERA2, RIGHT, a));
    //			buttons[CAMERA2][RIGHT][a] = (Button)gd.getComponent(gd.getComponentCount() - 1);
    //		}
    //		gd.showDialog();
    //		if(gd.wasCanceled())
    //			return;

    colors[CAMERA1][LEFT][0] = colors[CAMERA1][RIGHT][0] = new Color(206, 47, 42).getRGB();
    colors[CAMERA2][LEFT][0] = colors[CAMERA2][RIGHT][0] = new Color(241, 183, 51).getRGB();
    //		colors[CAMERA1][LEFT] [1] = colors[CAMERA1][RIGHT][1] = new Color(162, 198, 231).getRGB();
    //		colors[CAMERA2][LEFT] [1] = colors[CAMERA2][RIGHT][1] = new Color(42, 76, 149).getRGB();

    try {
      fuse(folder, nAngles, angleInc, nLayers, transformations, adjustModes, colors, true);
    } catch (Exception e) {
      IJ.error(e.getMessage());
      e.printStackTrace();
    }
  }
Ejemplo n.º 2
0
 private String getFile(int tp, int aIndex, int angleInc, int camera, int ill, int layer) {
   return TwoCameraSphericalMaxProjection.getFileName(tp, aIndex, angleInc, camera, ill, layer);
 }