Commit 75d7b5e2 authored by Andrey Filippov's avatar Andrey Filippov
Browse files

more controls

parent e12ae0b2
Loading
Loading
Loading
Loading
+14 −3
Original line number Original line Diff line number Diff line
@@ -510,7 +510,8 @@ public class EyesisCorrectionParameters {
    		return true;
    		return true;
    	}
    	}


    	public boolean showCLTDialog(String title) { 
    	public boolean showCLTDialog(String title,
    			CLTParameters clt_parameters) { 
    		GenericDialog gd = new GenericDialog(title);
    		GenericDialog gd = new GenericDialog(title);
    		
    		
    		gd.addCheckbox    ("Save current settings with results",               this.saveSettings);           // 1 
    		gd.addCheckbox    ("Save current settings with results",               this.saveSettings);           // 1 
@@ -551,8 +552,13 @@ public class EyesisCorrectionParameters {
    		gd.addCheckbox    ("Assign tiles to surfaces",                                           this.clt_batch_assign);    // 26
    		gd.addCheckbox    ("Assign tiles to surfaces",                                           this.clt_batch_assign);    // 26
    		gd.addCheckbox    ("Generate 3d output: x3d and/or obj+mtl",                             this.clt_batch_gen3d);     // 27
    		gd.addCheckbox    ("Generate 3d output: x3d and/or obj+mtl",                             this.clt_batch_gen3d);     // 27
    		gd.addCheckbox    ("Generate debug images if a single set is selected",                  this.clt_batch_dbg1);      // 28
    		gd.addCheckbox    ("Generate debug images if a single set is selected",                  this.clt_batch_dbg1);      // 28
    		if (clt_parameters != null) {
    			gd.addMessage     ("============ selected CLT parameters ============");
    			gd.addNumericField("Maximal disparity to try",                                                            clt_parameters.grow_disp_max,  6);
      			gd.addCheckbox    ("Equalize green channel gain of the individual cnannels (bug fix for exposure)",       clt_parameters.gain_equalize);
      			gd.addNumericField("Inverse distance to infinity (misalignment correction)",                              clt_parameters.z_correction,  6);
    		 
    		 
    		
    		}
    		WindowTools.addScrollBars(gd);
    		WindowTools.addScrollBars(gd);
    		gd.showDialog();
    		gd.showDialog();
    		if (gd.wasCanceled()) return false;
    		if (gd.wasCanceled()) return false;
@@ -584,6 +590,11 @@ public class EyesisCorrectionParameters {
    		this.clt_batch_assign=       gd.getNextBoolean(); // 26
    		this.clt_batch_assign=       gd.getNextBoolean(); // 26
    		this.clt_batch_gen3d=        gd.getNextBoolean(); // 27
    		this.clt_batch_gen3d=        gd.getNextBoolean(); // 27
    		this.clt_batch_dbg1=         gd.getNextBoolean(); // 28
    		this.clt_batch_dbg1=         gd.getNextBoolean(); // 28
    		if (clt_parameters != null) {
    			clt_parameters.grow_disp_max = gd.getNextNumber();
    			clt_parameters.gain_equalize = gd.getNextBoolean();
    			clt_parameters.z_correction =  gd.getNextNumber();    			
    		}    		
    		return true;
    		return true;
    	}
    	}
    	
    	
@@ -3947,7 +3958,7 @@ public class EyesisCorrectionParameters {
  			gd.addNumericField("Do not try to correct vignetting smaller than this fraction of max",      this.vignetting_range,  3);
  			gd.addNumericField("Do not try to correct vignetting smaller than this fraction of max",      this.vignetting_range,  3);
  			gd.addNumericField("Kernel step in pixels (has 1 kernel margin on each side)",                this.kernel_step,            0);
  			gd.addNumericField("Kernel step in pixels (has 1 kernel margin on each side)",                this.kernel_step,            0);
  			gd.addNumericField("Nominal (rectilinear) disparity between side of square cameras (pix)",    this.disparity,  3);
  			gd.addNumericField("Nominal (rectilinear) disparity between side of square cameras (pix)",    this.disparity,  3);
  			gd.addNumericField("Inverse distance to infinity (misalignment cortrection)",                 this.z_correction,  6);
  			gd.addNumericField("Inverse distance to infinity (misalignment correction)",                  this.z_correction,  6);
  			gd.addCheckbox    ("Perform correlation",                                                     this.correlate);
  			gd.addCheckbox    ("Perform correlation",                                                     this.correlate);
  			gd.addNumericField("Bitmask of pairs to combine in the composite (top, bottom, left,righth)", this.corr_mask,            0);
  			gd.addNumericField("Bitmask of pairs to combine in the composite (top, bottom, left,righth)", this.corr_mask,            0);
  			gd.addCheckbox    ("Combine correlation with mirrored around disparity direction",            this.corr_sym);
  			gd.addCheckbox    ("Combine correlation with mirrored around disparity direction",            this.corr_sym);
+22 −5
Original line number Original line Diff line number Diff line
@@ -2374,6 +2374,23 @@ public class EyesisCorrections {
			   boolean               png,
			   boolean               png,
			   boolean               show,
			   boolean               show,
			   int                   jpegQuality){//  <0 - keep current, 0 - force Tiff, >0 use for JPEG
			   int                   jpegQuality){//  <0 - keep current, 0 - force Tiff, >0 use for JPEG
		   saveAndShow(
				   imp,
				   path,
				   png,
				   show,
				   jpegQuality,//  <0 - keep current, 0 - force Tiff, >0 use for JPEG
				   this.debugLevel);
	   }
	   
	   
	   void saveAndShow(
			   ImagePlus             imp,
			   String                path,
			   boolean               png,
			   boolean               show,
			   int                   jpegQuality,//  <0 - keep current, 0 - force Tiff, >0 use for JPEG
			   int                   debugLevel){
		   if (path!=null) {
		   if (path!=null) {
			   path+=Prefs.getFileSeparator()+imp.getTitle();
			   path+=Prefs.getFileSeparator()+imp.getTitle();
			   boolean hasAlphaHighByte = false;
			   boolean hasAlphaHighByte = false;
@@ -2389,14 +2406,14 @@ public class EyesisCorrections {
			   
			   
			   if (hasAlphaHighByte){
			   if (hasAlphaHighByte){
				   if (png){
				   if (png){
					   if (this.debugLevel > 0) System.out.println("Saving RGBA result to "+path+".png");
					   if (debugLevel > 0) System.out.println("Saving RGBA result to "+path+".png");
					   (new EyesisTiff()).savePNG_ARGB32(
					   (new EyesisTiff()).savePNG_ARGB32(
							   imp,
							   imp,
							   path+".png"
							   path+".png"
							   );
							   );


				   } else {
				   } else {
					   if (this.debugLevel > 0) System.out.println("Saving RGBA result to "+path+".tiff");
					   if (debugLevel > 0) System.out.println("Saving RGBA result to "+path+".tiff");
					   try {
					   try {
						   (new EyesisTiff()).saveTiffARGB32(
						   (new EyesisTiff()).saveTiffARGB32(
								   imp,
								   imp,
@@ -2415,12 +2432,12 @@ public class EyesisCorrections {
				   }
				   }
				   
				   
			   } else if (((imp.getStackSize()==1)) && (jpegQuality!=0) && ((imp.getFileInfo().fileType== FileInfo.RGB) || (jpegQuality>0))) {
			   } else if (((imp.getStackSize()==1)) && (jpegQuality!=0) && ((imp.getFileInfo().fileType== FileInfo.RGB) || (jpegQuality>0))) {
				   if (this.debugLevel>0) System.out.println("Saving result to "+path+".jpeg");
				   if (debugLevel>0) System.out.println("Saving result to "+path+".jpeg");
				   FileSaver fs=new FileSaver(imp);
				   FileSaver fs=new FileSaver(imp);
				   if (jpegQuality>0) FileSaver.setJpegQuality(jpegQuality);
				   if (jpegQuality>0) FileSaver.setJpegQuality(jpegQuality);
				   fs.saveAsJpeg(path+".jpeg");
				   fs.saveAsJpeg(path+".jpeg");
			   } else {
			   } else {
				   if (this.debugLevel>0) System.out.println("Saving result to "+path+".tiff");
				   if (debugLevel>0) System.out.println("Saving result to "+path+".tiff");
				   FileSaver fs=new FileSaver(imp);
				   FileSaver fs=new FileSaver(imp);
				   // Save as RGBA if it is RGBA
				   // Save as RGBA if it is RGBA
				   int bytesPerPixel = imp.getBytesPerPixel();
				   int bytesPerPixel = imp.getBytesPerPixel();
@@ -2468,7 +2485,7 @@ public class EyesisCorrections {
	 	 
	 	 
	 	  if (path!=null) {
	 	  if (path!=null) {
	 		  path+=Prefs.getFileSeparator()+compositeImage.getTitle();
	 		  path+=Prefs.getFileSeparator()+compositeImage.getTitle();
	 		  if (this.debugLevel>0) System.out.println("Saving result to "+path+".tiff");
	 		  if (debugLevel>0) System.out.println("Saving result to "+path+".tiff");
	 		  FileSaver fs=new FileSaver(compositeImage);
	 		  FileSaver fs=new FileSaver(compositeImage);
	 		  if (compositeImage.getStackSize()>1)  fs.saveAsTiffStack(path+".tiff");
	 		  if (compositeImage.getStackSize()>1)  fs.saveAsTiffStack(path+".tiff");
	 		  else fs.saveAsTiff(path+".tiff");
	 		  else fs.saveAsTiff(path+".tiff");
+1 −1
Original line number Original line Diff line number Diff line
@@ -3671,7 +3671,7 @@ private Panel panel1,
/* ======================================================================== */
/* ======================================================================== */
    } else if (label.equals("Setup CLT Batch parameters")) {
    } else if (label.equals("Setup CLT Batch parameters")) {
        DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
        DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
    	CORRECTION_PARAMETERS.showCLTDialog("CLT Batch parameters");
    	CORRECTION_PARAMETERS.showCLTDialog("CLT Batch parameters",CLT_PARAMETERS);
    	return;
    	return;
        
        
/* ======================================================================== */
/* ======================================================================== */
+2 −1
Original line number Original line Diff line number Diff line
@@ -4020,7 +4020,8 @@ public class QuadCLT {
							  x3d_path,
							  x3d_path,
							  correctionsParameters.png && !clt_parameters.black_back,
							  correctionsParameters.png && !clt_parameters.black_back,
							  !batch_mode && clt_parameters.show_textures,
							  !batch_mode && clt_parameters.show_textures,
							  correctionsParameters.JPEG_quality); // jpegQuality); // jpegQuality){//  <0 - keep current, 0 - force Tiff, >0 use for JPEG
							  correctionsParameters.JPEG_quality, // jpegQuality); // jpegQuality){//  <0 - keep current, 0 - force Tiff, >0 use for JPEG
							  (debugLevel > 0) ? debugLevel : 1); // int debugLevel (print what it saves)
				  }
				  }
			  }
			  }
		  }
		  }