Loading src/main/java/Aberration_Calibration.java +80 −4 Original line number Diff line number Diff line Loading @@ -4388,6 +4388,7 @@ if (MORE_BUTTONS) { "",//); //String defaultPath); // AtomicInteger stopRequested this.SYNC_COMMAND.stopRequested); FOCUSING_FIELD.setDebugLevel(DEBUG_LEVEL); FOCUSING_FIELD.setAdjustMode(false); if (PROPERTIES!=null) FOCUSING_FIELD.getProperties("FOCUSING_FIELD.", PROPERTIES); System.out.println("Loaded FocusingField"); if (!FOCUSING_FIELD.configureDataVector("Configure curvature - TODO: fix many settings restored from properties",true,true)) return; Loading Loading @@ -4415,6 +4416,7 @@ if (MORE_BUTTONS) { DEBUG_LEVEL=MASTER_DEBUG_LEVEL; if (FOCUSING_FIELD==null) return; FOCUSING_FIELD.setDebugLevel(DEBUG_LEVEL); FOCUSING_FIELD.setAdjustMode(false); if (!FOCUSING_FIELD.configureDataVector("Re-configure curvature parameters",false,true)) return; FOCUSING_FIELD.setDataVector( true, // calibrate mode Loading Loading @@ -4454,10 +4456,11 @@ if (MORE_BUTTONS) { DEBUG_LEVEL=MASTER_DEBUG_LEVEL; if (FOCUSING_FIELD==null) return; FOCUSING_FIELD.setDebugLevel(DEBUG_LEVEL); FOCUSING_FIELD.setAdjustMode(false); FOCUSING_FIELD.LevenbergMarquardt( null, // measurement true, // open dialog false, // filterZ // false, // filterZ DEBUG_LEVEL); //boolean openDialog, int debugLevel){ return; } Loading Loading @@ -9719,7 +9722,44 @@ if (MORE_BUTTONS) { } if (!allOK) break; // failed } if (focusMeasurementParameters.scanTiltReverse) { if (debugLevel>0) System.out.println("Starting reverse 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("Reverse scanning tilt in X direction, step#"+(numStep+1)+" (of "+ focusMeasurementParameters.scanTiltStepsX+") 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 (this.SYNC_COMMAND.stopRequested.get()>0){ aborted=true; allOK=false; System.out.println("Stop requested, command aborted, returning motors to initial position"); break; } if (!allOK) break; // failed } } } if (allOK && (focusMeasurementParameters.scanTiltStepsY >1 )) { // 0 or 1 STOPS - do not scan double scanStepY=1.0*focusMeasurementParameters.scanTiltRangeY/(focusMeasurementParameters.scanTiltStepsY-1); Loading Loading @@ -9759,9 +9799,45 @@ if (MORE_BUTTONS) { } if (!allOK) break; // failed } if (focusMeasurementParameters.scanTiltReverse) { if (debugLevel>0) System.out.println("Starting reverse 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]+0; if (debugLevel>0) System.out.println("Reverse scanning tilt in Y direction, step#"+(numStep+1)+" (of "+ focusMeasurementParameters.scanTiltStepsY+") 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 (this.SYNC_COMMAND.stopRequested.get()>0){ aborted=true; allOK=false; System.out.println("Stop requested, command aborted, returning motors to initial position"); break; } if (!allOK) break; // failed } } } } if (allOK && focusMeasurementParameters.scanHysteresis && (scanPosLast!=null)){ Loading src/main/java/FocusingField.java +364 −55 File changed.Preview size limit exceeded, changes collapsed. Show changes src/main/java/LensAdjustment.java +17 −0 Original line number Diff line number Diff line Loading @@ -304,6 +304,7 @@ public class LensAdjustment { public int scanHysteresisNumber=5; // number of test points for the Hysteresis measurement public boolean scanTiltEnable=true; // enable scanning tilt public boolean scanTiltReverse=false; // enable scanning tilt in both directions public int scanTiltRangeX=14336; // 4 periods public int scanTiltRangeY=14336; // 4 periods public int scanTiltStepsX=24; Loading Loading @@ -518,6 +519,7 @@ public class LensAdjustment { int scanHysteresisNumber, // number of test points for the Hysteresis measurement boolean scanTiltEnable, //=true; // enable scanning tilt boolean scanTiltReverse, int scanTiltRangeX, //=14336; // 4 periods int scanTiltRangeY, //=14336; // 4 periods int scanTiltStepsX, //=24; Loading Loading @@ -660,6 +662,7 @@ public class LensAdjustment { this.scanHysteresisNumber=scanHysteresisNumber; // number of test points for the Hysteresis measurement this.scanTiltEnable=scanTiltEnable; //=true; // enable scanning tilt this.scanTiltReverse=scanTiltReverse; this.scanTiltRangeX=scanTiltRangeX; //, //=14336; // 4 periods this.scanTiltRangeY=scanTiltRangeY; //, //=14336; // 4 periods this.scanTiltStepsX=scanTiltStepsX; //=24; Loading Loading @@ -803,6 +806,7 @@ public class LensAdjustment { this.scanHysteresisNumber, // number of test points for the Hysteresis measurement this.scanTiltEnable, // enable scanning tilt this.scanTiltReverse, this.scanTiltRangeX, // 4 periods this.scanTiltRangeY, // 4 periods this.scanTiltStepsX, Loading Loading @@ -953,6 +957,8 @@ public class LensAdjustment { properties.setProperty(prefix+"scanHysteresisNumber",this.scanHysteresisNumber+""); properties.setProperty(prefix+"scanTiltEnable",this.scanTiltEnable+""); // enable scanning tilt properties.setProperty(prefix+"scanTiltReverse",this.scanTiltReverse+""); properties.setProperty(prefix+"scanTiltRangeX",this.scanTiltRangeX+""); // 4 periods properties.setProperty(prefix+"scanTiltRangeY",this.scanTiltRangeY+""); // 4 periods properties.setProperty(prefix+"scanTiltStepsX",this.scanTiltStepsX+""); Loading Loading @@ -1207,6 +1213,10 @@ public class LensAdjustment { if (properties.getProperty(prefix+"scanTiltEnable")!=null) this.scanTiltEnable=Boolean.parseBoolean(properties.getProperty(prefix+"scanTiltEnable")); if (properties.getProperty(prefix+"scanTiltReverse")!=null) this.scanTiltReverse=Boolean.parseBoolean(properties.getProperty(prefix+"scanTiltReverse")); if (properties.getProperty(prefix+"scanTiltRangeX")!=null) this.scanTiltRangeX=Integer.parseInt(properties.getProperty(prefix+"scanTiltRangeX")); if (properties.getProperty(prefix+"scanTiltRangeY")!=null) Loading Loading @@ -1353,6 +1363,9 @@ public class LensAdjustment { 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.addCheckbox ("Scan for tilt measurement in both directions", this.scanTiltReverse); 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); Loading @@ -1372,6 +1385,7 @@ public class LensAdjustment { this.scanHysteresisNumber= (int) gd.getNextNumber(); this.scanTiltEnable= gd.getNextBoolean(); this.scanTiltReverse= gd.getNextBoolean(); this.scanTiltRangeX= (int) gd.getNextNumber(); this.scanTiltRangeY= (int) gd.getNextNumber(); this.scanTiltStepsX= (int) gd.getNextNumber(); Loading Loading @@ -1503,6 +1517,8 @@ public class LensAdjustment { 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.addCheckbox ("Scan for tilt measurement in both directions", this.scanTiltReverse); 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); Loading Loading @@ -1667,6 +1683,7 @@ public class LensAdjustment { this.scanHysteresisNumber= (int) gd.getNextNumber(); this.scanTiltEnable= gd.getNextBoolean(); this.scanTiltReverse= gd.getNextBoolean(); this.scanTiltRangeX= (int) gd.getNextNumber(); this.scanTiltRangeY= (int) gd.getNextNumber(); this.scanTiltStepsX= (int) gd.getNextNumber(); Loading Loading
src/main/java/Aberration_Calibration.java +80 −4 Original line number Diff line number Diff line Loading @@ -4388,6 +4388,7 @@ if (MORE_BUTTONS) { "",//); //String defaultPath); // AtomicInteger stopRequested this.SYNC_COMMAND.stopRequested); FOCUSING_FIELD.setDebugLevel(DEBUG_LEVEL); FOCUSING_FIELD.setAdjustMode(false); if (PROPERTIES!=null) FOCUSING_FIELD.getProperties("FOCUSING_FIELD.", PROPERTIES); System.out.println("Loaded FocusingField"); if (!FOCUSING_FIELD.configureDataVector("Configure curvature - TODO: fix many settings restored from properties",true,true)) return; Loading Loading @@ -4415,6 +4416,7 @@ if (MORE_BUTTONS) { DEBUG_LEVEL=MASTER_DEBUG_LEVEL; if (FOCUSING_FIELD==null) return; FOCUSING_FIELD.setDebugLevel(DEBUG_LEVEL); FOCUSING_FIELD.setAdjustMode(false); if (!FOCUSING_FIELD.configureDataVector("Re-configure curvature parameters",false,true)) return; FOCUSING_FIELD.setDataVector( true, // calibrate mode Loading Loading @@ -4454,10 +4456,11 @@ if (MORE_BUTTONS) { DEBUG_LEVEL=MASTER_DEBUG_LEVEL; if (FOCUSING_FIELD==null) return; FOCUSING_FIELD.setDebugLevel(DEBUG_LEVEL); FOCUSING_FIELD.setAdjustMode(false); FOCUSING_FIELD.LevenbergMarquardt( null, // measurement true, // open dialog false, // filterZ // false, // filterZ DEBUG_LEVEL); //boolean openDialog, int debugLevel){ return; } Loading Loading @@ -9719,7 +9722,44 @@ if (MORE_BUTTONS) { } if (!allOK) break; // failed } if (focusMeasurementParameters.scanTiltReverse) { if (debugLevel>0) System.out.println("Starting reverse 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("Reverse scanning tilt in X direction, step#"+(numStep+1)+" (of "+ focusMeasurementParameters.scanTiltStepsX+") 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 (this.SYNC_COMMAND.stopRequested.get()>0){ aborted=true; allOK=false; System.out.println("Stop requested, command aborted, returning motors to initial position"); break; } if (!allOK) break; // failed } } } if (allOK && (focusMeasurementParameters.scanTiltStepsY >1 )) { // 0 or 1 STOPS - do not scan double scanStepY=1.0*focusMeasurementParameters.scanTiltRangeY/(focusMeasurementParameters.scanTiltStepsY-1); Loading Loading @@ -9759,9 +9799,45 @@ if (MORE_BUTTONS) { } if (!allOK) break; // failed } if (focusMeasurementParameters.scanTiltReverse) { if (debugLevel>0) System.out.println("Starting reverse 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]+0; if (debugLevel>0) System.out.println("Reverse scanning tilt in Y direction, step#"+(numStep+1)+" (of "+ focusMeasurementParameters.scanTiltStepsY+") 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 (this.SYNC_COMMAND.stopRequested.get()>0){ aborted=true; allOK=false; System.out.println("Stop requested, command aborted, returning motors to initial position"); break; } if (!allOK) break; // failed } } } } if (allOK && focusMeasurementParameters.scanHysteresis && (scanPosLast!=null)){ Loading
src/main/java/FocusingField.java +364 −55 File changed.Preview size limit exceeded, changes collapsed. Show changes
src/main/java/LensAdjustment.java +17 −0 Original line number Diff line number Diff line Loading @@ -304,6 +304,7 @@ public class LensAdjustment { public int scanHysteresisNumber=5; // number of test points for the Hysteresis measurement public boolean scanTiltEnable=true; // enable scanning tilt public boolean scanTiltReverse=false; // enable scanning tilt in both directions public int scanTiltRangeX=14336; // 4 periods public int scanTiltRangeY=14336; // 4 periods public int scanTiltStepsX=24; Loading Loading @@ -518,6 +519,7 @@ public class LensAdjustment { int scanHysteresisNumber, // number of test points for the Hysteresis measurement boolean scanTiltEnable, //=true; // enable scanning tilt boolean scanTiltReverse, int scanTiltRangeX, //=14336; // 4 periods int scanTiltRangeY, //=14336; // 4 periods int scanTiltStepsX, //=24; Loading Loading @@ -660,6 +662,7 @@ public class LensAdjustment { this.scanHysteresisNumber=scanHysteresisNumber; // number of test points for the Hysteresis measurement this.scanTiltEnable=scanTiltEnable; //=true; // enable scanning tilt this.scanTiltReverse=scanTiltReverse; this.scanTiltRangeX=scanTiltRangeX; //, //=14336; // 4 periods this.scanTiltRangeY=scanTiltRangeY; //, //=14336; // 4 periods this.scanTiltStepsX=scanTiltStepsX; //=24; Loading Loading @@ -803,6 +806,7 @@ public class LensAdjustment { this.scanHysteresisNumber, // number of test points for the Hysteresis measurement this.scanTiltEnable, // enable scanning tilt this.scanTiltReverse, this.scanTiltRangeX, // 4 periods this.scanTiltRangeY, // 4 periods this.scanTiltStepsX, Loading Loading @@ -953,6 +957,8 @@ public class LensAdjustment { properties.setProperty(prefix+"scanHysteresisNumber",this.scanHysteresisNumber+""); properties.setProperty(prefix+"scanTiltEnable",this.scanTiltEnable+""); // enable scanning tilt properties.setProperty(prefix+"scanTiltReverse",this.scanTiltReverse+""); properties.setProperty(prefix+"scanTiltRangeX",this.scanTiltRangeX+""); // 4 periods properties.setProperty(prefix+"scanTiltRangeY",this.scanTiltRangeY+""); // 4 periods properties.setProperty(prefix+"scanTiltStepsX",this.scanTiltStepsX+""); Loading Loading @@ -1207,6 +1213,10 @@ public class LensAdjustment { if (properties.getProperty(prefix+"scanTiltEnable")!=null) this.scanTiltEnable=Boolean.parseBoolean(properties.getProperty(prefix+"scanTiltEnable")); if (properties.getProperty(prefix+"scanTiltReverse")!=null) this.scanTiltReverse=Boolean.parseBoolean(properties.getProperty(prefix+"scanTiltReverse")); if (properties.getProperty(prefix+"scanTiltRangeX")!=null) this.scanTiltRangeX=Integer.parseInt(properties.getProperty(prefix+"scanTiltRangeX")); if (properties.getProperty(prefix+"scanTiltRangeY")!=null) Loading Loading @@ -1353,6 +1363,9 @@ public class LensAdjustment { 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.addCheckbox ("Scan for tilt measurement in both directions", this.scanTiltReverse); 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); Loading @@ -1372,6 +1385,7 @@ public class LensAdjustment { this.scanHysteresisNumber= (int) gd.getNextNumber(); this.scanTiltEnable= gd.getNextBoolean(); this.scanTiltReverse= gd.getNextBoolean(); this.scanTiltRangeX= (int) gd.getNextNumber(); this.scanTiltRangeY= (int) gd.getNextNumber(); this.scanTiltStepsX= (int) gd.getNextNumber(); Loading Loading @@ -1503,6 +1517,8 @@ public class LensAdjustment { 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.addCheckbox ("Scan for tilt measurement in both directions", this.scanTiltReverse); 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); Loading Loading @@ -1667,6 +1683,7 @@ public class LensAdjustment { this.scanHysteresisNumber= (int) gd.getNextNumber(); this.scanTiltEnable= gd.getNextBoolean(); this.scanTiltReverse= gd.getNextBoolean(); this.scanTiltRangeX= (int) gd.getNextNumber(); this.scanTiltRangeY= (int) gd.getNextNumber(); this.scanTiltStepsX= (int) gd.getNextNumber(); Loading