Commit 5f0e3426 authored by Andrey Filippov's avatar Andrey Filippov

more on 2-sensor focusing machine

parent 76bf54e4
...@@ -374,10 +374,10 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi ...@@ -374,10 +374,10 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
public static PatternParameters PATTERN_PARAMETERS=new PatternParameters( public static PatternParameters PATTERN_PARAMETERS=new PatternParameters(
viewMap, viewMap,
1, // initial number of stations 1, // initial number of stations
3022.6, // double patternWidth; // pattern full width in mm 7010.0, //3022.6, // double patternWidth; // pattern full width in mm
2667.0, // double patternHeight; // pattern full height in mm 3073.0, //2667.0, // double patternHeight; // pattern full height in mm
41.6667, // patternHalfPeriod; // distance between opposite sign nodes 41.570, //41.6667, // patternHalfPeriod; // distance between opposite sign nodes
5.0 // double patternTilt; // pattern tilt (degrees) - U clockwise from X-right (V clockwise from Y-down) 5.0 // double patternTilt; // pattern tilt (degrees) - U clockwise from X-right (V clockwise from Y-down)
); );
// public static LensDistortionParameters LENS_DISTORTION_PARAMETERS=new LensDistortionParameters( // public static LensDistortionParameters LENS_DISTORTION_PARAMETERS=new LensDistortionParameters(
...@@ -450,10 +450,16 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi ...@@ -450,10 +450,16 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
// {-27.5,35.5}, // bottom left // {-27.5,35.5}, // bottom left
// {32.5,29.5}}; // bottom right // {32.5,29.5}}; // bottom right
// settings for the office wall // settings for the office wall
{-30.5,-20.5}, // top left // {-30.5,-20.5}, // top left
{26.5,-25.5}, // top right // {26.5,-25.5}, // top right
// {-27.5,26.5}, // bottom left
// {32.5,20.5}}; // bottom right
{-32.5,-20.5}, // top left
{30.5,-25.5}, // top right
{-27.5,26.5}, // bottom left {-27.5,26.5}, // bottom left
{32.5,20.5}}; // bottom right {32.5,20.5}}; // bottom right
public static MatchSimulatedPattern.LaserPointer LASER_POINTERS= new MatchSimulatedPattern.LaserPointer ( public static MatchSimulatedPattern.LaserPointer LASER_POINTERS= new MatchSimulatedPattern.LaserPointer (
1.06, // public double headLasersTilt= 1.06; // degrees, right laser lower than left laser 1.06, // public double headLasersTilt= 1.06; // degrees, right laser lower than left laser
0.05, // minimalIntensity 0.05, // minimalIntensity
...@@ -470,7 +476,7 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi ...@@ -470,7 +476,7 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
0.6, // double greenFloor; // when dividing by green, add this fraction of maximal value (decrease green accordingly) 0.6, // double greenFloor; // when dividing by green, add this fraction of maximal value (decrease green accordingly)
true, // boolean useOther=false; // when true - use red and other color, when false - only red true, // boolean useOther=false; // when true - use red and other color, when false - only red
true, // boolean otherGreen=true; // other color is green (false - blue) true, // boolean otherGreen=true; // other color is green (false - blue)
0.1, // public double threshold; 0.5, // public double threshold;
false, // public boolean swapUV; // first false, // public boolean swapUV; // first
false, // public boolean flipU; false, // public boolean flipU;
false, // public boolean flipV; false, // public boolean flipV;
...@@ -792,7 +798,7 @@ if (MORE_BUTTONS) { ...@@ -792,7 +798,7 @@ if (MORE_BUTTONS) {
// if (MORE_BUTTONS) { // if (MORE_BUTTONS) {
addButton("Find Grid",panelFocusing,color_process); addButton("Find Grid",panelFocusing,color_process);
// } // }
addButton("Select WOI",panelFocusing,color_lenses); // addButton("Select WOI",panelFocusing,color_lenses); // will not be used - now WOI is run-time calcualted according to specified center
addButton("Reset Histories",panelFocusing,color_lenses); addButton("Reset Histories",panelFocusing,color_lenses);
addButton("Motors Home",panelFocusing,color_lenses); addButton("Motors Home",panelFocusing,color_lenses);
addButton("Auto Pre-focus",panelFocusing,color_process); addButton("Auto Pre-focus",panelFocusing,color_process);
...@@ -2652,7 +2658,8 @@ if (MORE_BUTTONS) { ...@@ -2652,7 +2658,8 @@ if (MORE_BUTTONS) {
checkSerialAndRestore(); // returns true if did not change or was restored checkSerialAndRestore(); // returns true if did not change or was restored
long startTime=System.nanoTime(); long startTime=System.nanoTime();
if (!FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured) { if (!FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured) {
if (CAMERAS.showDialog("Configure cameras interface", 1, true)){ // if (CAMERAS.showDialog("Configure cameras interface", 1, true)){
if (CAMERAS.showDialog("Configure cameras interface", FOCUS_MEASUREMENT_PARAMETERS.useExtraSensor?2:1, true)){
FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured=true; FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured=true;
if (!FOCUS_MEASUREMENT_PARAMETERS.getLensSerial()) return; if (!FOCUS_MEASUREMENT_PARAMETERS.getLensSerial()) return;
// reset histories // reset histories
...@@ -2673,6 +2680,22 @@ if (MORE_BUTTONS) { ...@@ -2673,6 +2680,22 @@ if (MORE_BUTTONS) {
IJ.showMessage("Error","Failed to get camera image\nProcess canceled"); IJ.showMessage("Error","Failed to get camera image\nProcess canceled");
return; return;
} }
// Show ROI
System.out.println("ROI="+FOCUS_MEASUREMENT_PARAMETERS.getMargins());
if (FOCUS_MEASUREMENT_PARAMETERS.showROI) imp_sel.setRoi(FOCUS_MEASUREMENT_PARAMETERS.getMargins());
// set all samples
if (FOCUS_MEASUREMENT_PARAMETERS.showSamples) {
int sampleHalfSize=FOCUS_MEASUREMENT_PARAMETERS.sampleSize/2;
double [][][] sampleCoord=FOCUS_MEASUREMENT_PARAMETERS.sampleCoordinates(FOCUS_MEASUREMENT_PARAMETERS.result_PX0,FOCUS_MEASUREMENT_PARAMETERS.result_PY0);
Overlay overlay=new Overlay();
for (int i=0; i<sampleCoord.length; i++) for (int j=0; j<sampleCoord[i].length; j++) {
int xc=(int) Math.round(sampleCoord[i][j][0]);
int yc=(int) Math.round(sampleCoord[i][j][1]);
overlay.add(new Roi(xc-sampleHalfSize,yc-sampleHalfSize,2*sampleHalfSize,2*sampleHalfSize));
}
imp_sel.setOverlay(overlay);
}
imp_sel.show(); imp_sel.show();
imp_sel.updateAndDraw(); imp_sel.updateAndDraw();
if (DEBUG_LEVEL>0) System.out.println("Image acquisition (@"+FOCUS_MEASUREMENT_PARAMETERS.sensorTemperature+"C) done at "+ IJ.d2s(0.000000001*(System.nanoTime()-startTime),3)); if (DEBUG_LEVEL>0) System.out.println("Image acquisition (@"+FOCUS_MEASUREMENT_PARAMETERS.sensorTemperature+"C) done at "+ IJ.d2s(0.000000001*(System.nanoTime()-startTime),3));
...@@ -3378,7 +3401,9 @@ if (MORE_BUTTONS) { ...@@ -3378,7 +3401,9 @@ if (MORE_BUTTONS) {
MOTORS.setDebug(FOCUS_MEASUREMENT_PARAMETERS.motorDebug); MOTORS.setDebug(FOCUS_MEASUREMENT_PARAMETERS.motorDebug);
if (FOCUS_MEASUREMENT_PARAMETERS.configureCamera) { if (FOCUS_MEASUREMENT_PARAMETERS.configureCamera) {
if (CAMERAS.showDialog("Configure cameras interface", 1, true)) FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured=true; if (CAMERAS.showDialog("Configure cameras interface", FOCUS_MEASUREMENT_PARAMETERS.useExtraSensor?2:1, true)) {
FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured=true;
}
} }
return; return;
} }
...@@ -3574,7 +3599,7 @@ if (MORE_BUTTONS) { ...@@ -3574,7 +3599,7 @@ if (MORE_BUTTONS) {
if (label.equals("Focusing Acquire PSF")) { if (label.equals("Focusing Acquire PSF")) {
// FOCUS_MEASUREMENT_PARAMETERS.showDialog("Focus Measurement Parameters"); // FOCUS_MEASUREMENT_PARAMETERS.showDialog("Focus Measurement Parameters");
if (!FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured) { if (!FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured) {
if (CAMERAS.showDialog("Configure cameras interface", 1, true)){ if (CAMERAS.showDialog("Configure cameras interface", FOCUS_MEASUREMENT_PARAMETERS.useExtraSensor?2:1, true)){
FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured=true; FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured=true;
if (!FOCUS_MEASUREMENT_PARAMETERS.getLensSerial()) return; if (!FOCUS_MEASUREMENT_PARAMETERS.getLensSerial()) return;
// IJ.showMessage("Notice","Make sure camera is in TRIG=4 mode, JP4, correct exposure/white balance..."); // IJ.showMessage("Notice","Make sure camera is in TRIG=4 mode, JP4, correct exposure/white balance...");
...@@ -3676,9 +3701,10 @@ if (MORE_BUTTONS) { ...@@ -3676,9 +3701,10 @@ if (MORE_BUTTONS) {
IJ.showMessage("Error","Image with selection is required"); IJ.showMessage("Error","Image with selection is required");
return; return;
} }
Rectangle oldWOI=FOCUS_MEASUREMENT_PARAMETERS.margins; Rectangle oldWOI=FOCUS_MEASUREMENT_PARAMETERS.getMargins();
System.out.println("Old WOI="+oldWOI); System.out.println("Old WOI="+oldWOI);
FOCUS_MEASUREMENT_PARAMETERS.margins=imp_sel.getRoi().getBounds(); System.out.println("Setting WOI is not supported anymore, it is calculated from required center and configured margins jit");
// FOCUS_MEASUREMENT_PARAMETERS.margins=imp_sel.getRoi().getBounds();
return; return;
} }
// addButton("Head Orientation",panelFocusing); // addButton("Head Orientation",panelFocusing);
...@@ -3688,7 +3714,7 @@ if (MORE_BUTTONS) { ...@@ -3688,7 +3714,7 @@ if (MORE_BUTTONS) {
UV_LED_LASERS.debugLevel=DEBUG_LEVEL; UV_LED_LASERS.debugLevel=DEBUG_LEVEL;
UV_LED_LASERS.setParameters(FOCUS_MEASUREMENT_PARAMETERS); UV_LED_LASERS.setParameters(FOCUS_MEASUREMENT_PARAMETERS);
if (!FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured) { if (!FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured) {
if (CAMERAS.showDialog("Configure cameras interface", 1, true)){ if (CAMERAS.showDialog("Configure cameras interface", FOCUS_MEASUREMENT_PARAMETERS.useExtraSensor?2:1, true)){
FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured=true; FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured=true;
if (!FOCUS_MEASUREMENT_PARAMETERS.getLensSerial()) return; if (!FOCUS_MEASUREMENT_PARAMETERS.getLensSerial()) return;
// IJ.showMessage("Notice","Make sure camera is in TRIG=4 mode, JP4, correct exposure/white balance..."); // IJ.showMessage("Notice","Make sure camera is in TRIG=4 mode, JP4, correct exposure/white balance...");
...@@ -3744,7 +3770,7 @@ if (MORE_BUTTONS) { ...@@ -3744,7 +3770,7 @@ if (MORE_BUTTONS) {
boolean findCenter=label.equals("Lens Center"); boolean findCenter=label.equals("Lens Center");
DEBUG_LEVEL=MASTER_DEBUG_LEVEL; DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
if (!FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured) { if (!FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured) {
if (CAMERAS.showDialog("Configure cameras interface", 1, true)){ if (CAMERAS.showDialog("Configure cameras interface", FOCUS_MEASUREMENT_PARAMETERS.useExtraSensor?2:1, true)){
FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured=true; FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured=true;
// IJ.showMessage("Notice","Make sure camera is in TRIG=4 mode, JP4, correct exposure/white balance..."); // IJ.showMessage("Notice","Make sure camera is in TRIG=4 mode, JP4, correct exposure/white balance...");
if (!FOCUS_MEASUREMENT_PARAMETERS.getLensSerial()) return; if (!FOCUS_MEASUREMENT_PARAMETERS.getLensSerial()) return;
...@@ -3801,11 +3827,16 @@ if (MORE_BUTTONS) { ...@@ -3801,11 +3827,16 @@ if (MORE_BUTTONS) {
System.out.println("Failed to locate optical head laser pointers"); System.out.println("Failed to locate optical head laser pointers");
return; return;
} }
if (DEBUG_LEVEL>1){ if ((DEBUG_LEVEL>1) || (headPointers.length <2)){
for (int n=0;n<headPointers.length;n++) if (headPointers[n]!=null){ for (int n=0;n<headPointers.length;n++) if (headPointers[n]!=null){
System.out.println("Head pointer "+n+": X="+IJ.d2s(headPointers[n][0],2)+", Y="+IJ.d2s(headPointers[n][1],2)); System.out.println("Head pointer "+n+": X="+IJ.d2s(headPointers[n][0],2)+", Y="+IJ.d2s(headPointers[n][1],2));
} }
} }
if (headPointers.length<2) {
System.out.println("Failed to locate optical head laser pointers. Needed 2, "+headPointers.length+" got.");
return;
}
if ((headPointers[0]!=null) && (headPointers[1]!=null)){ if ((headPointers[0]!=null) && (headPointers[1]!=null)){
headPointersTilt=180.0/Math.PI*Math.atan2(headPointers[1][1]-headPointers[0][1], headPointers[1][0]-headPointers[0][0])-LASER_POINTERS.headLasersTilt; headPointersTilt=180.0/Math.PI*Math.atan2(headPointers[1][1]-headPointers[0][1], headPointers[1][0]-headPointers[0][0])-LASER_POINTERS.headLasersTilt;
if (DEBUG_LEVEL>0){ if (DEBUG_LEVEL>0){
...@@ -3854,6 +3885,7 @@ if (MORE_BUTTONS) { ...@@ -3854,6 +3885,7 @@ if (MORE_BUTTONS) {
if (DEBUG_LEVEL>0) System.out.println("Matched "+numAbsolutePoints+" laser pointers, grid generated at "+ IJ.d2s(0.000000001*(System.nanoTime()-startTime),3)); if (DEBUG_LEVEL>0) System.out.println("Matched "+numAbsolutePoints+" laser pointers, grid generated at "+ IJ.d2s(0.000000001*(System.nanoTime()-startTime),3));
imp_calibrated[imgCounter] = matchSimulatedPatternSet[imgCounter].getCalibratedPatternAsImage(imp_set[imgCounter],"grid-",numAbsolutePoints); imp_calibrated[imgCounter] = matchSimulatedPatternSet[imgCounter].getCalibratedPatternAsImage(imp_set[imgCounter],"grid-",numAbsolutePoints);
} }
matchSimulatedPattern= matchSimulatedPatternSet[0]; // global matchSimulatedPattern is used for Focus/Tilt LMA and many others
if (FOCUS_MEASUREMENT_PARAMETERS.showAcquiredImages) imp_calibrated[0].show(); // DISTORTION_PROCESS_CONFIGURATION.showGridImages if (FOCUS_MEASUREMENT_PARAMETERS.showAcquiredImages) imp_calibrated[0].show(); // DISTORTION_PROCESS_CONFIGURATION.showGridImages
if (findCenter){ if (findCenter){
// Read required calibration files // Read required calibration files
...@@ -3914,6 +3946,7 @@ if (MORE_BUTTONS) { ...@@ -3914,6 +3946,7 @@ if (MORE_BUTTONS) {
// Calculate Sensor Masks // Calculate Sensor Masks
DISTORTION_CALIBRATION_DATA.debugLevel=DEBUG_LEVEL; DISTORTION_CALIBRATION_DATA.debugLevel=DEBUG_LEVEL;
DISTORTION_CALIBRATION_DATA.updateStatus=UPDATE_STATUS; DISTORTION_CALIBRATION_DATA.updateStatus=UPDATE_STATUS;
DISTORTION_CALIBRATION_DATA.calculateSensorMasks(); DISTORTION_CALIBRATION_DATA.calculateSensorMasks();
if (DEBUG_LEVEL>0) System.out.println("Starting LMA at "+ IJ.d2s(0.000000001*(System.nanoTime()-startTime),3)); if (DEBUG_LEVEL>0) System.out.println("Starting LMA at "+ IJ.d2s(0.000000001*(System.nanoTime()-startTime),3));
...@@ -3932,6 +3965,34 @@ if (MORE_BUTTONS) { ...@@ -3932,6 +3965,34 @@ if (MORE_BUTTONS) {
// Read camera parameters // Read camera parameters
EyesisCameraParameters camPars= EyesisCameraParameters camPars=
LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters; LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData.eyesisCameraParameters;
// boolean enRoundOff=true; // TODO: Move to configurable parameters
// public double [] roundOffMask(int chn, double xCenter, double yCenter){
if (FOCUS_MEASUREMENT_PARAMETERS.enRoundOff) {
if (DEBUG_LEVEL>0) System.out.println("First XC="+camPars.eyesisSubCameras[stationNumber][0].px0+
"\n YC="+camPars.eyesisSubCameras[stationNumber][0].py0);
DISTORTION_CALIBRATION_DATA.roundOffMask(
0, // int chn,
camPars.eyesisSubCameras[stationNumber][0].px0, // double xCenter,
camPars.eyesisSubCameras[stationNumber][0].py0); // double yCenter);
if (DEBUG_LEVEL>0) System.out.println("Starting second LMA at "+ IJ.d2s(0.000000001*(System.nanoTime()-startTime),3));
LENS_DISTORTIONS.seriesNumber= 1; // start from 1; (no need to repeat series 1)
LENS_DISTORTIONS.stopEachStep= false;
LENS_DISTORTIONS.stopEachSeries= false;
// TODO: configure through FOCUS_MEASUREMENT_PARAMETERS
LENS_DISTORTIONS.thresholdFinish=FOCUS_MEASUREMENT_PARAMETERS.thresholdFinish;
LENS_DISTORTIONS.numIterations=FOCUS_MEASUREMENT_PARAMETERS.numIterations;
LENS_DISTORTIONS.LevenbergMarquardt(false); // skip dialog
if (DEBUG_LEVEL>0) System.out.println("Finished second LMA at "+ IJ.d2s(0.000000001*(System.nanoTime()-startTime),3));
if (!FOCUS_MEASUREMENT_PARAMETERS.keepCircularMask) {
DISTORTION_CALIBRATION_DATA.calculateSensorMasks(); // TODO: save/restore original mask for channel 0
if (DEBUG_LEVEL>0) System.out.println("Recalculated sensor masks at "+ IJ.d2s(0.000000001*(System.nanoTime()-startTime),3));
}
}
double threadPitch=0.35; // M1.6 double threadPitch=0.35; // M1.6
double dPx0=camPars.eyesisSubCameras[stationNumber][0].px0-(camPars.sensorWidth/2)-FOCUS_MEASUREMENT_PARAMETERS.centerDeltaX; double dPx0=camPars.eyesisSubCameras[stationNumber][0].px0-(camPars.sensorWidth/2)-FOCUS_MEASUREMENT_PARAMETERS.centerDeltaX;
double dPy0=camPars.eyesisSubCameras[stationNumber][0].py0-(camPars.sensorHeight/2)-FOCUS_MEASUREMENT_PARAMETERS.centerDeltaY; double dPy0=camPars.eyesisSubCameras[stationNumber][0].py0-(camPars.sensorHeight/2)-FOCUS_MEASUREMENT_PARAMETERS.centerDeltaY;
...@@ -4044,7 +4105,7 @@ if (MORE_BUTTONS) { ...@@ -4044,7 +4105,7 @@ if (MORE_BUTTONS) {
boolean autoMove=label.equals("Auto Pre-focus"); boolean autoMove=label.equals("Auto Pre-focus");
DEBUG_LEVEL=MASTER_DEBUG_LEVEL; DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
if (!FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured) { if (!FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured) {
if (CAMERAS.showDialog("Configure cameras interface", 1, true)){ if (CAMERAS.showDialog("Configure cameras interface", FOCUS_MEASUREMENT_PARAMETERS.useExtraSensor?2:1, true)){
FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured=true; FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured=true;
if (!FOCUS_MEASUREMENT_PARAMETERS.getLensSerial()) return; if (!FOCUS_MEASUREMENT_PARAMETERS.getLensSerial()) return;
// IJ.showMessage("Notice","Make sure camera is in TRIG=4 mode, JP4, correct exposure/white balance..."); // IJ.showMessage("Notice","Make sure camera is in TRIG=4 mode, JP4, correct exposure/white balance...");
...@@ -4391,7 +4452,7 @@ if (MORE_BUTTONS) { ...@@ -4391,7 +4452,7 @@ if (MORE_BUTTONS) {
boolean fineFocus=label.equals("Fine Focus"); boolean fineFocus=label.equals("Fine Focus");
DEBUG_LEVEL=MASTER_DEBUG_LEVEL; DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
if (!FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured) { if (!FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured) {
if (CAMERAS.showDialog("Configure cameras interface", 1, true)){ if (CAMERAS.showDialog("Configure cameras interface", FOCUS_MEASUREMENT_PARAMETERS.useExtraSensor?2:1, true)){
FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured=true; FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured=true;
if (!FOCUS_MEASUREMENT_PARAMETERS.getLensSerial()) return; if (!FOCUS_MEASUREMENT_PARAMETERS.getLensSerial()) return;
// IJ.showMessage("Notice","Make sure camera is in TRIG=4 mode, JP4, correct exposure/white balance..."); // IJ.showMessage("Notice","Make sure camera is in TRIG=4 mode, JP4, correct exposure/white balance...");
...@@ -4600,7 +4661,7 @@ if (MORE_BUTTONS) { ...@@ -4600,7 +4661,7 @@ if (MORE_BUTTONS) {
MOTORS.setDebug(FOCUS_MEASUREMENT_PARAMETERS.motorDebug); MOTORS.setDebug(FOCUS_MEASUREMENT_PARAMETERS.motorDebug);
DEBUG_LEVEL=MASTER_DEBUG_LEVEL; DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
if (!FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured) { if (!FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured) {
if (CAMERAS.showDialog("Configure cameras interface", 1, true)){ if (CAMERAS.showDialog("Configure cameras interface", FOCUS_MEASUREMENT_PARAMETERS.useExtraSensor?2:1, true)){
FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured=true; FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured=true;
if (!FOCUS_MEASUREMENT_PARAMETERS.getLensSerial()) return; if (!FOCUS_MEASUREMENT_PARAMETERS.getLensSerial()) return;
// IJ.showMessage("Notice","Make sure camera is in TRIG=4 mode, JP4, correct exposure/white balance..."); // IJ.showMessage("Notice","Make sure camera is in TRIG=4 mode, JP4, correct exposure/white balance...");
...@@ -4954,7 +5015,7 @@ if (MORE_BUTTONS) { ...@@ -4954,7 +5015,7 @@ if (MORE_BUTTONS) {
} }
FOCUSING_FIELD.setDebugLevel(DEBUG_LEVEL); FOCUSING_FIELD.setDebugLevel(DEBUG_LEVEL);
if (!FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured) { if (!FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured) {
if (CAMERAS.showDialog("Configure cameras interface", 1, true)){ if (CAMERAS.showDialog("Configure cameras interface", FOCUS_MEASUREMENT_PARAMETERS.useExtraSensor?2:1, true)){
FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured=true; FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured=true;
if (!FOCUS_MEASUREMENT_PARAMETERS.getLensSerial()) return; if (!FOCUS_MEASUREMENT_PARAMETERS.getLensSerial()) return;
// reset histories // reset histories
...@@ -5411,7 +5472,7 @@ if (MORE_BUTTONS) { ...@@ -5411,7 +5472,7 @@ if (MORE_BUTTONS) {
if (label.equals("No-move measure")) { if (label.equals("No-move measure")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL; DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
if (!FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured) { if (!FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured) {
if (CAMERAS.showDialog("Configure cameras interface", 1, true)){ if (CAMERAS.showDialog("Configure cameras interface", FOCUS_MEASUREMENT_PARAMETERS.useExtraSensor?2:1, true)){
FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured=true; FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured=true;
if (!FOCUS_MEASUREMENT_PARAMETERS.getLensSerial()) return; if (!FOCUS_MEASUREMENT_PARAMETERS.getLensSerial()) return;
// reset histories // reset histories
...@@ -5982,7 +6043,7 @@ if (MORE_BUTTONS) { ...@@ -5982,7 +6043,7 @@ if (MORE_BUTTONS) {
MOTORS.setDebug(FOCUS_MEASUREMENT_PARAMETERS.motorDebug); MOTORS.setDebug(FOCUS_MEASUREMENT_PARAMETERS.motorDebug);
if (FOCUS_MEASUREMENT_PARAMETERS.configureCamera) { if (FOCUS_MEASUREMENT_PARAMETERS.configureCamera) {
if (CAMERAS.showDialog("Configure cameras interface", 1, true)) FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured=true; if (CAMERAS.showDialog("Configure cameras interface", FOCUS_MEASUREMENT_PARAMETERS.useExtraSensor?2:1, true)) FOCUS_MEASUREMENT_PARAMETERS.cameraIsConfigured=true;
} }
*/ */
return; return;
...@@ -10404,7 +10465,7 @@ if (MORE_BUTTONS) { ...@@ -10404,7 +10465,7 @@ if (MORE_BUTTONS) {
if (DEBUG_LEVEL>0) System.out.println("Autolading grid file "+configPaths[2]); if (DEBUG_LEVEL>0) System.out.println("Autolading grid file "+configPaths[2]);
patternParameters.selectAndRestore(true,configPaths[2],dcd.eyesisCameraParameters.numStations); // returns path or null on failure patternParameters.selectAndRestore(true,configPaths[2],dcd.eyesisCameraParameters.numStations); // returns path or null on failure
} }
if (configPaths[3] !=null){ // load sensor if ((configPaths[3] !=null) && (configPaths[3] != "")){ // load sensor
if (distortions.fittingStrategy==null) return false; if (distortions.fittingStrategy==null) return false;
if (DEBUG_LEVEL>0) System.out.println("Autoloading sensor calibration files "+configPaths[3]); if (DEBUG_LEVEL>0) System.out.println("Autoloading sensor calibration files "+configPaths[3]);
distortions.setDistortionFromImageStack( distortions.setDistortionFromImageStack(
...@@ -161,6 +161,8 @@ public class CalibrationHardwareInterface { ...@@ -161,6 +161,8 @@ public class CalibrationHardwareInterface {
private int [][] channelMap1={ // ip index, channel number private int [][] channelMap1={ // ip index, channel number
// {0,-1}}; // negative channel - single camera // {0,-1}}; // negative channel - single camera
{0,0}}; // Try with 0 {0,0}}; // Try with 0
private int [][] channelMap2={ // ip index, channel number
{0,0},{0,1}};
private int [][] channelMap3={ // ip index, channel number private int [][] channelMap3={ // ip index, channel number
// {0,-1}}; // negative channel - single camera // {0,-1}}; // negative channel - single camera
{0,0},{1,0},{2,0}}; {0,0},{1,0},{2,0}};
...@@ -260,9 +262,15 @@ public class CalibrationHardwareInterface { ...@@ -260,9 +262,15 @@ public class CalibrationHardwareInterface {
private void initDefaultMap(int size){ private void initDefaultMap(int size){
this.channelMap=new int [size][]; this.channelMap=new int [size][];
this.flipImages=new boolean[size]; this.flipImages=new boolean[size];
if (size==1) { if (size==1) { // single camera - old lens focusing
this.channelMap[0]=channelMap1[0].clone(); this.channelMap[0]=channelMap1[0].clone();
this.flipImages[0]=true; this.flipImages[0]=true;
} else if (size==2){ // New lens focusing machine
this.channelMap[0]=channelMap2[0].clone();
this.flipImages[0]=true; // main sensor under test
this.channelMap[1]=channelMap2[1].clone();
this.flipImages[1]=false; // extra sensor for location
} else if (size==3){ } else if (size==3){
for (int i=0;i<size;i++){ for (int i=0;i<size;i++){
this.flipImages[i]=false; this.flipImages[i]=false;
...@@ -1829,7 +1837,7 @@ public class CalibrationHardwareInterface { ...@@ -1829,7 +1837,7 @@ public class CalibrationHardwareInterface {
public String [] groups={"heater","fan","light","light1","light2"}; public String [] groups={"heater","fan","light","light1","light2"};
public int debugLevel=1; public int debugLevel=1;
private String powerIP="192.168.0.80"; private String powerIP="192.168.0.80";
private double lightsDelay=5.0; private double lightsDelay=1.0;
private final String urlFormat="http://%s/insteon/index.php?cmd=%s&group=%s&timestamp=%d"; private final String urlFormat="http://%s/insteon/index.php?cmd=%s&group=%s&timestamp=%d";
private final String rootElement="Document"; private final String rootElement="Document";
public boolean powerConrtolEnabled=false; public boolean powerConrtolEnabled=false;
......
...@@ -3123,6 +3123,67 @@ import org.apache.commons.configuration.XMLConfiguration; ...@@ -3123,6 +3123,67 @@ import org.apache.commons.configuration.XMLConfiguration;
} }
return this.sensorMasks; return this.sensorMasks;
} }
/**
* Create round mask inside the actual one, with the provided center. Blur result with the same sigma as original
* @param chn sensor number
* @param xCenter X of the center (before decimation)
* @param yCenter Y of the center (before decimation)
* @return this channel mask, also sets the round mask instead of the original
*/
public double [] roundOffMask(int chn, double xCenter, double yCenter){
int dWidth= (eyesisCameraParameters.sensorWidth -1)/eyesisCameraParameters.decimateMasks+1;
int dHeight= (eyesisCameraParameters.sensorHeight-1)/eyesisCameraParameters.decimateMasks+1;
DoubleGaussianBlur gb=new DoubleGaussianBlur();
int iXC=(int) Math.round(xCenter/eyesisCameraParameters.decimateMasks);
int iYC=(int) Math.round(yCenter/eyesisCameraParameters.decimateMasks);
// int dcW=eyesisCameraParameters.sensorWidth/eyesisCameraParameters.decimateMasks;
// int dcH=eyesisCameraParameters.sensorHeight/eyesisCameraParameters.decimateMasks;
double r0=iXC;
r0 = Math.min(r0, iYC);
r0 = Math.min(r0, dWidth - iXC);
r0 = Math.min(r0, dHeight - iYC);
int ir02=(int) Math.round(r0*r0);
System.out.println("iXC="+iXC);
System.out.println("iYC="+iYC);
System.out.println("initial ir02="+ir02+ "("+Math.sqrt(ir02)+")");
for (int i = 0; i < this.sensorMasks[chn].length; i++) if (this.sensorMasks[chn][i]<0.5) {
int ix = (i % dWidth) - iXC;
int iy = (i / dWidth) - iYC;
int ir2=ix*ix + iy*iy;
if (ir2 < ir02) ir02 = ir2;
}
System.out.println("second ir02="+ir02+ "("+Math.sqrt(ir02)+")");
double [] mask= new double[this.sensorMasks[chn].length];
for (int i = 0; i < mask.length; i++) {
int ix = (i % dWidth) - iXC;
int iy = (i / dWidth) - iYC;
mask[i]=((ix*ix + iy*iy) > ir02)?0.0:1.0;
}
// blur result
double [][] preMask=preCalculateSingleImageMask(chn,
eyesisCameraParameters.decimateMasks,
eyesisCameraParameters.sensorWidth,
eyesisCameraParameters.sensorHeight,
eyesisCameraParameters.shrinkGridForMask);
if (preMask==null) return null; //nothing in this channel
double rAverage=preMask[0][0];
double rAverageNum=preMask[0][1];
if (rAverageNum==0.0) return null; // nothing to blur/process for this channel
rAverage/=rAverageNum; // average distance to the fartherst node from the current
double sigma = eyesisCameraParameters.maskBlurSigma;
if(sigma<0) sigma*=-rAverage;
gb.blurDouble(mask, dWidth, dHeight, sigma/eyesisCameraParameters.decimateMasks, sigma/eyesisCameraParameters.decimateMasks, 0.01);
for (int i=0;i < mask.length;i++){
this.sensorMasks[chn][i] = Math.min(this.sensorMasks[chn][i],mask[i]);
}
return this.sensorMasks[chn];
}
public double [] calculateImageGridMask(int imgNum) { public double [] calculateImageGridMask(int imgNum) {
return calculateImageGridMask( return calculateImageGridMask(
imgNum, imgNum,
......
...@@ -206,7 +206,7 @@ public class LensAdjustment { ...@@ -206,7 +206,7 @@ public class LensAdjustment {
public String resultsSuperDirectory=""; // directory with subdirectories named as serial numbers to stro results public String resultsSuperDirectory=""; // directory with subdirectories named as serial numbers to stro results
public int EEPROM_channel=1; // EEPROM channel to read serial number from public int EEPROM_channel=1; // EEPROM channel to read serial number from
public boolean saveResults=true; // save focusing results public boolean saveResults=true; // save focusing results
public boolean showResults=true; // show focusing (includingh intermediate) results public boolean showResults=true; // show focusing (including intermediate) results
public String serialNumber=""; // camera serial number string public String serialNumber=""; // camera serial number string
public double sensorTemperature=Double.NaN; // last measured sensor temperature public double sensorTemperature=Double.NaN; // last measured sensor temperature
...@@ -238,7 +238,9 @@ public class LensAdjustment { ...@@ -238,7 +238,9 @@ public class LensAdjustment {
public double centerDeltaX=0.0; // required X-difference between lens center and sensor center public double centerDeltaX=0.0; // required X-difference between lens center and sensor center
public double centerDeltaY=0.0; // required Y-difference between lens center and sensor center public double centerDeltaY=0.0; // required Y-difference between lens center and sensor center
// with the seam in the middle - make even # of samples horizontally // with the seam in the middle - make even # of samples horizontally
public Rectangle margins=new Rectangle (100,100,2392,1736) ; // maximal height 1816 (1936-120) // to be made private or removed
// public Rectangle margins=new Rectangle (100,100,2392,1736) ; // maximal height 1816 (1936-120)
private Rectangle margins=new Rectangle (100,100,2392,1736) ; // maximal height 1816 (1936-120)
public int [] numSamples={8,5}; // number of samples in x and y directions public int [] numSamples={8,5}; // number of samples in x and y directions
public int sampleSize=256;// 512; // size of square (2^n), in sensor pixels (twice FFT size) public int sampleSize=256;// 512; // size of square (2^n), in sensor pixels (twice FFT size)
public int numInCenter=(numSamples[0]-2)*(numSamples[1]-2);// 2 - number of "center" samples public int numInCenter=(numSamples[0]-2)*(numSamples[1]-2);// 2 - number of "center" samples
...@@ -249,6 +251,9 @@ public class LensAdjustment { ...@@ -249,6 +251,9 @@ public class LensAdjustment {
public boolean showHistorySamples=true; // show individual samples public boolean showHistorySamples=true; // show individual samples
public boolean showHistorySingleLine=true; // all parameters in a single line (easier to copy to spreadsheet) public boolean showHistorySingleLine=true; // all parameters in a single line (easier to copy to spreadsheet)
public boolean showAcquiredImages=false; public boolean showAcquiredImages=false;
public boolean showROI=false;
public boolean showSamples=true;
public boolean showFittedParameters=true; public boolean showFittedParameters=true;
public boolean useHeadLasers=true; public boolean useHeadLasers=true;
...@@ -384,12 +389,31 @@ public class LensAdjustment { ...@@ -384,12 +389,31 @@ public class LensAdjustment {
public int numIterations= 100; // maximal number of iterations public int numIterations= 100; // maximal number of iterations
public boolean cameraIsConfigured=false; public boolean cameraIsConfigured=false;
public boolean useExtraSensor = true;
public boolean enRoundOff = true; // create round mask to refine lens center position (second LMA run)
public boolean keepCircularMask=false; // keep sensor 0 round mask after running LMA, false - recalculate actual mask
public boolean configureCamera=false; // only valid after dialog public boolean configureCamera=false; // only valid after dialog
public int [] motorPos=null; // will point to public int [] motorPos=null; // will point to
public double [] ampsSeconds={0.0,0.0,0.0,0.0}; // cumulative Amps*seconds (read only, but will be saved/restored) public double [] ampsSeconds={0.0,0.0,0.0,0.0}; // cumulative Amps*seconds (read only, but will be saved/restored)
public int manufacturingState=0; public int manufacturingState=0;
// temporary - will re-calculate according to required lens center
public Rectangle getMargins(){
int iXC = (int) Math.round(centerDeltaX);
int iYC = (int) Math.round(centerDeltaY);
Rectangle margins=new Rectangle(this.margins);
if ((iXC !=0) || (iYC!=0)){
int hw=this.margins.width/2;
int hh=this.margins.height/2;
int ix0=this.margins.x+hw;
int iy0=this.margins.y+hh;
hw += (iXC < 0)?iXC:(-iXC);
hh += (iYC < 0)?iYC:(-iYC);
margins=new Rectangle(ix0+iXC-hw,iy0+iYC-hh,2*hw,2*hh);
}
return margins;
}
public String [] manufacturingStateNames={ public String [] manufacturingStateNames={
"New SFE", "New SFE",
...@@ -494,6 +518,9 @@ public class LensAdjustment { ...@@ -494,6 +518,9 @@ public class LensAdjustment {
boolean showHistorySamples, boolean showHistorySamples,
boolean showHistorySingleLine, // all parameters in a single line (easier to copy to spreadsheet) boolean showHistorySingleLine, // all parameters in a single line (easier to copy to spreadsheet)
boolean showAcquiredImages, boolean showAcquiredImages,
boolean showROI,
boolean showSamples,
boolean showFittedParameters, boolean showFittedParameters,
boolean useHeadLasers, boolean useHeadLasers,
double psf_cutoffEnergy, // disregard pixels outside of this fraction of the total energy double psf_cutoffEnergy, // disregard pixels outside of this fraction of the total energy
...@@ -604,6 +631,9 @@ public class LensAdjustment { ...@@ -604,6 +631,9 @@ public class LensAdjustment {
double thresholdFinish,// (copied from series) stop iterations if 2 last steps had less improvement (but not worsening ) double thresholdFinish,// (copied from series) stop iterations if 2 last steps had less improvement (but not worsening )
int numIterations, // maximal number of iterations int numIterations, // maximal number of iterations
boolean cameraIsConfigured, boolean cameraIsConfigured,
boolean useExtraSensor,
boolean enRoundOff,
boolean keepCircularMask,
int [] motorPos, int [] motorPos,
double [] ampsSeconds, // cumulative Amps*seconds (read only, but will be saved/restored) double [] ampsSeconds, // cumulative Amps*seconds (read only, but will be saved/restored)
double reportTemperature, // temperature to report focal length double reportTemperature, // temperature to report focal length
...@@ -655,6 +685,8 @@ public class LensAdjustment { ...@@ -655,6 +685,8 @@ public class LensAdjustment {
this.showHistorySamples=showHistorySamples; this.showHistorySamples=showHistorySamples;
this.showHistorySingleLine=showHistorySingleLine; // all parameters in a single line (easier to copy to spreadsheet) this.showHistorySingleLine=showHistorySingleLine; // all parameters in a single line (easier to copy to spreadsheet)
this.showAcquiredImages=showAcquiredImages; this.showAcquiredImages=showAcquiredImages;
this.showROI=showROI;
this.showSamples=showSamples;
this.showFittedParameters=showFittedParameters; this.showFittedParameters=showFittedParameters;
this.useHeadLasers=useHeadLasers; this.useHeadLasers=useHeadLasers;
this.psf_cutoffEnergy=psf_cutoffEnergy; this.psf_cutoffEnergy=psf_cutoffEnergy;
...@@ -761,6 +793,9 @@ public class LensAdjustment { ...@@ -761,6 +793,9 @@ public class LensAdjustment {
this.thresholdFinish=thresholdFinish;// (copied from series) stop iterations if 2 last steps had less improvement (but not worsening ) this.thresholdFinish=thresholdFinish;// (copied from series) stop iterations if 2 last steps had less improvement (but not worsening )
this.numIterations=numIterations; // maximal number of iterations this.numIterations=numIterations; // maximal number of iterations
this.cameraIsConfigured=cameraIsConfigured; this.cameraIsConfigured=cameraIsConfigured;
this.useExtraSensor=useExtraSensor;
this.enRoundOff=enRoundOff;
this.keepCircularMask=keepCircularMask;
this.motorPos=motorPos; this.motorPos=motorPos;
this.ampsSeconds=ampsSeconds; // cumulative Amps*seconds (read only, but will be saved/restored) this.ampsSeconds=ampsSeconds; // cumulative Amps*seconds (read only, but will be saved/restored)
this.reportTemperature=reportTemperature; this.reportTemperature=reportTemperature;
...@@ -812,6 +847,8 @@ public class LensAdjustment { ...@@ -812,6 +847,8 @@ public class LensAdjustment {
this.showHistorySamples, this.showHistorySamples,
this.showHistorySingleLine, // all parameters in a single line (easier to copy to spreadsheet) this.showHistorySingleLine, // all parameters in a single line (easier to copy to spreadsheet)
this.showAcquiredImages, this.showAcquiredImages,
this.showROI,
this.showSamples,
this.showFittedParameters, this.showFittedParameters,
this.useHeadLasers, this.useHeadLasers,
this.psf_cutoffEnergy, this.psf_cutoffEnergy,
...@@ -920,6 +957,9 @@ public class LensAdjustment { ...@@ -920,6 +957,9 @@ public class LensAdjustment {
this.thresholdFinish, this.thresholdFinish,
this.numIterations, this.numIterations,
this.cameraIsConfigured, this.cameraIsConfigured,
this.useExtraSensor,
this.enRoundOff,
this.keepCircularMask,
this.motorPos, this.motorPos,
this.ampsSeconds, // cumulative Amps*seconds (read only, but will be saved/restored) this.ampsSeconds, // cumulative Amps*seconds (read only, but will be saved/restored)
this.reportTemperature, this.reportTemperature,
...@@ -977,8 +1017,13 @@ public class LensAdjustment { ...@@ -977,8 +1017,13 @@ public class LensAdjustment {
properties.setProperty(prefix+"showHistorySingleLine",this.showHistorySingleLine+""); properties.setProperty(prefix+"showHistorySingleLine",this.showHistorySingleLine+"");
properties.setProperty(prefix+"showAcquiredImages",this.showAcquiredImages+""); properties.setProperty(prefix+"showAcquiredImages",this.showAcquiredImages+"");
properties.setProperty(prefix+"showROI",this.showROI+"");
properties.setProperty(prefix+"showSamples",this.showSamples+"");
properties.setProperty(prefix+"showFittedParameters",this.showFittedParameters+""); properties.setProperty(prefix+"showFittedParameters",this.showFittedParameters+"");
properties.setProperty(prefix+"useHeadLasers",this.useHeadLasers+""); properties.setProperty(prefix+"useHeadLasers",this.useHeadLasers+"");
properties.setProperty(prefix+"useExtraSensor",this.useExtraSensor+"");
properties.setProperty(prefix+"enRoundOff",this.enRoundOff+"");
properties.setProperty(prefix+"keepCircularMask",this.keepCircularMask+"");
properties.setProperty(prefix+"psf_cutoffEnergy",this.psf_cutoffEnergy+""); properties.setProperty(prefix+"psf_cutoffEnergy",this.psf_cutoffEnergy+"");
properties.setProperty(prefix+"psf_cutoffLevel",this.psf_cutoffLevel+""); properties.setProperty(prefix+"psf_cutoffLevel",this.psf_cutoffLevel+"");
properties.setProperty(prefix+"psf_minArea",this.psf_minArea+""); properties.setProperty(prefix+"psf_minArea",this.psf_minArea+"");
...@@ -1198,10 +1243,21 @@ public class LensAdjustment { ...@@ -1198,10 +1243,21 @@ public class LensAdjustment {
this.showHistorySingleLine=Boolean.parseBoolean(properties.getProperty(prefix+"showHistorySingleLine")); this.showHistorySingleLine=Boolean.parseBoolean(properties.getProperty(prefix+"showHistorySingleLine"));
if (properties.getProperty(prefix+"showAcquiredImages")!=null) if (properties.getProperty(prefix+"showAcquiredImages")!=null)
this.showAcquiredImages=Boolean.parseBoolean(properties.getProperty(prefix+"showAcquiredImages")); this.showAcquiredImages=Boolean.parseBoolean(properties.getProperty(prefix+"showAcquiredImages"));
if (properties.getProperty(prefix+"showROI")!=null)
this.showROI=Boolean.parseBoolean(properties.getProperty(prefix+"showROI"));
if (properties.getProperty(prefix+"showSamples")!=null)
this.showSamples=Boolean.parseBoolean(properties.getProperty(prefix+"showSamples"));
if (properties.getProperty(prefix+"showFittedParameters")!=null) if (properties.getProperty(prefix+"showFittedParameters")!=null)
this.showFittedParameters=Boolean.parseBoolean(properties.getProperty(prefix+"showFittedParameters")); this.showFittedParameters=Boolean.parseBoolean(properties.getProperty(prefix+"showFittedParameters"));
if (properties.getProperty(prefix+"useHeadLasers")!=null) if (properties.getProperty(prefix+"useHeadLasers")!=null)
this.useHeadLasers=Boolean.parseBoolean(properties.getProperty(prefix+"useHeadLasers")); this.useHeadLasers=Boolean.parseBoolean(properties.getProperty(prefix+"useHeadLasers"));
if (properties.getProperty(prefix+"useExtraSensor")!=null)
this.useExtraSensor=Boolean.parseBoolean(properties.getProperty(prefix+"useExtraSensor"));
if (properties.getProperty(prefix+"enRoundOff")!=null)
this.enRoundOff = Boolean.parseBoolean(properties.getProperty(prefix+"enRoundOff"));
if (properties.getProperty(prefix+"keepCircularMask")!=null)
this.keepCircularMask=Boolean.parseBoolean(properties.getProperty(prefix+"keepCircularMask"));
if (properties.getProperty(prefix+"psf_cutoffEnergy")!=null) if (properties.getProperty(prefix+"psf_cutoffEnergy")!=null)
this.psf_cutoffEnergy=Double.parseDouble(properties.getProperty(prefix+"psf_cutoffEnergy")); this.psf_cutoffEnergy=Double.parseDouble(properties.getProperty(prefix+"psf_cutoffEnergy"));
if (properties.getProperty(prefix+"psf_cutoffLevel")!=null) if (properties.getProperty(prefix+"psf_cutoffLevel")!=null)
...@@ -1559,6 +1615,9 @@ public class LensAdjustment { ...@@ -1559,6 +1615,9 @@ public class LensAdjustment {
gd.addCheckbox ("Save SFE focusing results (including intermediate) ", this.saveResults); gd.addCheckbox ("Save SFE focusing results (including intermediate) ", this.saveResults);
gd.addCheckbox ("Show SFE focusing results (including intermediate) ", this.showResults); gd.addCheckbox ("Show SFE focusing results (including intermediate) ", this.showResults);
gd.addCheckbox ("Configure camera", !this.cameraIsConfigured); gd.addCheckbox ("Configure camera", !this.cameraIsConfigured);
gd.addCheckbox ("Use extra sensor for 3d-location of the optical head", this.useExtraSensor);
gd.addCheckbox ("Use circular sensor mask to refine lens center (second LMA run)", this.enRoundOff);
gd.addCheckbox ("Keep circular sensor mask after finding lens center", this.keepCircularMask);
gd.addNumericField("Camera FOV left margin (clear WOI)", this.margins.x, 0,4,"pix"); gd.addNumericField("Camera FOV left margin (clear WOI)", this.margins.x, 0,4,"pix");
gd.addNumericField("Camera FOV top margin (clear WOI)", this.margins.y, 0,4,"pix"); gd.addNumericField("Camera FOV top margin (clear WOI)", this.margins.y, 0,4,"pix");
gd.addNumericField("Camera FOV width (clear WOI)", this.margins.width, 0,4,"pix"); gd.addNumericField("Camera FOV width (clear WOI)", this.margins.width, 0,4,"pix");
...@@ -1573,6 +1632,8 @@ public class LensAdjustment { ...@@ -1573,6 +1632,8 @@ public class LensAdjustment {
gd.addCheckbox ("Show history details for each FOV sample", this.showHistorySamples); gd.addCheckbox ("Show history details for each FOV sample", this.showHistorySamples);
gd.addCheckbox ("Show history details in a single line (for spreadheets)", this.showHistorySingleLine); gd.addCheckbox ("Show history details in a single line (for spreadheets)", this.showHistorySingleLine);
gd.addCheckbox ("Show acquired images", this.showAcquiredImages); // false; gd.addCheckbox ("Show acquired images", this.showAcquiredImages); // false;
gd.addCheckbox ("Mark ROI on \"Quick get&show\"", this.showROI); // false;
gd.addCheckbox ("Mark individual samples on \"Quick get&show\"",this.showSamples); // false;
gd.addCheckbox ("Show LMA fitted parameters", this.showFittedParameters); // true; gd.addCheckbox ("Show LMA fitted parameters", this.showFittedParameters); // true;
gd.addCheckbox ("Use optical head lasers to determine SFE rotation",this.useHeadLasers); // true; gd.addCheckbox ("Use optical head lasers to determine SFE rotation",this.useHeadLasers); // true;
// gd.addCheckbox ("Measure SFE rotation with optical head lasers", this.useHeadLasers); // true; // gd.addCheckbox ("Measure SFE rotation with optical head lasers", this.useHeadLasers); // true;
...@@ -1766,6 +1827,9 @@ public class LensAdjustment { ...@@ -1766,6 +1827,9 @@ public class LensAdjustment {
this.showResults= gd.getNextBoolean(); this.showResults= gd.getNextBoolean();
// this.comment= gd.getNextString().replace(' ','_'); //TODO: - add escape // this.comment= gd.getNextString().replace(' ','_'); //TODO: - add escape
this.configureCamera= gd.getNextBoolean(); this.configureCamera= gd.getNextBoolean();
this.useExtraSensor= gd.getNextBoolean();
this.enRoundOff= gd.getNextBoolean();
this.keepCircularMask= gd.getNextBoolean();
this.margins.x= (int) gd.getNextNumber(); this.margins.x= (int) gd.getNextNumber();
this.margins.y= (int) gd.getNextNumber(); this.margins.y= (int) gd.getNextNumber();
this.margins.width= (int) gd.getNextNumber(); this.margins.width= (int) gd.getNextNumber();
...@@ -1781,6 +1845,8 @@ public class LensAdjustment { ...@@ -1781,6 +1845,8 @@ public class LensAdjustment {
this.showHistorySamples= gd.getNextBoolean(); this.showHistorySamples= gd.getNextBoolean();
this.showHistorySingleLine= gd.getNextBoolean(); this.showHistorySingleLine= gd.getNextBoolean();
this.showAcquiredImages= gd.getNextBoolean(); this.showAcquiredImages= gd.getNextBoolean();
this.showROI= gd.getNextBoolean();
this.showSamples= gd.getNextBoolean();
this.showFittedParameters= gd.getNextBoolean(); this.showFittedParameters= gd.getNextBoolean();
this.useHeadLasers= gd.getNextBoolean(); this.useHeadLasers= gd.getNextBoolean();
this.psf_cutoffEnergy= 0.01*gd.getNextNumber(); this.psf_cutoffEnergy= 0.01*gd.getNextNumber();
...@@ -1904,7 +1970,9 @@ public class LensAdjustment { ...@@ -1904,7 +1970,9 @@ public class LensAdjustment {
double y0){ // lens center on the sensor double y0){ // lens center on the sensor
int ix0=(int) Math.round(x0); int ix0=(int) Math.round(x0);
int iy0=(int) Math.round(y0); int iy0=(int) Math.round(y0);
Rectangle woi=new Rectangle(this.margins);
// Rectangle woi=new Rectangle(this.margins);
Rectangle woi=this.getMargins();
// System.out.println("Selection Rectangle("+woi.x+", "+woi.y+", "+woi.width+", "+woi.height+ ")"); // System.out.println("Selection Rectangle("+woi.x+", "+woi.y+", "+woi.width+", "+woi.height+ ")");
int extra=this.sampleSize+2*(this.numSamples[1]+this.numSamples[0]); int extra=this.sampleSize+2*(this.numSamples[1]+this.numSamples[0]);
if ((this.centerSamples) && if ((this.centerSamples) &&
......
...@@ -888,14 +888,20 @@ import java.util.Properties; ...@@ -888,14 +888,20 @@ import java.util.Properties;
if (nView>=this.photometricByView[station].length){ // OOB 1// NUll pointer - need to run F-field first? (oob1 when grid had less than now if (nView>=this.photometricByView[station].length){ // OOB 1// NUll pointer - need to run F-field first? (oob1 when grid had less than now
nView=this.photometricByView.length-1; nView=this.photometricByView.length-1;
} }
if (index > this.photometricByView[station][nView][0].length){
System.out.println("getXYZMPE ("+u+","+v+","+station+","+channel+")");
System.out.println("this.photometricByView[station][nView][0].length="+this.photometricByView[station][nView][0].length);
System.out.println("index="+index+" vView="+nView);
System.out.println();
}
double [] result= { // null double [] result= { // null
this.gridGeometry[v1][u1][0], this.gridGeometry[v1][u1][0],
this.gridGeometry[v1][u1][1], this.gridGeometry[v1][u1][1],
// this.gridGeometry[v1][u1][2]+((this.stationZCorr!=null)?this.stationZCorr[v1][u1][station]:0.0), // per-station correction // this.gridGeometry[v1][u1][2]+((this.stationZCorr!=null)?this.stationZCorr[v1][u1][station]:0.0), // per-station correction
this.gridGeometry[v1][u1][2]+((this.stationZCorr!=null)?this.stationZCorr[v1][u1][useStation]:0.0), // per-station correction this.gridGeometry[v1][u1][2]+((this.stationZCorr!=null)?this.stationZCorr[v1][u1][useStation]:0.0), // per-station correction
this.gridGeometry[v1][u1][3], this.gridGeometry[v1][u1][3],
this.photometricByView[station][nView][0][index], this.photometricByView[station][nView][0][index], // java.lang.ArrayIndexOutOfBoundsException: 14215
this.photometricByView[station][nView][1][index], this.photometricByView[station][nView][1][index],
this.photometricByView[station][nView][2][index], this.photometricByView[station][nView][2][index],
this.photometricByView[station][nView][3][index], this.photometricByView[station][nView][3][index],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment