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

correcting extrinsics after being changed

parent 79689dc1
Loading
Loading
Loading
Loading
+80 −8
Original line number Original line Diff line number Diff line
@@ -55,7 +55,7 @@ public class EyesisCorrectionParameters {
  		public boolean blueProc =              true;
  		public boolean blueProc =              true;
  		public boolean toRGB =                 true;
  		public boolean toRGB =                 true;
  		public boolean rotate =                true;
  		public boolean rotate =                true;
  		public boolean crop =                  true;  // crop to the sennor size 
  		public boolean crop =                  true;  // crop to the sensor size 
  		public int     equirectangularFormat=     0;  // 0 - 8 bit RGBA, 1 - 16 bit RGBA, 2 (32 int or 16 float!) ?, 3 - 32-bit FP RGBA. only 0, 1 and 3 currently supported
  		public int     equirectangularFormat=     0;  // 0 - 8 bit RGBA, 1 - 16 bit RGBA, 2 (32 int or 16 float!) ?, 3 - 32-bit FP RGBA. only 0, 1 and 3 currently supported
  		public double  outputRangeInt=          0.25;  // 1.0 intensity will be mapped to 65535*0.25
  		public double  outputRangeInt=          0.25;  // 1.0 intensity will be mapped to 65535*0.25
  		public double  outputRangeFP=          255.0; // 1.0 intensity will be saved as 255.0 (in float 32-bit mode)
  		public double  outputRangeFP=          255.0; // 1.0 intensity will be saved as 255.0 (in float 32-bit mode)
@@ -2004,11 +2004,24 @@ public class EyesisCorrectionParameters {
  		public double     fine_corr_x_3 =     0.0;   // additionally shift image in port 3 in x direction
  		public double     fine_corr_x_3 =     0.0;   // additionally shift image in port 3 in x direction
  		public double     fine_corr_y_3 =     0.0;   // additionally shift image in port 3 in y direction
  		public double     fine_corr_y_3 =     0.0;   // additionally shift image in port 3 in y direction
  		
  		
  		public double     fcorr_min_stength = 0.005; // minimal correlation strength to apply fine correction
  		public double     fcorr_min_strength = 0.15 ; // 0.005 minimal correlation strength to apply fine correction
  		public double     fcorr_disp_diff =   3.0;   // consider only tiles with absolute residual disparity lower than
  		public double     fcorr_disp_diff =   1.5;   // consider only tiles with absolute residual disparity lower than
  		public boolean    fcorr_quadratic =   true;  // Use quadratic polynomial for fine correction (false - only linear)
  		public boolean    fcorr_quadratic =   true;  // Use quadratic polynomial for fine correction (false - only linear)
  		public boolean    fcorr_ignore =      false; // Ignore currently calculated fine correction
  		public boolean    fcorr_ignore =      false; // Ignore currently calculated fine correction


  		public double     fcorr_inf_strength = 0.20 ; // Minimal correlation strength to use for infinity correction
  		public double     fcorr_inf_diff =    0.2;   // Disparity half-range for infinity
  		public boolean    fcorr_inf_quad =    true;  // Use quadratic polynomial for infinity correction (false - only linear)
  		public boolean    fcorr_inf_vert =    false; // Correct infinity in vertical direction (false - only horizontal)

  		public int        fcorr_sample_size = 32;    // Use square this size side to detect outliers
  		public int        fcorr_mintiles =    8;     // Keep tiles only if there are more in each square 
  		public double     fcorr_reloutliers = 0.5;  // Remove this fraction of tiles from each sample
  		public double     fcorr_sigma =       20.0;  // Gaussian blur channel mismatch data
  		
  		
  		
  		
  		public double     corr_magic_scale =  0.85;  // reported correlation offset vs. actual one (not yet understood)
  		public double     corr_magic_scale =  0.85;  // reported correlation offset vs. actual one (not yet understood)
  		
  		
  		// 3d reconstruction
  		// 3d reconstruction
@@ -2366,6 +2379,9 @@ public class EyesisCorrectionParameters {
		public double     taDiffPwr            = 0.25;   // Strength power when calculating disparity error
		public double     taDiffPwr            = 0.25;   // Strength power when calculating disparity error
		public double     taBestPwr            = 0.0;    // Strength power when calculating disparity error over best
		public double     taBestPwr            = 0.0;    // Strength power when calculating disparity error over best
		public double     taDiff9Pwr           = 0.5;    // Strength power when calculating disparity error for group of 9
		public double     taDiff9Pwr           = 0.5;    // Strength power when calculating disparity error for group of 9
		public double     taColSigma           = 1.5;    // Gaussian sigma to blur color difference between tiles along each direction
		public double     taColFraction        = 0.3;    // Relative amount of the blurred color difference in the mixture  
		
		
		
  		public double     taCostEmpty          = 1.0;    // Cost of a tile that is not assigned
  		public double     taCostEmpty          = 1.0;    // Cost of a tile that is not assigned
  		public double     taCostNoLink         = 1.0;    // Cost of a tile not having any neighbor in particular direction
  		public double     taCostNoLink         = 1.0;    // Cost of a tile not having any neighbor in particular direction
@@ -2499,11 +2515,21 @@ public class EyesisCorrectionParameters {
  			properties.setProperty(prefix+"fine_corr_x_3",    this.fine_corr_x_3 +"");
  			properties.setProperty(prefix+"fine_corr_x_3",    this.fine_corr_x_3 +"");
  			properties.setProperty(prefix+"fine_corr_y_3",    this.fine_corr_y_3 +"");
  			properties.setProperty(prefix+"fine_corr_y_3",    this.fine_corr_y_3 +"");


  			properties.setProperty(prefix+"fcorr_min_stength",this.fcorr_min_stength +"");
  			properties.setProperty(prefix+"fcorr_min_strength",this.fcorr_min_strength +"");
  			properties.setProperty(prefix+"fcorr_disp_diff",  this.fcorr_disp_diff +"");
  			properties.setProperty(prefix+"fcorr_disp_diff",  this.fcorr_disp_diff +"");
			properties.setProperty(prefix+"fcorr_quadratic",  this.fcorr_quadratic+"");
			properties.setProperty(prefix+"fcorr_quadratic",  this.fcorr_quadratic+"");
			properties.setProperty(prefix+"fcorr_ignore",     this.fcorr_ignore+"");
			properties.setProperty(prefix+"fcorr_ignore",     this.fcorr_ignore+"");


  			properties.setProperty(prefix+"fcorr_inf_strength",this.fcorr_inf_strength +"");
  			properties.setProperty(prefix+"fcorr_inf_diff",   this.fcorr_inf_diff +"");
			properties.setProperty(prefix+"fcorr_inf_quad",   this.fcorr_inf_quad+"");
			properties.setProperty(prefix+"fcorr_inf_vert",   this.fcorr_inf_vert+"");

			properties.setProperty(prefix+"fcorr_sample_size",this.fcorr_sample_size+"");
  			properties.setProperty(prefix+"fcorr_mintiles",   this.fcorr_mintiles+"");
  			properties.setProperty(prefix+"fcorr_reloutliers",this.fcorr_reloutliers +"");
  			properties.setProperty(prefix+"fcorr_sigma",      this.fcorr_sigma +"");

  			properties.setProperty(prefix+"corr_magic_scale", this.corr_magic_scale +"");
  			properties.setProperty(prefix+"corr_magic_scale", this.corr_magic_scale +"");
  			
  			
			properties.setProperty(prefix+"show_textures",    this.show_textures+"");
			properties.setProperty(prefix+"show_textures",    this.show_textures+"");
@@ -2830,6 +2856,8 @@ public class EyesisCorrectionParameters {
			properties.setProperty(prefix+"taDiffPwr",        this.taDiffPwr +"");
			properties.setProperty(prefix+"taDiffPwr",        this.taDiffPwr +"");
			properties.setProperty(prefix+"taBestPwr",        this.taBestPwr +"");
			properties.setProperty(prefix+"taBestPwr",        this.taBestPwr +"");
			properties.setProperty(prefix+"taDiff9Pwr",       this.taDiff9Pwr +"");
			properties.setProperty(prefix+"taDiff9Pwr",       this.taDiff9Pwr +"");
			properties.setProperty(prefix+"taColSigma",       this.taColSigma +"");
			properties.setProperty(prefix+"taColFraction",    this.taColFraction +"");
			
			
			properties.setProperty(prefix+"taCostEmpty",      this.taCostEmpty +"");
			properties.setProperty(prefix+"taCostEmpty",      this.taCostEmpty +"");
			properties.setProperty(prefix+"taCostNoLink",     this.taCostNoLink +"");
			properties.setProperty(prefix+"taCostNoLink",     this.taCostNoLink +"");
@@ -2957,10 +2985,21 @@ public class EyesisCorrectionParameters {
  			if (properties.getProperty(prefix+"fine_corr_x_3")!=null) this.fine_corr_x_3=Double.parseDouble(properties.getProperty(prefix+"fine_corr_x_3"));
  			if (properties.getProperty(prefix+"fine_corr_x_3")!=null) this.fine_corr_x_3=Double.parseDouble(properties.getProperty(prefix+"fine_corr_x_3"));
  			if (properties.getProperty(prefix+"fine_corr_y_3")!=null) this.fine_corr_y_3=Double.parseDouble(properties.getProperty(prefix+"fine_corr_y_3"));
  			if (properties.getProperty(prefix+"fine_corr_y_3")!=null) this.fine_corr_y_3=Double.parseDouble(properties.getProperty(prefix+"fine_corr_y_3"));
  			
  			
  			if (properties.getProperty(prefix+"fcorr_min_stength")!=null) this.fcorr_min_stength=Double.parseDouble(properties.getProperty(prefix+"fcorr_min_stength"));
  			if (properties.getProperty(prefix+"fcorr_min_strength")!=null) this.fcorr_min_strength=Double.parseDouble(properties.getProperty(prefix+"fcorr_min_strength"));
  			if (properties.getProperty(prefix+"fcorr_disp_diff")!=null)   this.fcorr_disp_diff=Double.parseDouble(properties.getProperty(prefix+"fcorr_disp_diff"));
  			if (properties.getProperty(prefix+"fcorr_disp_diff")!=null)   this.fcorr_disp_diff=Double.parseDouble(properties.getProperty(prefix+"fcorr_disp_diff"));
  			if (properties.getProperty(prefix+"fcorr_quadratic")!=null)   this.fcorr_quadratic=Boolean.parseBoolean(properties.getProperty(prefix+"fcorr_quadratic"));
  			if (properties.getProperty(prefix+"fcorr_quadratic")!=null)   this.fcorr_quadratic=Boolean.parseBoolean(properties.getProperty(prefix+"fcorr_quadratic"));
  			if (properties.getProperty(prefix+"fcorr_ignore")!=null)      this.fcorr_ignore=Boolean.parseBoolean(properties.getProperty(prefix+"fcorr_ignore"));
  			if (properties.getProperty(prefix+"fcorr_ignore")!=null)      this.fcorr_ignore=Boolean.parseBoolean(properties.getProperty(prefix+"fcorr_ignore"));

  			if (properties.getProperty(prefix+"fcorr_inf_strength")!=null) this.fcorr_inf_strength=Double.parseDouble(properties.getProperty(prefix+"fcorr_inf_strength"));
  			if (properties.getProperty(prefix+"fcorr_inf_diff")!=null)    this.fcorr_inf_diff=Double.parseDouble(properties.getProperty(prefix+"fcorr_inf_diff"));
  			if (properties.getProperty(prefix+"fcorr_inf_quad")!=null)    this.fcorr_inf_quad=Boolean.parseBoolean(properties.getProperty(prefix+"fcorr_inf_quad"));
  			if (properties.getProperty(prefix+"fcorr_inf_vert")!=null)    this.fcorr_inf_vert=Boolean.parseBoolean(properties.getProperty(prefix+"fcorr_inf_vert"));

  			if (properties.getProperty(prefix+"fcorr_sample_size")!=null) this.fcorr_sample_size=Integer.parseInt(properties.getProperty(prefix+"fcorr_sample_size"));
  			if (properties.getProperty(prefix+"fcorr_mintiles")!=null)    this.fcorr_mintiles=Integer.parseInt(properties.getProperty(prefix+"fcorr_mintiles"));
  			if (properties.getProperty(prefix+"fcorr_reloutliers")!=null) this.fcorr_reloutliers=Double.parseDouble(properties.getProperty(prefix+"fcorr_reloutliers"));
  			if (properties.getProperty(prefix+"fcorr_sigma")!=null)       this.fcorr_sigma=Double.parseDouble(properties.getProperty(prefix+"fcorr_sigma"));
  			
  			if (properties.getProperty(prefix+"corr_magic_scale")!=null)  this.corr_magic_scale=Double.parseDouble(properties.getProperty(prefix+"corr_magic_scale"));
  			if (properties.getProperty(prefix+"corr_magic_scale")!=null)  this.corr_magic_scale=Double.parseDouble(properties.getProperty(prefix+"corr_magic_scale"));


  			if (properties.getProperty(prefix+"show_textures")!=null)      this.show_textures=Boolean.parseBoolean(properties.getProperty(prefix+"show_textures"));
  			if (properties.getProperty(prefix+"show_textures")!=null)      this.show_textures=Boolean.parseBoolean(properties.getProperty(prefix+"show_textures"));
@@ -3287,6 +3326,8 @@ public class EyesisCorrectionParameters {
  			if (properties.getProperty(prefix+"taDiffPwr")!=null)         this.taDiffPwr=Double.parseDouble(properties.getProperty(prefix+"taDiffPwr"));
  			if (properties.getProperty(prefix+"taDiffPwr")!=null)         this.taDiffPwr=Double.parseDouble(properties.getProperty(prefix+"taDiffPwr"));
  			if (properties.getProperty(prefix+"taBestPwr")!=null)         this.taBestPwr=Double.parseDouble(properties.getProperty(prefix+"taBestPwr"));
  			if (properties.getProperty(prefix+"taBestPwr")!=null)         this.taBestPwr=Double.parseDouble(properties.getProperty(prefix+"taBestPwr"));
  			if (properties.getProperty(prefix+"taDiff9Pwr")!=null)        this.taDiff9Pwr=Double.parseDouble(properties.getProperty(prefix+"taDiff9Pwr"));
  			if (properties.getProperty(prefix+"taDiff9Pwr")!=null)        this.taDiff9Pwr=Double.parseDouble(properties.getProperty(prefix+"taDiff9Pwr"));
  			if (properties.getProperty(prefix+"taColSigma")!=null)        this.taDiff9Pwr=Double.parseDouble(properties.getProperty(prefix+"taColSigma"));
  			if (properties.getProperty(prefix+"taColFraction")!=null)     this.taColFraction=Double.parseDouble(properties.getProperty(prefix+"taColFraction"));


  			if (properties.getProperty(prefix+"taCostEmpty")!=null)       this.taCostEmpty=Double.parseDouble(properties.getProperty(prefix+"taCostEmpty"));
  			if (properties.getProperty(prefix+"taCostEmpty")!=null)       this.taCostEmpty=Double.parseDouble(properties.getProperty(prefix+"taCostEmpty"));
  			if (properties.getProperty(prefix+"taCostNoLink")!=null)      this.taCostNoLink=Double.parseDouble(properties.getProperty(prefix+"taCostNoLink"));
  			if (properties.getProperty(prefix+"taCostNoLink")!=null)      this.taCostNoLink=Double.parseDouble(properties.getProperty(prefix+"taCostNoLink"));
@@ -3429,10 +3470,21 @@ public class EyesisCorrectionParameters {
  			gd.addNumericField("X 3",                                                                     this.fine_corr_x_3,  3);
  			gd.addNumericField("X 3",                                                                     this.fine_corr_x_3,  3);
  			gd.addNumericField("Y 4",                                                                     this.fine_corr_y_3,  3);
  			gd.addNumericField("Y 4",                                                                     this.fine_corr_y_3,  3);


  			gd.addNumericField("Minimal correlation strength to apply fine correction",                   this.fcorr_min_stength,  3);
  			gd.addNumericField("Minimal correlation strength to apply fine correction",                   this.fcorr_min_strength,3);
  			gd.addNumericField("Consider only tiles with absolute residual disparity lower than",         this.fcorr_disp_diff,  3);
  			gd.addNumericField("Consider only tiles with absolute residual disparity lower than",         this.fcorr_disp_diff,  3);
  			gd.addCheckbox    ("Use quadratic polynomial for fine correction (false - only linear)",      this.fcorr_quadratic);
  			gd.addCheckbox    ("Use quadratic polynomial for fine correction (false - only linear)",      this.fcorr_quadratic);
  			gd.addCheckbox    ("Ignore current calculated fine correction (use manual only)",             this.fcorr_ignore);
  			gd.addCheckbox    ("Ignore current calculated fine correction (use manual only)",             this.fcorr_ignore);

  			gd.addNumericField("Minimal correlation strength to use for infinity correction",             this.fcorr_inf_strength,3);
  			gd.addNumericField("Disparity half-range for infinity",                                       this.fcorr_inf_diff,  3);
  			gd.addCheckbox    ("Use quadratic polynomial for infinity correction (false - only linear)",  this.fcorr_inf_quad);
  			gd.addCheckbox    ("Correct infinity in vertical direction (false - only horizontal)",        this.fcorr_inf_vert);

  			gd.addNumericField("Use square this size side to detect outliers",                            this.fcorr_sample_size,  0);
  			gd.addNumericField("Keep tiles only if there are more in each square",                        this.fcorr_mintiles,     0);
  			gd.addNumericField("Remove this fraction of tiles from each sample",                          this.fcorr_reloutliers,  3);
  			gd.addNumericField("Gaussian blur channel mismatch data",                                     this.fcorr_sigma,        3);

  			gd.addNumericField("Calculated from correlation offset vs. actual one (not yet understood)",  this.corr_magic_scale,  3);
  			gd.addNumericField("Calculated from correlation offset vs. actual one (not yet understood)",  this.corr_magic_scale,  3);
  			
  			
  			gd.addMessage     ("--- 3D reconstruction ---");
  			gd.addMessage     ("--- 3D reconstruction ---");
@@ -3776,6 +3828,8 @@ public class EyesisCorrectionParameters {
  			gd.addNumericField("Strength power when calculating disparity error",                                 this.taDiffPwr, 6);
  			gd.addNumericField("Strength power when calculating disparity error",                                 this.taDiffPwr, 6);
  			gd.addNumericField("Strength power when calculating disparity error over best",                       this.taBestPwr, 6);
  			gd.addNumericField("Strength power when calculating disparity error over best",                       this.taBestPwr, 6);
  			gd.addNumericField("Strength power when calculating disparity error for group of 9",                  this.taDiff9Pwr, 6);
  			gd.addNumericField("Strength power when calculating disparity error for group of 9",                  this.taDiff9Pwr, 6);
  			gd.addNumericField("Gaussian sigma to blur color difference between tiles along each direction",      this.taColSigma, 6);
  			gd.addNumericField("Relative amount of the blurred color difference in the mixture",                  this.taColFraction, 6);


  			gd.addNumericField("Cost of a tile that is not assigned",                                             this.taCostEmpty,  6);
  			gd.addNumericField("Cost of a tile that is not assigned",                                             this.taCostEmpty,  6);
  			gd.addNumericField("Cost of a tile not having any neighbor in particular direction",                  this.taCostNoLink,  6);
  			gd.addNumericField("Cost of a tile not having any neighbor in particular direction",                  this.taCostNoLink,  6);
@@ -3909,10 +3963,21 @@ public class EyesisCorrectionParameters {
  			this.fine_corr_x_3=         gd.getNextNumber();
  			this.fine_corr_x_3=         gd.getNextNumber();
  			this.fine_corr_y_3=         gd.getNextNumber();
  			this.fine_corr_y_3=         gd.getNextNumber();
  			
  			
  			this.fcorr_min_stength=     gd.getNextNumber();
  			this.fcorr_min_strength=    gd.getNextNumber();
  			this.fcorr_disp_diff=       gd.getNextNumber();
  			this.fcorr_disp_diff=       gd.getNextNumber();
  			this.fcorr_quadratic=       gd.getNextBoolean();
  			this.fcorr_quadratic=       gd.getNextBoolean();
  			this.fcorr_ignore=          gd.getNextBoolean();
  			this.fcorr_ignore=          gd.getNextBoolean();

  			this.fcorr_inf_strength=    gd.getNextNumber();
  			this.fcorr_inf_diff=        gd.getNextNumber();
  			this.fcorr_inf_quad=        gd.getNextBoolean();
  			this.fcorr_inf_vert=        gd.getNextBoolean();

  			this.fcorr_sample_size= (int)gd.getNextNumber();
  			this.fcorr_mintiles= (int)  gd.getNextNumber();
  			this.fcorr_reloutliers=     gd.getNextNumber();
  			this.fcorr_sigma=           gd.getNextNumber();

  			this.corr_magic_scale=      gd.getNextNumber();
  			this.corr_magic_scale=      gd.getNextNumber();


  			this.show_textures=         gd.getNextBoolean();
  			this.show_textures=         gd.getNextBoolean();
@@ -4240,6 +4305,9 @@ public class EyesisCorrectionParameters {
  			this.taDiffPwr=             gd.getNextNumber();
  			this.taDiffPwr=             gd.getNextNumber();
  			this.taBestPwr=             gd.getNextNumber();
  			this.taBestPwr=             gd.getNextNumber();
  			this.taDiff9Pwr=            gd.getNextNumber();
  			this.taDiff9Pwr=            gd.getNextNumber();
  			this.taColSigma=            gd.getNextNumber();
  			this.taColFraction=         gd.getNextNumber();
  			


  			this.taCostEmpty=           gd.getNextNumber();
  			this.taCostEmpty=           gd.getNextNumber();
  			this.taCostNoLink=          gd.getNextNumber();
  			this.taCostNoLink=          gd.getNextNumber();
@@ -4335,6 +4403,8 @@ public class EyesisCorrectionParameters {
  	  		gd.addNumericField("Strength power when calculating disparity error",                                 this.taDiffPwr, 6);
  	  		gd.addNumericField("Strength power when calculating disparity error",                                 this.taDiffPwr, 6);
  	  		gd.addNumericField("Strength power when calculating disparity error over best",                       this.taBestPwr, 6);
  	  		gd.addNumericField("Strength power when calculating disparity error over best",                       this.taBestPwr, 6);
  	  		gd.addNumericField("Strength power when calculating disparity error for group of 9",                  this.taDiff9Pwr, 6);
  	  		gd.addNumericField("Strength power when calculating disparity error for group of 9",                  this.taDiff9Pwr, 6);
  			gd.addNumericField("Gaussian sigma to blur color difference between tiles along each direction",      this.taColSigma, 6);
  			gd.addNumericField("Relative amount of the blurred color difference in the mixture",                  this.taColFraction, 6);


  			gd.addNumericField("Cost of a tile that is not assigned",                                             this.taCostEmpty,  6);
  			gd.addNumericField("Cost of a tile that is not assigned",                                             this.taCostEmpty,  6);
  			gd.addNumericField("Cost of a tile not having any neighbor in particular direction",                  this.taCostNoLink,  6);
  			gd.addNumericField("Cost of a tile not having any neighbor in particular direction",                  this.taCostNoLink,  6);
@@ -4411,6 +4481,8 @@ public class EyesisCorrectionParameters {
  			this.taDiffPwr=             gd.getNextNumber();
  			this.taDiffPwr=             gd.getNextNumber();
  			this.taBestPwr=             gd.getNextNumber();
  			this.taBestPwr=             gd.getNextNumber();
  			this.taDiff9Pwr=            gd.getNextNumber();
  			this.taDiff9Pwr=            gd.getNextNumber();
  			this.taColSigma=            gd.getNextNumber();
  			this.taColFraction=         gd.getNextNumber();


  			this.taCostEmpty=           gd.getNextNumber();
  			this.taCostEmpty=           gd.getNextNumber();
  			this.taCostNoLink=          gd.getNextNumber();
  			this.taCostNoLink=          gd.getNextNumber();
+93 −32
Original line number Original line Diff line number Diff line
@@ -77,7 +77,9 @@ private Panel panel1,
         panelPostProcessing2,
         panelPostProcessing2,
         panelPostProcessing3,
         panelPostProcessing3,
         panelDct1,
         panelDct1,
         panelClt1;
         panelClt1,
         panelClt2
         ;
   JP46_Reader_camera JP4_INSTANCE=null;
   JP46_Reader_camera JP4_INSTANCE=null;


//   private deBayerScissors debayer_instance;
//   private deBayerScissors debayer_instance;
@@ -368,7 +370,7 @@ private Panel panel1,


		instance = this;
		instance = this;
		addKeyListener(IJ.getInstance());
		addKeyListener(IJ.getInstance());
		int menuRows=4 + (ADVANCED_MODE?4:0) + (MODE_3D?3:0) + (DCT_MODE?2:0);
		int menuRows=4 + (ADVANCED_MODE?4:0) + (MODE_3D?3:0) + (DCT_MODE?3:0);
		setLayout(new GridLayout(menuRows, 1));
		setLayout(new GridLayout(menuRows, 1));


		panel6 = new Panel();
		panel6 = new Panel();
@@ -488,7 +490,7 @@ private Panel panel1,
		if (DCT_MODE) {
		if (DCT_MODE) {
			panelClt1 = new Panel();
			panelClt1 = new Panel();
			panelClt1.setLayout(new GridLayout(1, 0, 5, 5)); // rows, columns, vgap, hgap
			panelClt1.setLayout(new GridLayout(1, 0, 5, 5)); // rows, columns, vgap, hgap
			addButton("Setup CLT parameters",      panelClt1, color_configure);
//			addButton("Setup CLT parameters",      panelClt1, color_configure);
			addButton("Select CLT image",          panelClt1, color_configure);
			addButton("Select CLT image",          panelClt1, color_configure);
			addButton("CLT stack",                 panelClt1, color_process);
			addButton("CLT stack",                 panelClt1, color_process);
			addButton("Select second CLT image",   panelClt1, color_configure);
			addButton("Select second CLT image",   panelClt1, color_configure);
@@ -499,19 +501,48 @@ private Panel panel1,
			addButton("CLT process files",         panelClt1, color_process);
			addButton("CLT process files",         panelClt1, color_process);
			addButton("CLT process sets",          panelClt1, color_process);
			addButton("CLT process sets",          panelClt1, color_process);
			addButton("CLT process quads",         panelClt1, color_process);
			addButton("CLT process quads",         panelClt1, color_process);
			addButton("CLT process corr",          panelClt1, color_conf_process);
//			addButton("CLT process corr",          panelClt1, color_conf_process);
			addButton("CLT disparity scan",        panelClt1, color_conf_process);
//			addButton("CLT disparity scan",        panelClt1, color_conf_process);
			addButton("CLT reset fine corr",       panelClt1, color_stop);
//			addButton("CLT reset fine corr",       panelClt1, color_stop);
			addButton("CLT show fine corr",        panelClt1, color_configure);
//			addButton("CLT show fine corr",        panelClt1, color_configure);
			addButton("CLT apply fine corr",       panelClt1, color_process);
//			addButton("CLT apply fine corr",       panelClt1, color_process);
			addButton("CLT reset 3D",              panelClt1, color_stop);
//			addButton("CLT reset 3D",              panelClt1, color_stop);
			addButton("CLT 3D",                    panelClt1, color_process);
//			addButton("CLT 3D",                    panelClt1, color_process);
			addButton("CLT planes",                panelClt1, color_conf_process);
//			addButton("CLT planes",                panelClt1, color_conf_process);
			addButton("CLT ASSIGN",                panelClt1, color_process);
//			addButton("CLT ASSIGN",                panelClt1, color_process);
			addButton("CLT OUT 3D",                panelClt1, color_process);
//			addButton("CLT OUT 3D",                panelClt1, color_process);
						
						
			add(panelClt1);
			add(panelClt1);
		}
		}
		if (DCT_MODE) {
			panelClt2 = new Panel();
			panelClt2.setLayout(new GridLayout(1, 0, 5, 5)); // rows, columns, vgap, hgap
			addButton("Setup CLT parameters",      panelClt2, color_configure);
//			addButton("Select CLT image",          panelClt2, color_configure);
//			addButton("CLT stack",                 panelClt2, color_process);
//			addButton("Select second CLT image",   panelClt2, color_configure);
//			addButton("CLT correlate",             panelClt2, color_process);
//			addButton("Create CLT kernels",        panelClt2, color_process);
//			addButton("Read CLT kernels",          panelClt2, color_process);
//			addButton("Reset CLT kernels",         panelClt2, color_stop);
//			addButton("CLT process files",         panelClt2, color_process);
//			addButton("CLT process sets",          panelClt2, color_process);
//			addButton("CLT process quads",         panelClt2, color_process);
			addButton("CLT process corr",          panelClt2, color_conf_process);
			addButton("CLT disparity scan",        panelClt2, color_conf_process);
			addButton("CLT reset fine corr",       panelClt2, color_stop);
			addButton("CLT show fine corr",        panelClt2, color_configure);
			addButton("CLT apply fine corr",       panelClt2, color_process);
			addButton("CLT test fine corr",        panelClt2, color_process);
			addButton("CLT process fine corr",     panelClt2, color_conf_process);
			addButton("CLT reset 3D",              panelClt2, color_stop);
			addButton("CLT 3D",                    panelClt2, color_process);
			addButton("CLT planes",                panelClt2, color_conf_process);
			addButton("CLT ASSIGN",                panelClt2, color_process);
			addButton("CLT OUT 3D",                panelClt2, color_process);
						
			add(panelClt2);
		}
		pack();
		pack();


		GUI.center(this);
		GUI.center(this);
@@ -2888,7 +2919,7 @@ private Panel panel1,
    			IJ.showMessage("Warning",msg);
    			IJ.showMessage("Warning",msg);
    			return;
    			return;
    		}
    		}
    		configPath+=Prefs.getFileSeparator()+"autoconfig";
    		configPath+=Prefs.getFileSeparator()+"autoconfig"+Prefs.getFileSeparator()+"autoconfig";
    		try {
    		try {
    			saveTimestampedProperties(
    			saveTimestampedProperties(
    					configPath,      // full path or null
    					configPath,      // full path or null
@@ -3490,7 +3521,7 @@ private Panel panel1,
    			IJ.showMessage("Warning",msg);
    			IJ.showMessage("Warning",msg);
    			return;
    			return;
    		}
    		}
    		configPath+=Prefs.getFileSeparator()+"autoconfig";
    		configPath+=Prefs.getFileSeparator()+"autoconfig"+Prefs.getFileSeparator()+"autoconfig";
    		try {
    		try {
    			saveTimestampedProperties(
    			saveTimestampedProperties(
    					configPath,      // full path or null
    					configPath,      // full path or null
@@ -3556,7 +3587,7 @@ private Panel panel1,
    			IJ.showMessage("Warning",msg);
    			IJ.showMessage("Warning",msg);
    			return;
    			return;
    		}
    		}
    		configPath+=Prefs.getFileSeparator()+"autoconfig";
    		configPath+=Prefs.getFileSeparator()+"autoconfig"+Prefs.getFileSeparator()+"autoconfig";
    		try {
    		try {
    			saveTimestampedProperties(
    			saveTimestampedProperties(
    					configPath,      // full path or null
    					configPath,      // full path or null
@@ -3606,7 +3637,7 @@ private Panel panel1,
    			IJ.showMessage("Warning",msg);
    			IJ.showMessage("Warning",msg);
    			return;
    			return;
    		}
    		}
    		configPath+=Prefs.getFileSeparator()+"autoconfig";
    		configPath+=Prefs.getFileSeparator()+"autoconfig"+Prefs.getFileSeparator()+"autoconfig";
    		try {
    		try {
    			saveTimestampedProperties(
    			saveTimestampedProperties(
    					configPath,      // full path or null
    					configPath,      // full path or null
@@ -4082,7 +4113,7 @@ private Panel panel1,
    			IJ.showMessage("Warning",msg);
    			IJ.showMessage("Warning",msg);
    			return;
    			return;
    		}
    		}
    		configPath+=Prefs.getFileSeparator()+"autoconfig";
    		configPath+=Prefs.getFileSeparator()+"autoconfig"+Prefs.getFileSeparator()+"autoconfig";
    		try {
    		try {
    			saveTimestampedProperties(
    			saveTimestampedProperties(
    					configPath,      // full path or null
    					configPath,      // full path or null
@@ -4132,7 +4163,7 @@ private Panel panel1,
    			IJ.showMessage("Warning",msg);
    			IJ.showMessage("Warning",msg);
    			return;
    			return;
    		}
    		}
    		configPath+=Prefs.getFileSeparator()+"autoconfig";
    		configPath+=Prefs.getFileSeparator()+"autoconfig"+Prefs.getFileSeparator()+"autoconfig";
    		try {
    		try {
    			saveTimestampedProperties(
    			saveTimestampedProperties(
    					configPath,      // full path or null
    					configPath,      // full path or null
@@ -4187,7 +4218,7 @@ private Panel panel1,
    			IJ.showMessage("Warning",msg);
    			IJ.showMessage("Warning",msg);
    			return;
    			return;
    		}
    		}
    		configPath+=Prefs.getFileSeparator()+"autoconfig";
    		configPath+=Prefs.getFileSeparator()+"autoconfig"+Prefs.getFileSeparator()+"autoconfig";
    		try {
    		try {
    			saveTimestampedProperties(
    			saveTimestampedProperties(
    					configPath,      // full path or null
    					configPath,      // full path or null
@@ -4273,7 +4304,7 @@ private Panel panel1,
    			IJ.showMessage("Warning",msg);
    			IJ.showMessage("Warning",msg);
    			return;
    			return;
    		}
    		}
    		configPath+=Prefs.getFileSeparator()+"autoconfig";
    		configPath+=Prefs.getFileSeparator()+"autoconfig"+Prefs.getFileSeparator()+"autoconfig";
    		try {
    		try {
    			saveTimestampedProperties(
    			saveTimestampedProperties(
    					configPath,      // full path or null
    					configPath,      // full path or null
@@ -4368,7 +4399,7 @@ private Panel panel1,
    			IJ.showMessage("Warning",msg);
    			IJ.showMessage("Warning",msg);
    			return;
    			return;
    		}
    		}
    		configPath+=Prefs.getFileSeparator()+"autoconfig";
    		configPath+=Prefs.getFileSeparator()+"autoconfig"+Prefs.getFileSeparator()+"autoconfig";
    		try {
    		try {
    			saveTimestampedProperties(
    			saveTimestampedProperties(
    					configPath,      // full path or null
    					configPath,      // full path or null
@@ -4465,7 +4496,7 @@ private Panel panel1,
    			IJ.showMessage("Warning",msg);
    			IJ.showMessage("Warning",msg);
    			return;
    			return;
    		}
    		}
    		configPath+=Prefs.getFileSeparator()+"autoconfig";
    		configPath+=Prefs.getFileSeparator()+"autoconfig"+Prefs.getFileSeparator()+"autoconfig";
    		try {
    		try {
    			saveTimestampedProperties(
    			saveTimestampedProperties(
    					configPath,      // full path or null
    					configPath,      // full path or null
@@ -4562,6 +4593,24 @@ private Panel panel1,
        QUAD_CLT.show_fine_corr();
        QUAD_CLT.show_fine_corr();
        return;
        return;


    } else if (label.equals("CLT process fine corr") || label.equals("CLT test fine corr")) {
    	boolean dry_run = label.equals("CLT test fine corr");
    	DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
        if (QUAD_CLT == null){
        	QUAD_CLT = new  QuadCLT (
        			PROPERTIES,
        			EYESIS_CORRECTIONS,
        			CORRECTION_PARAMETERS);
        	if (DEBUG_LEVEL > 0){
        		System.out.println("Created new QuadCLT instance, will need to read CLT kernels");
        	}
        }
        QUAD_CLT.process_fine_corr(
        		dry_run, // boolean dry_run
        		CLT_PARAMETERS,
        		DEBUG_LEVEL);
        return;

    } else if (label.equals("CLT disparity scan")) {
    } else if (label.equals("CLT disparity scan")) {
    	DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
    	DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
    	EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
    	EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
@@ -4585,7 +4634,7 @@ private Panel panel1,
    			IJ.showMessage("Warning",msg);
    			IJ.showMessage("Warning",msg);
    			return;
    			return;
    		}
    		}
    		configPath+=Prefs.getFileSeparator()+"autoconfig";
    		configPath+=Prefs.getFileSeparator()+"autoconfig"+Prefs.getFileSeparator()+"autoconfig";
    		try {
    		try {
    			saveTimestampedProperties(
    			saveTimestampedProperties(
    					configPath,      // full path or null
    					configPath,      // full path or null
@@ -4697,7 +4746,7 @@ private Panel panel1,
    			IJ.showMessage("Warning",msg);
    			IJ.showMessage("Warning",msg);
    			return;
    			return;
    		}
    		}
    		configPath+=Prefs.getFileSeparator()+"autoconfig";
    		configPath+=Prefs.getFileSeparator()+"autoconfig"+Prefs.getFileSeparator()+"autoconfig";
    		try {
    		try {
    			saveTimestampedProperties(
    			saveTimestampedProperties(
    					configPath,      // full path or null
    					configPath,      // full path or null
@@ -4823,7 +4872,7 @@ private Panel panel1,
    			IJ.showMessage("Warning",msg);
    			IJ.showMessage("Warning",msg);
    			return;
    			return;
    		}
    		}
    		configPath+=Prefs.getFileSeparator()+"autoconfig";
    		configPath+=Prefs.getFileSeparator()+"autoconfig"+Prefs.getFileSeparator()+"autoconfig";
    		try {
    		try {
    			saveTimestampedProperties(
    			saveTimestampedProperties(
    					configPath,      // full path or null
    					configPath,      // full path or null
@@ -5396,9 +5445,21 @@ private Panel panel1,
     try {
     try {
    	 os = new FileOutputStream(path);
    	 os = new FileOutputStream(path);
     } catch (FileNotFoundException e1) {
     } catch (FileNotFoundException e1) {
    	 // missing config directory
    	 File dir = (new File(path)).getParentFile();
    	 if (!dir.exists()){
    		 dir.mkdirs();
    		 try {
    			 os = new FileOutputStream(path);
    		 } catch (FileNotFoundException e2) {
    			 IJ.showMessage("Error","Failed to create directory "+dir.getName()+" to save configuration file: "+path);
    			 return;
    		 }
    	 } else {
    		 IJ.showMessage("Error","Failed to open configuration file: "+path);
    		 IJ.showMessage("Error","Failed to open configuration file: "+path);
    		 return;
    		 return;
    	 }
    	 }
     }
     if (useXML) {
     if (useXML) {
         try {
         try {
     		properties.storeToXML(os,
     		properties.storeToXML(os,
Loading