Commit 360900bb authored by Andrey Filippov's avatar Andrey Filippov
Browse files

Added scanning for tilt measurement

parent 348b8ec1
Loading
Loading
Loading
Loading
+278 −1
Original line number Diff line number Diff line
@@ -772,6 +772,7 @@ if (MORE_BUTTONS) {
        addButton("Motors Home",panelFocusing,color_lenses);
		addButton("Auto Pre-focus",panelFocusing,color_process);
		addButton("Scan Calib",panelFocusing,color_process);
		
		addButton("Auto Focus/Tilt",panelFocusing,color_process);
//		addButton("List Pre-focus",panelFocusing);
		addButton("Focus Average",panelFocusing,color_report);
@@ -784,6 +785,7 @@ if (MORE_BUTTONS) {
// panelCurvature		
		panelCurvature=new Panel();
		panelCurvature.setLayout(new GridLayout(1, 0, 5, 5));
		addButton("Scan Calib LMA", panelCurvature,color_process);
		addButton("Save History",   panelCurvature,color_debug);
		addButton("Restore History",panelCurvature,color_debug);
		addButton("Modify LMA",     panelCurvature,color_debug);
@@ -3908,6 +3910,8 @@ if (MORE_BUTTONS) {
		if       (label.equals("Scan Calib")) {
			DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
			checkSerialAndRestore(); // returns true if did not change or was restored
			if (FOCUS_MEASUREMENT_PARAMETERS.showScanningSetup("Setup scanning parameters")) return;
			MOTORS.setHysteresis(FOCUS_MEASUREMENT_PARAMETERS.motorHysteresis);
			MOTORS.setDebug(FOCUS_MEASUREMENT_PARAMETERS.motorDebug);
//			int historyFrom=MOTORS.historySize()-1; // before scanning
			int historyFrom=MOTORS.historySize();  // first during scanning (not yet exist)
@@ -3997,6 +4001,76 @@ if (MORE_BUTTONS) {
			saveCurrentConfig();
			return;
		}
/* ======================================================================== */
		if       (label.equals("Scan Calib LMA")) {
			DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
			checkSerialAndRestore(); // returns true if did not change or was restored
			if (FOCUS_MEASUREMENT_PARAMETERS.showScanningSetup("Setup scanning parameters for LMA")) return;
			MOTORS.setHysteresis(FOCUS_MEASUREMENT_PARAMETERS.motorHysteresis);
			MOTORS.setDebug(FOCUS_MEASUREMENT_PARAMETERS.motorDebug);
			double[] range= ScanFocusTilt(
					null, // center at current position
					MOTORS,
					CAMERAS,
					LENS_DISTORTION_PARAMETERS,
					matchSimulatedPattern, // should not bee null
					FOCUS_MEASUREMENT_PARAMETERS,
					PATTERN_DETECT,
					DISTORTION,
					SIMUL,
					COMPONENTS,
					OTF_FILTER,
					PSF_PARS,
					THREADS_MAX,
					UPDATE_STATUS,
					MASTER_DEBUG_LEVEL,
					DISTORTION.loop_debug_level);
			if (range==null ){
				String msg="Scanning failed";
				System.out.println(msg);
				IJ.showMessage(msg);
				return;
			}
			double pX0=FOCUS_MEASUREMENT_PARAMETERS.result_PX0;
			double pY0=FOCUS_MEASUREMENT_PARAMETERS.result_PY0;
			double [][][] sampleCoord=FOCUS_MEASUREMENT_PARAMETERS.sampleCoordinates( //{x,y,r}
					pX0,   // lens center on the sensor
					pY0);
			// set file path
			String path=null;
			String dir=getResultsPath(FOCUS_MEASUREMENT_PARAMETERS);
			File dFile=new File(dir);
			if (!dFile.isDirectory() &&  !dFile.mkdirs()) {
				String msg="Failed to create directory "+dir;
				IJ.showMessage(msg);
				throw new IllegalArgumentException (msg);
			}
			String lensPrefix="";
			if (FOCUS_MEASUREMENT_PARAMETERS.includeLensSerial && (FOCUS_MEASUREMENT_PARAMETERS.lensSerial.length()>0)){
				lensPrefix=String.format("LENS%S-S%02d-",FOCUS_MEASUREMENT_PARAMETERS.lensSerial,FOCUS_MEASUREMENT_PARAMETERS.manufacturingState);
			}
			path=dFile+Prefs.getFileSeparator()+lensPrefix+CAMERAS.getLastTimestampUnderscored()+".history-xml";
			FOCUSING_FIELD= new FocusingField(
					FOCUS_MEASUREMENT_PARAMETERS.serialNumber,
					FOCUS_MEASUREMENT_PARAMETERS.lensSerial, // String lensSerial, // if null - do not add average
					FOCUS_MEASUREMENT_PARAMETERS.comment, // String comment,
					pX0,
					pY0,
					sampleCoord,
					this.SYNC_COMMAND.stopRequested);
			System.out.println("Saving measurement history to "+path);
			MOTORS.addCurrentHistoryToFocusingField(FOCUSING_FIELD);
			FOCUSING_FIELD.saveXML(path);
			
			saveCurrentConfig();
			return;
		}
		
		
		
/* ======================================================================== */
		if       ((label.equals("Manual Focus/Tilt")) || (label.equals("Auto Focus/Tilt"))|| (label.equals("Fine Focus"))) {
			checkSerialAndRestore(); // returns true if did not change or was restored 
@@ -9473,6 +9547,209 @@ if (MORE_BUTTONS) {
	
	// returns {Xmin-1,Xmax+1} - average motors
	
	public double[] ScanFocusTilt(
			//			boolean scanHysteresis, // after scanning forward, go in reverse (different number of steps to measure hysteresis
			int [] centerMotorPos, // null OK
			CalibrationHardwareInterface.FocusingMotors focusingMotors,
			CalibrationHardwareInterface.CamerasInterface camerasInterface,
			Distortions.LensDistortionParameters lensDistortionParameters,
			MatchSimulatedPattern matchSimulatedPattern, // should not bee null
			LensAdjustment.FocusMeasurementParameters focusMeasurementParameters,
			MatchSimulatedPattern.PatternDetectParameters patternDetectParameters,
			MatchSimulatedPattern.DistortionParameters distortionParameters,
			SimulationPattern.SimulParameters  simulParameters,
			EyesisAberrations.ColorComponents colorComponents,
			EyesisAberrations.OTFFilterParameters otfFilterParameters,
			EyesisAberrations.PSFParameters psfParameters,
			int       threadsMax,
			boolean   updateStatus,
			int       debugLevel,
			int       loopDebugLevel){
		if (centerMotorPos==null) centerMotorPos=focusingMotors.readElphel10364Motors().clone();
		boolean allOK=true;
		long 	  startTime=System.nanoTime();
		if (debugLevel>0) System.out.println("Starting scanning focus in the center, number of steps="+ focusMeasurementParameters.scanNumber+
				", of them "+focusMeasurementParameters.scanNumberNegative+" in negative direction"+
				", step size="+focusMeasurementParameters.scanStep);
		int scanNegative=focusMeasurementParameters.scanNumberNegative;
		int scanPositive=focusMeasurementParameters.scanNumber-focusMeasurementParameters.scanNumberNegative-1; // not including zero
		int [] scanPos={
				centerMotorPos[0]-scanNegative * focusMeasurementParameters.scanStep,
				centerMotorPos[1]-scanNegative * focusMeasurementParameters.scanStep,
				centerMotorPos[2]-scanNegative * focusMeasurementParameters.scanStep
		};
		double centerAverage=(centerMotorPos[0]+centerMotorPos[1]+centerMotorPos[2])/3.0;
		double [] range={
				Math.floor(centerAverage- scanNegative * focusMeasurementParameters.scanStep)-1.0,
				Math.ceil(centerAverage+ scanPositive * focusMeasurementParameters.scanStep)+1.0
		};
		int [] scanPosLast=null;
		for (int numStep=0;numStep<focusMeasurementParameters.scanNumber;numStep++){
			if (debugLevel>0) System.out.println("Scanning focus in the center, step#"+(numStep+1)+" (of "+ focusMeasurementParameters.scanNumber+
					") at "+ IJ.d2s(0.000000001*(System.nanoTime()-startTime),3));
			allOK &=moveAndMaybeProbe(
					true,
					scanPos, // null OK
					focusingMotors,
					camerasInterface,
					lensDistortionParameters,
					matchSimulatedPattern, // should not bee null
					focusMeasurementParameters,
					patternDetectParameters,
					distortionParameters,
					simulParameters,
					colorComponents,
					otfFilterParameters,
					psfParameters,
					threadsMax,
					updateStatus,
					debugLevel,
					loopDebugLevel);
			// do not advance position after last measurement
			if (numStep<(focusMeasurementParameters.scanNumber-1)) for (int nm=0;nm<3;nm++) scanPos[nm]+=focusMeasurementParameters.scanStep;
			scanPosLast=scanPos.clone();
			if (!allOK) break; // failed 
		}
		if (focusMeasurementParameters.scanTiltEnable) {
			if (focusMeasurementParameters.scanTiltStepsX >1 ) { // 0 or 1 STOPS - do not scan
				double scanStepX=1.0*focusMeasurementParameters.scanTiltRangeX/(focusMeasurementParameters.scanTiltStepsX-1);
				if (debugLevel>0) System.out.println("Starting scanning tilt in X direction, number of stops="+ focusMeasurementParameters.scanTiltStepsX+
						", step size="+IJ.d2s(scanStepX,0));
				for (int numStep=0;numStep<focusMeasurementParameters.scanTiltStepsX;numStep++){
					int delta=(int) Math.round(focusMeasurementParameters.scanTiltRangeX*
							(1.0*numStep/(focusMeasurementParameters.scanTiltStepsX-1) -0.5));
					scanPos[0]=centerMotorPos[0]-delta;
					scanPos[1]=centerMotorPos[1]-delta;
					scanPos[2]=centerMotorPos[2]+delta;
					if (debugLevel>0) System.out.println("Scanning tilt in X direction, step#"+(numStep+1)+" (of "+
					(focusMeasurementParameters.scanTiltStepsX-1)+") at "+ IJ.d2s(0.000000001*(System.nanoTime()-startTime),3));
					allOK &=moveAndMaybeProbe(
							true,
							scanPos, // null OK
							focusingMotors,
							camerasInterface,
							lensDistortionParameters,
							matchSimulatedPattern, // should not bee null
							focusMeasurementParameters,
							patternDetectParameters,
							distortionParameters,
							simulParameters,
							colorComponents,
							otfFilterParameters,
							psfParameters,
							threadsMax,
							updateStatus,
							debugLevel,
							loopDebugLevel);
					if (!allOK) break; // failed 
				}
			}
			if (focusMeasurementParameters.scanTiltStepsY >1 ) { // 0 or 1 STOPS - do not scan
				double scanStepY=1.0*focusMeasurementParameters.scanTiltRangeY/(focusMeasurementParameters.scanTiltStepsY-1);
				if (debugLevel>0) System.out.println("Starting scanning tilt in Y direction, number of stops="+ focusMeasurementParameters.scanTiltStepsY+
						", step size="+IJ.d2s(scanStepY,0));
				for (int numStep=0;numStep<focusMeasurementParameters.scanTiltStepsY;numStep++){
					int delta=(int) Math.round(focusMeasurementParameters.scanTiltRangeY*
							(1.0*numStep/(focusMeasurementParameters.scanTiltStepsY-1) -0.5));
					scanPos[0]=centerMotorPos[0]-delta;
					scanPos[1]=centerMotorPos[1]-delta;
					scanPos[2]=centerMotorPos[2]+delta;
					if (debugLevel>0) System.out.println("Scanning tilt in Y direction, step#"+(numStep+1)+" (of "+
					(focusMeasurementParameters.scanTiltStepsY-1)+") at "+ IJ.d2s(0.000000001*(System.nanoTime()-startTime),3));
					allOK &=moveAndMaybeProbe(
							true,
							scanPos, // null OK
							focusingMotors,
							camerasInterface,
							lensDistortionParameters,
							matchSimulatedPattern, // should not bee null
							focusMeasurementParameters,
							patternDetectParameters,
							distortionParameters,
							simulParameters,
							colorComponents,
							otfFilterParameters,
							psfParameters,
							threadsMax,
							updateStatus,
							debugLevel,
							loopDebugLevel);
					if (!allOK) break; // failed 
				}
			}
		}
		if (focusMeasurementParameters.scanHysteresis && (scanPosLast!=null)){
			focusingMotors.moveElphel10364Motors( // return to last direct scan position
					true, //boolean wait,
					scanPosLast,
					0.0, //double sleep,
					true, //boolean showStatus,
					"",   //String message,
					false); //focusMeasurementParameters.compensateHysteresis); //boolean hysteresis)
			double hystStep=((double) focusMeasurementParameters.scanStep*(focusMeasurementParameters.scanNumber-1))/focusMeasurementParameters.scanHysteresisNumber; // errors will accumulate, but that's OK
			for (int numStep=0;numStep<focusMeasurementParameters.scanHysteresisNumber;numStep++){
				if (debugLevel>0) System.out.println("Scanning focus in reverse direction for hysteresis estimation, step#"+(numStep+1)+" (of "+ focusMeasurementParameters.scanHysteresisNumber+
						") at "+ IJ.d2s(0.000000001*(System.nanoTime()-startTime),3));
				int [] revPosition=new int[scanPos.length];
				for (int nm=0;nm<3;nm++) revPosition[nm]=scanPosLast[nm]-(int) Math.round(hystStep*(numStep+1));
				allOK &=moveAndMaybeProbe(
						true, // boolean noHysteresis,
						true,
						revPosition, // null OK
						focusingMotors,
						camerasInterface,
						lensDistortionParameters,
						matchSimulatedPattern, // should not bee null
						focusMeasurementParameters,
						patternDetectParameters,
						distortionParameters,
						simulParameters,
						colorComponents,
						otfFilterParameters,
						psfParameters,
						threadsMax,
						updateStatus,
						debugLevel,
						loopDebugLevel);
				if (!allOK) break; // failed 
			}		
		}
		allOK &= moveAndMaybeProbe(
				true,
				centerMotorPos, // null OK
				focusingMotors,
				camerasInterface,
				lensDistortionParameters,
				matchSimulatedPattern, // should not bee null
				focusMeasurementParameters,
				patternDetectParameters,
				distortionParameters,
				simulParameters,
				colorComponents,
				otfFilterParameters,
				psfParameters,
				threadsMax,
				updateStatus,
				debugLevel,
				loopDebugLevel);
		if (debugLevel>0) System.out.println("Scanning focus in the center, number of steps="+ focusMeasurementParameters.scanNumber+
				", step size="+focusMeasurementParameters.scanStep+" finished at "+ IJ.d2s(0.000000001*(System.nanoTime()-startTime),3));
		// focusMeasurementParameters.scanStep	
		// focusMeasurementParameters.scanNumber
		return allOK?range:null;
	}	
	
	
	public double[] ScanFocus(
//			boolean scanHysteresis, // after scanning forward, go in reverse (different number of steps to measure hysteresis
			int [] centerMotorPos, // null OK
+3 −3
Original line number Diff line number Diff line
@@ -1599,8 +1599,8 @@ d_s2/d_x0= 2*delta_x*delta_y^2/r2^2
    	    boolean freq_mode){
    	String [] chnNames={"RS","RT","GS","GT","BS","BT"};

//    	double k=this.fwhm_to_mtf50; //TODO: correct psf fwhm to mtf50 conversion
    	double k=2*Math.log(2.0)/Math.PI*1000;
    	double k=this.fwhm_to_mtf50; //TODO: correct psf fwhm to mtf50 conversion
//    	double k=2*Math.log(2.0)/Math.PI*1000;
//    	String header="Z(um)\tComposite\tRed\tGreen\tBlue";
    	String header="radius(mm)";
    	if (show_z_axial){
@@ -2209,7 +2209,7 @@ d_s2/d_x0= 2*delta_x*delta_y^2/r2^2
		private double [] sampleCorr=null;
		private int [][] sampleCorrChnParIndex=null;
		private boolean [] dflt_sampleCorrSelect= {false,false,false,false}; 
		private double [] dflt_sampleCorrCost=    {0.2,100.0,2.0,1.0};
		private double [] dflt_sampleCorrCost=    {0.2,50.0,1.0,1.0};
		private double dflt_sampleCorrSigma=      1.0; // mm
		private double dflt_sampleCorrPullZero=   0.25; // fraction
		public final String [] channelDescriptions={
+102 −0
Original line number Diff line number Diff line
@@ -303,6 +303,13 @@ public class LensAdjustment {
        public boolean scanHysteresis=true;  // scan both ways
        public int scanHysteresisNumber=5;   // number of test points for the Hysteresis measurement
        
        public boolean scanTiltEnable=true;  // enable scanning tilt
        public int scanTiltRangeX=14336;    // 4 periods
        public int scanTiltRangeY=14336;    // 4 periods
        public int scanTiltStepsX=24;
        public int scanTiltStepsY=24;
        
        
        public int motorHysteresis=300;
        public double measuredHysteresis=0; // actually measured (will be saved/restored)
        public double motorCalm=2; // wait (seconds) after motors reached final position (for the first time) before acquiring image   
@@ -509,6 +516,14 @@ public class LensAdjustment {
                int scanNumberNegative,    // of them negative
                boolean scanHysteresis,  // scan both ways
                int scanHysteresisNumber,   // number of test points for the Hysteresis measurement
                
                boolean scanTiltEnable, //=true;  // enable scanning tilt
                int scanTiltRangeX, //=14336;    // 4 periods
                int scanTiltRangeY, //=14336;    // 4 periods
                int scanTiltStepsX, //=24;
                int scanTiltStepsY, //=24;

                
                int motorHysteresis,
                double measuredHysteresis, // actually measured (will be saved/restored)
                double motorCalm, // wait (seconds) after motors reached final position (for the first time) before acquiring image   
@@ -643,6 +658,13 @@ public class LensAdjustment {
            this.scanNumberNegative=scanNumberNegative;    // of them negative
			this.scanHysteresis=scanHysteresis;       // scan both ways
			this.scanHysteresisNumber=scanHysteresisNumber; // number of test points for the Hysteresis measurement
			
			this.scanTiltEnable=scanTiltEnable; //=true;  // enable scanning tilt
			this.scanTiltRangeX=scanTiltRangeX; //, //=14336;    // 4 periods
			this.scanTiltRangeY=scanTiltRangeY; //, //=14336;    // 4 periods
			this.scanTiltStepsX=scanTiltStepsX; //=24;
			this.scanTiltStepsY=scanTiltStepsY; //=24;
			
			this.motorHysteresis=motorHysteresis;
			this.measuredHysteresis=measuredHysteresis; // actually measured (will be saved/restored)
			this.motorCalm=motorCalm; // wait (seconds) after motors reached final position (for the first time) before acquiring image   
@@ -779,7 +801,14 @@ public class LensAdjustment {
    	            this.scanNumberNegative,    // of them negative
    				this.scanHysteresis,         // scan both ways
    				this.scanHysteresisNumber,   // number of test points for the Hysteresis measurement
    				
    				this.scanTiltEnable,  // enable scanning tilt
    	    		this.scanTiltRangeX,    // 4 periods
    	    		this.scanTiltRangeY,    // 4 periods
    	    		this.scanTiltStepsX,
    	    		this.scanTiltStepsY,
    				this.motorHysteresis,
    				
    				this.measuredHysteresis,     // actually measured (will be saved/restored)
    				this.motorCalm,              // wait (seconds) after motors reached final position (for the first time) before acquiring image   
    				this.linearReductionRatio,   // sensor travel to motors travel (all 3 together), By design it is 4/38~=0.105
@@ -923,6 +952,13 @@ public class LensAdjustment {
			properties.setProperty(prefix+"scanHysteresis",this.scanHysteresis+"");
			properties.setProperty(prefix+"scanHysteresisNumber",this.scanHysteresisNumber+"");
			
			properties.setProperty(prefix+"scanTiltEnable",this.scanTiltEnable+"");  // enable scanning tilt
			properties.setProperty(prefix+"scanTiltRangeX",this.scanTiltRangeX+"");    // 4 periods
			properties.setProperty(prefix+"scanTiltRangeY",this.scanTiltRangeY+"");    // 4 periods
			properties.setProperty(prefix+"scanTiltStepsX",this.scanTiltStepsX+"");
			properties.setProperty(prefix+"scanTiltStepsY",this.scanTiltStepsY+"");
			
			
			properties.setProperty(prefix+"motorHysteresis",this.motorHysteresis+"");
			properties.setProperty(prefix+"measuredHysteresis",this.measuredHysteresis+"");

@@ -1168,6 +1204,18 @@ public class LensAdjustment {
				this.scanHysteresis=Boolean.parseBoolean(properties.getProperty(prefix+"scanHysteresis"));
			if (properties.getProperty(prefix+"scanHysteresisNumber")!=null)
				this.scanHysteresisNumber=Integer.parseInt(properties.getProperty(prefix+"scanHysteresisNumber"));

			if (properties.getProperty(prefix+"scanTiltEnable")!=null)
				this.scanTiltEnable=Boolean.parseBoolean(properties.getProperty(prefix+"scanTiltEnable"));
			if (properties.getProperty(prefix+"scanTiltRangeX")!=null)
				this.scanTiltRangeX=Integer.parseInt(properties.getProperty(prefix+"scanTiltRangeX"));
			if (properties.getProperty(prefix+"scanTiltRangeY")!=null)
				this.scanTiltRangeY=Integer.parseInt(properties.getProperty(prefix+"scanTiltRangeY"));
			if (properties.getProperty(prefix+"scanTiltStepsX")!=null)
				this.scanTiltStepsX=Integer.parseInt(properties.getProperty(prefix+"scanTiltStepsX"));
			if (properties.getProperty(prefix+"scanTiltStepsY")!=null)
				this.scanTiltStepsY=Integer.parseInt(properties.getProperty(prefix+"scanTiltStepsY"));
			
			if (properties.getProperty(prefix+"motorHysteresis")!=null)
				this.motorHysteresis=Integer.parseInt(properties.getProperty(prefix+"motorHysteresis"));
			if (properties.getProperty(prefix+"measuredHysteresis")!=null)
@@ -1294,6 +1342,45 @@ public class LensAdjustment {
				}
			}
		}
// subset of showDialog() - only set parameters realated to scanning		
	   	public boolean showScanningSetup(String title) {
    		GenericDialog gd = new GenericDialog(title);
    		gd.addNumericField("Motor single movement (all 3 motors) in scan focus mode (signed value)",         this.scanStep, 0,7,"motors steps");
    		gd.addNumericField("Number of scan steps during (center) focus scanning",                            this.scanNumber,        0);
    		gd.addNumericField("... of them - in the negative direction (closer lens to sensor)",                this.scanNumberNegative,        0);

    		gd.addCheckbox    ("Scan focus in 2 directions, after the calibration estimate hysteresis (play)",   this.scanHysteresis);
    		gd.addNumericField("Number of scan steps during hysteresis (play) measurement",                      this.scanHysteresisNumber, 0);

    		gd.addCheckbox    ("Scan for tilt measurement (approximately preserving center)",                    this.scanTiltEnable);
    		gd.addNumericField("Full range of scanning motors tilting in X-direction",                           this.scanTiltRangeX, 0,7,"motors steps");
    		gd.addNumericField("Full range of scanning motors tilting in Y-direction",                           this.scanTiltRangeY, 0,7,"motors steps");
    		gd.addNumericField("Number of stops measurements when tilting in X-deirection",                      this.scanTiltStepsX, 0);
    		gd.addNumericField("Number of stops measurements when tilting in Y-deirection",                      this.scanTiltStepsY, 0);
    		gd.addMessage("");
    		gd.addNumericField("Motor anti-hysteresis travel (last measured was "+IJ.d2s(this.measuredHysteresis,0)+")", this.motorHysteresis, 0,7,"motors steps");


    		WindowTools.addScrollBars(gd);
    		gd.showDialog();
    		if (gd.wasCanceled()) return false;

			this.scanStep=             (int) gd.getNextNumber();
			this.scanNumber=           (int) gd.getNextNumber();
            this.scanNumberNegative=   (int) gd.getNextNumber();
			this.scanHysteresis=             gd.getNextBoolean();
			this.scanHysteresisNumber= (int) gd.getNextNumber();

    		this.scanTiltEnable=             gd.getNextBoolean();
    		this.scanTiltRangeX=       (int) gd.getNextNumber();
    		this.scanTiltRangeY=       (int) gd.getNextNumber();
    		this.scanTiltStepsX=       (int) gd.getNextNumber();
    		this.scanTiltStepsY=       (int) gd.getNextNumber();
    		this.compensateHysteresis=       gd.getNextBoolean();
    		return true;
    	}

		
    	public boolean showDialog(String title) { 
    		GenericDialog gd = new GenericDialog(title);
    		//	    		this.serialNumber, // camera serial number string
@@ -1414,6 +1501,13 @@ public class LensAdjustment {
   		
    		gd.addCheckbox    ("Scan focus in 2 directions, after the calibration estimate hysteresis (play)",   this.scanHysteresis);
    		gd.addNumericField("Number of scan steps during hysteresis (play) measurement",                      this.scanHysteresisNumber, 0);

    		gd.addCheckbox    ("Scan for tilt measurement (approximately preserving center)",                    this.scanTiltEnable);
    		gd.addNumericField("Full range of scanning motors tilting in X-direction",                           this.scanTiltRangeX, 0,7,"motors steps");
    		gd.addNumericField("Full range of scanning motors tilting in Y-direction",                           this.scanTiltRangeY, 0,7,"motors steps");
    		gd.addNumericField("Number of stops measurements when tilting in X-deirection",                      this.scanTiltStepsX, 0);
    		gd.addNumericField("Number of stops measurements when tilting in Y-deirection",                      this.scanTiltStepsY, 0);
    		
    		gd.addMessage     ("The following parameters overwrite some defined for aberration measurements in other dialogs");
    		gd.addNumericField("Smallest fraction to subdivide pixels at simulation", this.smallestSubPix, 3,5,"sensor pix");
    		gd.addNumericField("Maximal difference of the pattern value in the corners that triggers subdivision", this.bitmapNonuniforityThreshold, 3);
@@ -1571,6 +1665,14 @@ public class LensAdjustment {
            this.scanNumberNegative=   (int) gd.getNextNumber();
			this.scanHysteresis=             gd.getNextBoolean();
			this.scanHysteresisNumber= (int) gd.getNextNumber();
			
    		this.scanTiltEnable=             gd.getNextBoolean();
    		this.scanTiltRangeX=       (int) gd.getNextNumber();
    		this.scanTiltRangeY=       (int) gd.getNextNumber();
    		this.scanTiltStepsX=       (int) gd.getNextNumber();
    		this.scanTiltStepsY=       (int) gd.getNextNumber();
			
			
    		this.smallestSubPix=             gd.getNextNumber();
    		this.bitmapNonuniforityThreshold=gd.getNextNumber();
    		this.subdiv=               (int) gd.getNextNumber();