Loading src/main/java/Distortions.java +24 −20 Original line number Original line Diff line number Diff line Loading @@ -2486,7 +2486,8 @@ For each point in the image subCam, subCam, goniometerTilt, // Tilt, goniometerHorizontal goniometerTilt, // Tilt, goniometerHorizontal goniometerAxial, // Axial,goniometerAxial goniometerAxial, // Axial,goniometerAxial -1 // use camera parameters, not imageSet -1, // use camera parameters, not imageSet true // filter border ); ); if (hintGrid==null){ if (hintGrid==null){ String msg="Grid is not visible for subcamera="+subCam+", tilt="+goniometerTilt+", axial="+goniometerAxial; String msg="Grid is not visible for subcamera="+subCam+", tilt="+goniometerTilt+", axial="+goniometerAxial; Loading Loading @@ -2664,7 +2665,8 @@ For each point in the image dcd.gIP[numGridImage].channel, dcd.gIP[numGridImage].channel, goniometerTiltAxial[0], // Tilt, goniometerHorizontal goniometerTiltAxial[0], // Tilt, goniometerHorizontal goniometerTiltAxial[1], // Axial,goniometerAxial goniometerTiltAxial[1], // Axial,goniometerAxial setNumber // -1 or specific image set setNumber, // -1 or specific image set true // filter border ); ); if (global_debug_level>0){ if (global_debug_level>0){ System.out.println("\n**** applyHintedGrids(): processing grid image # "+numGridImage+", path="+dcd.gIP[numGridImage].path); System.out.println("\n**** applyHintedGrids(): processing grid image # "+numGridImage+", path="+dcd.gIP[numGridImage].path); Loading Loading @@ -2859,7 +2861,6 @@ For each point in the image pixels[4][index]=1000.0; pixels[4][index]=1000.0; } } (new showDoubleFloatArrays()).showArrays(pixels, width, height, true, "grid-"+numGridImage, titles); (new showDoubleFloatArrays()).showArrays(pixels, width, height, true, "grid-"+numGridImage, titles); } } public void showGridAndHint(){ public void showGridAndHint(){ GenericDialog gd=new GenericDialog("Show selected grid and/or hint grid"); GenericDialog gd=new GenericDialog("Show selected grid and/or hint grid"); Loading Loading @@ -2903,7 +2904,8 @@ For each point in the image fittingStrategy.distortionCalibrationData.gIP[numGridImage].channel, fittingStrategy.distortionCalibrationData.gIP[numGridImage].channel, goniometerTiltAxial[0], // Tilt, goniometerHorizontal goniometerTiltAxial[0], // Tilt, goniometerHorizontal goniometerTiltAxial[1], // Axial,goniometerAxial goniometerTiltAxial[1], // Axial,goniometerAxial useSetData?fittingStrategy.distortionCalibrationData.gIP[numGridImage].setNumber:-1 (useSetData?fittingStrategy.distortionCalibrationData.gIP[numGridImage].setNumber:-1), true // filter border ); ); showHintGrid(hintGrid,"hint-"+numGridImage); showHintGrid(hintGrid,"hint-"+numGridImage); Loading Loading @@ -3061,7 +3063,8 @@ For each point in the image int subCamera, int subCamera, double goniometerHorizontal, // Tilt double goniometerHorizontal, // Tilt double goniometerAxial, // Axial double goniometerAxial, // Axial int imageSet){ int imageSet, boolean filterBorder){ int debugThreshold=2; int debugThreshold=2; // Get parameter vector (22) for the selected sensor, current Eyesisparameters and specified orientation angles // Get parameter vector (22) for the selected sensor, current Eyesisparameters and specified orientation angles double [] parVector=fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getParametersVector(stationNumber,subCamera); double [] parVector=fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getParametersVector(stationNumber,subCamera); Loading Loading @@ -3139,6 +3142,7 @@ For each point in the image } } } } } } if (filterBorder){ // now filter border nodes // now filter border nodes boolean [] mask= new boolean [patternGeometry.length*patternGeometry[0].length]; boolean [] mask= new boolean [patternGeometry.length*patternGeometry[0].length]; int index=0; int index=0; Loading @@ -3153,7 +3157,7 @@ For each point in the image for (int v=0;v<result.length;v++) for (int u=0;u<result[v].length;u++){ for (int v=0;v<result.length;v++) for (int u=0;u<result[v].length;u++){ if (!mask[index++]) result[v][u]=null; if (!mask[index++]) result[v][u]=null; } } } if (this.debugLevel>debugThreshold){ if (this.debugLevel>debugThreshold){ for (int v=0;v<result.length;v++) for (int u=0;u<result[v].length;u++){ for (int v=0;v<result.length;v++) for (int u=0;u<result[v].length;u++){ int uv=u+v*result[v].length; int uv=u+v*result[v].length; src/main/java/EyesisAberrations.java +32 −4 Original line number Original line Diff line number Diff line Loading @@ -1073,6 +1073,8 @@ public class EyesisAberrations { int debugLevel int debugLevel ){ ){ Distortions.DistortionCalibrationData distortionCalibrationData= distortions.fittingStrategy.distortionCalibrationData; Distortions.DistortionCalibrationData distortionCalibrationData= distortions.fittingStrategy.distortionCalibrationData; boolean partialToReprojected=this.aberrationParameters.partialToReprojected; // this.distortions is set to top level LENS_DISTORTIONS if (distortions==null){ if (distortions==null){ String msg="Distortions instance does not exist, exiting"; String msg="Distortions instance does not exist, exiting"; IJ.showMessage("Error",msg); IJ.showMessage("Error",msg); Loading Loading @@ -1212,7 +1214,7 @@ public class EyesisAberrations { } } // reorder in the ascending channel number order // reorder in the ascending channel number order String [][] files=new String [numFiles][2]; // 0 - source, 1 - result String [][] files=new String [numFiles][2]; // 0 - source, 1 - result int [] fileIndices =new int [numFiles]; // needed to mark bad kernels int [] fileIndices =new int [numFiles]; // needed to mark bad kernels (and also to reference grid parameters to replace extracted) int numListedFiles=0; int numListedFiles=0; int numChannel=0; int numChannel=0; while (numListedFiles<numFiles) { while (numListedFiles<numFiles) { Loading @@ -1239,6 +1241,22 @@ public class EyesisAberrations { int iRetry=0; int iRetry=0; for (iRetry=0;iRetry<MaxRetries;iRetry++){ // is this retry needed? for (iRetry=0;iRetry<MaxRetries;iRetry++){ // is this retry needed? try { try { double [][][] projectedGrid=null; double hintTolerance=0.0; if (partialToReprojected){ // replace px, py with projected values form the grid // this.distortions is set to the global LENS_DISTORTIONS int numGridImage=fileIndices[imgNum]; projectedGrid=distortions.estimateGridOnSensor( // return grid array [v][u][0- x, 1 - y, 2 - u, 3 - v] distortions.fittingStrategy.distortionCalibrationData.getImageStation(numGridImage), // station number, distortions.fittingStrategy.distortionCalibrationData.gIP[numGridImage].channel, // subCamera, Double.NaN, // goniometerHorizontal, - not used Double.NaN, // goniometerAxial, - not used distortions.fittingStrategy.distortionCalibrationData.gIP[numGridImage].getSetNumber(), //imageSet, true); //filterBorder) hintTolerance=5.0; // TODO:set from configurable parameter } int rslt=matchSimulatedPattern.calculateDistortions( int rslt=matchSimulatedPattern.calculateDistortions( distortionParameters, // distortionParameters, // patternDetectParameters, patternDetectParameters, Loading @@ -1247,9 +1265,8 @@ public class EyesisAberrations { imp, imp, null, // LaserPointer laserPointer, // LaserPointer object or null null, // LaserPointer laserPointer, // LaserPointer object or null true, // don't care -removeOutOfGridPointers true, // don't care -removeOutOfGridPointers null, // double [][][] hintGrid, // predicted grid array (or null) projectedGrid, // null, // double [][][] hintGrid, // predicted grid array (or null) 0, // double hintGridTolerance, // allowed mismatch (fraction of period) or 0 - orientation only hintTolerance, // 0, // double hintGridTolerance, // allowed mismatch (fraction of period) or 0 - orientation only threadsMax, threadsMax, updateStatus, updateStatus, debugLevel, debugLevel, Loading @@ -1259,6 +1276,11 @@ public class EyesisAberrations { if (debugLevel>0) System.out.println("calculateDistortions failed, returned error code "+rslt+" iRetry="+iRetry+" (of "+MaxRetries+")"); if (debugLevel>0) System.out.println("calculateDistortions failed, returned error code "+rslt+" iRetry="+iRetry+" (of "+MaxRetries+")"); continue; continue; } } // now replace extracted grid X,Y with projected: if (projectedGrid!=null){ int numReplaced= matchSimulatedPattern.replaceGridXYWithProjected(projectedGrid); if (debugLevel>0) System.out.println("Replaced extracted XY with projected ones for "+numReplaced+" nodes"); } correlationSizesUsed=matchSimulatedPattern.getCorrelationSizesUsed(); correlationSizesUsed=matchSimulatedPattern.getCorrelationSizesUsed(); simArray= (new SimulationPattern(simulParameters)).simulateGridAll ( simArray= (new SimulationPattern(simulParameters)).simulateGridAll ( imp.getWidth(), imp.getWidth(), Loading Loading @@ -4428,6 +4450,7 @@ if (globalDebugLevel>2)globalDebugLevel=0; //*********************************** public boolean autoReCalibrateIgnoreLaser=false; // "Ignore laser pointers on recalibrate" public boolean autoReCalibrateIgnoreLaser=false; // "Ignore laser pointers on recalibrate" public boolean noMessageBoxes=true; public boolean noMessageBoxes=true; public boolean overwriteResultFiles=false; public boolean overwriteResultFiles=false; public boolean partialToReprojected=true; // Use reprojected grid for partial kernel calculation (false - use extracted) public int seriesNumber=0; public int seriesNumber=0; public boolean allImages; public boolean allImages; public String sourcePrefix=""; public String sourcePrefix=""; Loading Loading @@ -4460,6 +4483,8 @@ if (globalDebugLevel>2)globalDebugLevel=0; //*********************************** properties.setProperty(prefix+"autoReCalibrateIgnoreLaser",this.autoReCalibrateIgnoreLaser+""); properties.setProperty(prefix+"autoReCalibrateIgnoreLaser",this.autoReCalibrateIgnoreLaser+""); properties.setProperty(prefix+"noMessageBoxes",this.noMessageBoxes+""); properties.setProperty(prefix+"noMessageBoxes",this.noMessageBoxes+""); properties.setProperty(prefix+"overwriteResultFiles",this.overwriteResultFiles+""); properties.setProperty(prefix+"overwriteResultFiles",this.overwriteResultFiles+""); properties.setProperty(prefix+"partialToReprojected",this.partialToReprojected+""); properties.setProperty(prefix+"seriesNumber",this.seriesNumber+""); properties.setProperty(prefix+"seriesNumber",this.seriesNumber+""); properties.setProperty(prefix+"allImages",this.allImages+""); properties.setProperty(prefix+"allImages",this.allImages+""); Loading Loading @@ -4498,6 +4523,7 @@ if (globalDebugLevel>2)globalDebugLevel=0; //*********************************** if (properties.getProperty(prefix+"autoReCalibrateIgnoreLaser")!=null) this.autoReCalibrateIgnoreLaser=Boolean.parseBoolean(properties.getProperty(prefix+"autoReCalibrateIgnoreLaser")); if (properties.getProperty(prefix+"autoReCalibrateIgnoreLaser")!=null) this.autoReCalibrateIgnoreLaser=Boolean.parseBoolean(properties.getProperty(prefix+"autoReCalibrateIgnoreLaser")); if (properties.getProperty(prefix+"noMessageBoxes")!=null) this.noMessageBoxes=Boolean.parseBoolean(properties.getProperty(prefix+"noMessageBoxes")); if (properties.getProperty(prefix+"noMessageBoxes")!=null) this.noMessageBoxes=Boolean.parseBoolean(properties.getProperty(prefix+"noMessageBoxes")); if (properties.getProperty(prefix+"overwriteResultFiles")!=null) this.overwriteResultFiles=Boolean.parseBoolean(properties.getProperty(prefix+"overwriteResultFiles")); if (properties.getProperty(prefix+"overwriteResultFiles")!=null) this.overwriteResultFiles=Boolean.parseBoolean(properties.getProperty(prefix+"overwriteResultFiles")); if (properties.getProperty(prefix+"partialToReprojected")!=null) this.partialToReprojected=Boolean.parseBoolean(properties.getProperty(prefix+"partialToReprojected")); if (properties.getProperty(prefix+"seriesNumber")!=null) this.seriesNumber=Integer.parseInt(properties.getProperty(prefix+"seriesNumber")); if (properties.getProperty(prefix+"seriesNumber")!=null) this.seriesNumber=Integer.parseInt(properties.getProperty(prefix+"seriesNumber")); if (properties.getProperty(prefix+"allImages")!=null) this.allImages=Boolean.parseBoolean(properties.getProperty(prefix+"allImages")); if (properties.getProperty(prefix+"allImages")!=null) this.allImages=Boolean.parseBoolean(properties.getProperty(prefix+"allImages")); if (properties.getProperty(prefix+"sourcePrefix")!=null) this.sourcePrefix=properties.getProperty(prefix+"sourcePrefix"); if (properties.getProperty(prefix+"sourcePrefix")!=null) this.sourcePrefix=properties.getProperty(prefix+"sourcePrefix"); Loading Loading @@ -4629,6 +4655,7 @@ if (globalDebugLevel>2)globalDebugLevel=0; //*********************************** gd.addCheckbox("Select aberrations kernels directory", false); gd.addCheckbox("Select aberrations kernels directory", false); gd.addCheckbox("Supress non-essential message boxes", this.noMessageBoxes); gd.addCheckbox("Supress non-essential message boxes", this.noMessageBoxes); gd.addCheckbox("Overwrite result files if they exist", this.overwriteResultFiles); gd.addCheckbox("Overwrite result files if they exist", this.overwriteResultFiles); gd.addCheckbox("Use reprojected grids for partial kernel calculation (false - extracted grids)", this.partialToReprojected); gd.addNumericField("Fitting series number to use for image selection", this.seriesNumber,0); gd.addNumericField("Fitting series number to use for image selection", this.seriesNumber,0); gd.addCheckbox("Process all enabled image files (false - use selected fitting series)", this.allImages); gd.addCheckbox("Process all enabled image files (false - use selected fitting series)", this.allImages); gd.addMessage("===== Autoload options (when restoring configuration) ====="); gd.addMessage("===== Autoload options (when restoring configuration) ====="); Loading Loading @@ -4673,6 +4700,7 @@ if (globalDebugLevel>2)globalDebugLevel=0; //*********************************** if (gd.getNextBoolean()) selectAberrationsKernelDirectory(false, this.aberrationsKernelDirectory, false); if (gd.getNextBoolean()) selectAberrationsKernelDirectory(false, this.aberrationsKernelDirectory, false); this.noMessageBoxes= gd.getNextBoolean(); this.noMessageBoxes= gd.getNextBoolean(); this.overwriteResultFiles= gd.getNextBoolean(); this.overwriteResultFiles= gd.getNextBoolean(); this.partialToReprojected= gd.getNextBoolean(); this.seriesNumber= (int) gd.getNextNumber(); this.seriesNumber= (int) gd.getNextNumber(); this.allImages= gd.getNextBoolean(); this.allImages= gd.getNextBoolean(); this.autoRestore= gd.getNextBoolean(); this.autoRestore= gd.getNextBoolean(); Loading src/main/java/Goniometer.java +2 −1 Original line number Original line Diff line number Diff line Loading @@ -598,7 +598,8 @@ horizontal axis: subCam, subCam, goniometerTiltAxial[0], // Tilt, goniometerHorizontal goniometerTiltAxial[0], // Tilt, goniometerHorizontal goniometerTiltAxial[1], // Axial,goniometerAxial goniometerTiltAxial[1], // Axial,goniometerAxial -1 // use camera parameters, not imageSet -1, // use camera parameters, not imageSet true // filter border ); ); if (hintGrid==null){ if (hintGrid==null){ String msg= "Target is not visible"; String msg= "Target is not visible"; Loading src/main/java/MatchSimulatedPattern.java +45 −0 Original line number Original line Diff line number Diff line Loading @@ -6983,6 +6983,51 @@ y=xy0[1] + dU*deltaUV[0]*(xy1[1]-xy0[1])+dV*deltaUV[1]*(xy2[1]-xy0[1]) } } public int replaceGridXYWithProjected(double [][][] projectedGrid){ int minU=0,minV=0,maxU=0,maxV=0; boolean notYetSet=true; for (double [][]row:projectedGrid) for (double [] cell:row) if (cell!=null){ int u = (int) cell[2]; int v = (int) cell[3]; if (notYetSet){ minU=u; maxU=u; minV=v; maxV=v; notYetSet=false; } else { if (minU>u) minU=u; if (maxU<u) maxU=u; if (minV>v) minV=v; if (maxV<v) maxV=v; } } double [][][] grid=new double [maxV-minV+1][maxU-minU+1][]; // for (double [][]row:grid) for (double [] cell:row) cell=null; // See if this works with "enhanced for loop" for (double [][]row:grid) for (int u=0;u<row.length;u++) row[u]=null; // See if this works with "enhanced for loop" for (double [][] row:projectedGrid) for (double [] cell:row) if (cell!=null){ int u = (int) cell[2]; int v = (int) cell[3]; double [] xy={cell[0],cell[1]}; grid[v-minV][u-minU]=xy; } int numNewDefined=0; for (int v=0;v<this.PATTERN_GRID.length;v++) for (int u=0;u<this.PATTERN_GRID[v].length;u++) { double [][] cell=this.PATTERN_GRID[v][u]; if ((cell !=null) && (cell.length>0) &&(cell[0] !=null) && (cell[0].length>1)){ cell[0][0]=grid[this.targetUV[v][u][1]+minV][this.targetUV[v][u][0]+minU][0]; cell[0][1]=grid[this.targetUV[v][u][1]+minV][this.targetUV[v][u][0]+minU][1]; if (Double.isNaN(cell[0][0]) || Double.isNaN(cell[0][1])){ this.PATTERN_GRID[v][u]=null; // make it undefined } else { numNewDefined++; } } } return numNewDefined; } /* Get calibrated pattern as a 8-slice image (can be saved as TIFF) /* Get calibrated pattern as a 8-slice image (can be saved as TIFF) * first slice - pixel X or -1 for undefined * first slice - pixel X or -1 for undefined * second slice - pixel Y or -1 for undefined * second slice - pixel Y or -1 for undefined Loading Loading
src/main/java/Distortions.java +24 −20 Original line number Original line Diff line number Diff line Loading @@ -2486,7 +2486,8 @@ For each point in the image subCam, subCam, goniometerTilt, // Tilt, goniometerHorizontal goniometerTilt, // Tilt, goniometerHorizontal goniometerAxial, // Axial,goniometerAxial goniometerAxial, // Axial,goniometerAxial -1 // use camera parameters, not imageSet -1, // use camera parameters, not imageSet true // filter border ); ); if (hintGrid==null){ if (hintGrid==null){ String msg="Grid is not visible for subcamera="+subCam+", tilt="+goniometerTilt+", axial="+goniometerAxial; String msg="Grid is not visible for subcamera="+subCam+", tilt="+goniometerTilt+", axial="+goniometerAxial; Loading Loading @@ -2664,7 +2665,8 @@ For each point in the image dcd.gIP[numGridImage].channel, dcd.gIP[numGridImage].channel, goniometerTiltAxial[0], // Tilt, goniometerHorizontal goniometerTiltAxial[0], // Tilt, goniometerHorizontal goniometerTiltAxial[1], // Axial,goniometerAxial goniometerTiltAxial[1], // Axial,goniometerAxial setNumber // -1 or specific image set setNumber, // -1 or specific image set true // filter border ); ); if (global_debug_level>0){ if (global_debug_level>0){ System.out.println("\n**** applyHintedGrids(): processing grid image # "+numGridImage+", path="+dcd.gIP[numGridImage].path); System.out.println("\n**** applyHintedGrids(): processing grid image # "+numGridImage+", path="+dcd.gIP[numGridImage].path); Loading Loading @@ -2859,7 +2861,6 @@ For each point in the image pixels[4][index]=1000.0; pixels[4][index]=1000.0; } } (new showDoubleFloatArrays()).showArrays(pixels, width, height, true, "grid-"+numGridImage, titles); (new showDoubleFloatArrays()).showArrays(pixels, width, height, true, "grid-"+numGridImage, titles); } } public void showGridAndHint(){ public void showGridAndHint(){ GenericDialog gd=new GenericDialog("Show selected grid and/or hint grid"); GenericDialog gd=new GenericDialog("Show selected grid and/or hint grid"); Loading Loading @@ -2903,7 +2904,8 @@ For each point in the image fittingStrategy.distortionCalibrationData.gIP[numGridImage].channel, fittingStrategy.distortionCalibrationData.gIP[numGridImage].channel, goniometerTiltAxial[0], // Tilt, goniometerHorizontal goniometerTiltAxial[0], // Tilt, goniometerHorizontal goniometerTiltAxial[1], // Axial,goniometerAxial goniometerTiltAxial[1], // Axial,goniometerAxial useSetData?fittingStrategy.distortionCalibrationData.gIP[numGridImage].setNumber:-1 (useSetData?fittingStrategy.distortionCalibrationData.gIP[numGridImage].setNumber:-1), true // filter border ); ); showHintGrid(hintGrid,"hint-"+numGridImage); showHintGrid(hintGrid,"hint-"+numGridImage); Loading Loading @@ -3061,7 +3063,8 @@ For each point in the image int subCamera, int subCamera, double goniometerHorizontal, // Tilt double goniometerHorizontal, // Tilt double goniometerAxial, // Axial double goniometerAxial, // Axial int imageSet){ int imageSet, boolean filterBorder){ int debugThreshold=2; int debugThreshold=2; // Get parameter vector (22) for the selected sensor, current Eyesisparameters and specified orientation angles // Get parameter vector (22) for the selected sensor, current Eyesisparameters and specified orientation angles double [] parVector=fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getParametersVector(stationNumber,subCamera); double [] parVector=fittingStrategy.distortionCalibrationData.eyesisCameraParameters.getParametersVector(stationNumber,subCamera); Loading Loading @@ -3139,6 +3142,7 @@ For each point in the image } } } } } } if (filterBorder){ // now filter border nodes // now filter border nodes boolean [] mask= new boolean [patternGeometry.length*patternGeometry[0].length]; boolean [] mask= new boolean [patternGeometry.length*patternGeometry[0].length]; int index=0; int index=0; Loading @@ -3153,7 +3157,7 @@ For each point in the image for (int v=0;v<result.length;v++) for (int u=0;u<result[v].length;u++){ for (int v=0;v<result.length;v++) for (int u=0;u<result[v].length;u++){ if (!mask[index++]) result[v][u]=null; if (!mask[index++]) result[v][u]=null; } } } if (this.debugLevel>debugThreshold){ if (this.debugLevel>debugThreshold){ for (int v=0;v<result.length;v++) for (int u=0;u<result[v].length;u++){ for (int v=0;v<result.length;v++) for (int u=0;u<result[v].length;u++){ int uv=u+v*result[v].length; int uv=u+v*result[v].length;
src/main/java/EyesisAberrations.java +32 −4 Original line number Original line Diff line number Diff line Loading @@ -1073,6 +1073,8 @@ public class EyesisAberrations { int debugLevel int debugLevel ){ ){ Distortions.DistortionCalibrationData distortionCalibrationData= distortions.fittingStrategy.distortionCalibrationData; Distortions.DistortionCalibrationData distortionCalibrationData= distortions.fittingStrategy.distortionCalibrationData; boolean partialToReprojected=this.aberrationParameters.partialToReprojected; // this.distortions is set to top level LENS_DISTORTIONS if (distortions==null){ if (distortions==null){ String msg="Distortions instance does not exist, exiting"; String msg="Distortions instance does not exist, exiting"; IJ.showMessage("Error",msg); IJ.showMessage("Error",msg); Loading Loading @@ -1212,7 +1214,7 @@ public class EyesisAberrations { } } // reorder in the ascending channel number order // reorder in the ascending channel number order String [][] files=new String [numFiles][2]; // 0 - source, 1 - result String [][] files=new String [numFiles][2]; // 0 - source, 1 - result int [] fileIndices =new int [numFiles]; // needed to mark bad kernels int [] fileIndices =new int [numFiles]; // needed to mark bad kernels (and also to reference grid parameters to replace extracted) int numListedFiles=0; int numListedFiles=0; int numChannel=0; int numChannel=0; while (numListedFiles<numFiles) { while (numListedFiles<numFiles) { Loading @@ -1239,6 +1241,22 @@ public class EyesisAberrations { int iRetry=0; int iRetry=0; for (iRetry=0;iRetry<MaxRetries;iRetry++){ // is this retry needed? for (iRetry=0;iRetry<MaxRetries;iRetry++){ // is this retry needed? try { try { double [][][] projectedGrid=null; double hintTolerance=0.0; if (partialToReprojected){ // replace px, py with projected values form the grid // this.distortions is set to the global LENS_DISTORTIONS int numGridImage=fileIndices[imgNum]; projectedGrid=distortions.estimateGridOnSensor( // return grid array [v][u][0- x, 1 - y, 2 - u, 3 - v] distortions.fittingStrategy.distortionCalibrationData.getImageStation(numGridImage), // station number, distortions.fittingStrategy.distortionCalibrationData.gIP[numGridImage].channel, // subCamera, Double.NaN, // goniometerHorizontal, - not used Double.NaN, // goniometerAxial, - not used distortions.fittingStrategy.distortionCalibrationData.gIP[numGridImage].getSetNumber(), //imageSet, true); //filterBorder) hintTolerance=5.0; // TODO:set from configurable parameter } int rslt=matchSimulatedPattern.calculateDistortions( int rslt=matchSimulatedPattern.calculateDistortions( distortionParameters, // distortionParameters, // patternDetectParameters, patternDetectParameters, Loading @@ -1247,9 +1265,8 @@ public class EyesisAberrations { imp, imp, null, // LaserPointer laserPointer, // LaserPointer object or null null, // LaserPointer laserPointer, // LaserPointer object or null true, // don't care -removeOutOfGridPointers true, // don't care -removeOutOfGridPointers null, // double [][][] hintGrid, // predicted grid array (or null) projectedGrid, // null, // double [][][] hintGrid, // predicted grid array (or null) 0, // double hintGridTolerance, // allowed mismatch (fraction of period) or 0 - orientation only hintTolerance, // 0, // double hintGridTolerance, // allowed mismatch (fraction of period) or 0 - orientation only threadsMax, threadsMax, updateStatus, updateStatus, debugLevel, debugLevel, Loading @@ -1259,6 +1276,11 @@ public class EyesisAberrations { if (debugLevel>0) System.out.println("calculateDistortions failed, returned error code "+rslt+" iRetry="+iRetry+" (of "+MaxRetries+")"); if (debugLevel>0) System.out.println("calculateDistortions failed, returned error code "+rslt+" iRetry="+iRetry+" (of "+MaxRetries+")"); continue; continue; } } // now replace extracted grid X,Y with projected: if (projectedGrid!=null){ int numReplaced= matchSimulatedPattern.replaceGridXYWithProjected(projectedGrid); if (debugLevel>0) System.out.println("Replaced extracted XY with projected ones for "+numReplaced+" nodes"); } correlationSizesUsed=matchSimulatedPattern.getCorrelationSizesUsed(); correlationSizesUsed=matchSimulatedPattern.getCorrelationSizesUsed(); simArray= (new SimulationPattern(simulParameters)).simulateGridAll ( simArray= (new SimulationPattern(simulParameters)).simulateGridAll ( imp.getWidth(), imp.getWidth(), Loading Loading @@ -4428,6 +4450,7 @@ if (globalDebugLevel>2)globalDebugLevel=0; //*********************************** public boolean autoReCalibrateIgnoreLaser=false; // "Ignore laser pointers on recalibrate" public boolean autoReCalibrateIgnoreLaser=false; // "Ignore laser pointers on recalibrate" public boolean noMessageBoxes=true; public boolean noMessageBoxes=true; public boolean overwriteResultFiles=false; public boolean overwriteResultFiles=false; public boolean partialToReprojected=true; // Use reprojected grid for partial kernel calculation (false - use extracted) public int seriesNumber=0; public int seriesNumber=0; public boolean allImages; public boolean allImages; public String sourcePrefix=""; public String sourcePrefix=""; Loading Loading @@ -4460,6 +4483,8 @@ if (globalDebugLevel>2)globalDebugLevel=0; //*********************************** properties.setProperty(prefix+"autoReCalibrateIgnoreLaser",this.autoReCalibrateIgnoreLaser+""); properties.setProperty(prefix+"autoReCalibrateIgnoreLaser",this.autoReCalibrateIgnoreLaser+""); properties.setProperty(prefix+"noMessageBoxes",this.noMessageBoxes+""); properties.setProperty(prefix+"noMessageBoxes",this.noMessageBoxes+""); properties.setProperty(prefix+"overwriteResultFiles",this.overwriteResultFiles+""); properties.setProperty(prefix+"overwriteResultFiles",this.overwriteResultFiles+""); properties.setProperty(prefix+"partialToReprojected",this.partialToReprojected+""); properties.setProperty(prefix+"seriesNumber",this.seriesNumber+""); properties.setProperty(prefix+"seriesNumber",this.seriesNumber+""); properties.setProperty(prefix+"allImages",this.allImages+""); properties.setProperty(prefix+"allImages",this.allImages+""); Loading Loading @@ -4498,6 +4523,7 @@ if (globalDebugLevel>2)globalDebugLevel=0; //*********************************** if (properties.getProperty(prefix+"autoReCalibrateIgnoreLaser")!=null) this.autoReCalibrateIgnoreLaser=Boolean.parseBoolean(properties.getProperty(prefix+"autoReCalibrateIgnoreLaser")); if (properties.getProperty(prefix+"autoReCalibrateIgnoreLaser")!=null) this.autoReCalibrateIgnoreLaser=Boolean.parseBoolean(properties.getProperty(prefix+"autoReCalibrateIgnoreLaser")); if (properties.getProperty(prefix+"noMessageBoxes")!=null) this.noMessageBoxes=Boolean.parseBoolean(properties.getProperty(prefix+"noMessageBoxes")); if (properties.getProperty(prefix+"noMessageBoxes")!=null) this.noMessageBoxes=Boolean.parseBoolean(properties.getProperty(prefix+"noMessageBoxes")); if (properties.getProperty(prefix+"overwriteResultFiles")!=null) this.overwriteResultFiles=Boolean.parseBoolean(properties.getProperty(prefix+"overwriteResultFiles")); if (properties.getProperty(prefix+"overwriteResultFiles")!=null) this.overwriteResultFiles=Boolean.parseBoolean(properties.getProperty(prefix+"overwriteResultFiles")); if (properties.getProperty(prefix+"partialToReprojected")!=null) this.partialToReprojected=Boolean.parseBoolean(properties.getProperty(prefix+"partialToReprojected")); if (properties.getProperty(prefix+"seriesNumber")!=null) this.seriesNumber=Integer.parseInt(properties.getProperty(prefix+"seriesNumber")); if (properties.getProperty(prefix+"seriesNumber")!=null) this.seriesNumber=Integer.parseInt(properties.getProperty(prefix+"seriesNumber")); if (properties.getProperty(prefix+"allImages")!=null) this.allImages=Boolean.parseBoolean(properties.getProperty(prefix+"allImages")); if (properties.getProperty(prefix+"allImages")!=null) this.allImages=Boolean.parseBoolean(properties.getProperty(prefix+"allImages")); if (properties.getProperty(prefix+"sourcePrefix")!=null) this.sourcePrefix=properties.getProperty(prefix+"sourcePrefix"); if (properties.getProperty(prefix+"sourcePrefix")!=null) this.sourcePrefix=properties.getProperty(prefix+"sourcePrefix"); Loading Loading @@ -4629,6 +4655,7 @@ if (globalDebugLevel>2)globalDebugLevel=0; //*********************************** gd.addCheckbox("Select aberrations kernels directory", false); gd.addCheckbox("Select aberrations kernels directory", false); gd.addCheckbox("Supress non-essential message boxes", this.noMessageBoxes); gd.addCheckbox("Supress non-essential message boxes", this.noMessageBoxes); gd.addCheckbox("Overwrite result files if they exist", this.overwriteResultFiles); gd.addCheckbox("Overwrite result files if they exist", this.overwriteResultFiles); gd.addCheckbox("Use reprojected grids for partial kernel calculation (false - extracted grids)", this.partialToReprojected); gd.addNumericField("Fitting series number to use for image selection", this.seriesNumber,0); gd.addNumericField("Fitting series number to use for image selection", this.seriesNumber,0); gd.addCheckbox("Process all enabled image files (false - use selected fitting series)", this.allImages); gd.addCheckbox("Process all enabled image files (false - use selected fitting series)", this.allImages); gd.addMessage("===== Autoload options (when restoring configuration) ====="); gd.addMessage("===== Autoload options (when restoring configuration) ====="); Loading Loading @@ -4673,6 +4700,7 @@ if (globalDebugLevel>2)globalDebugLevel=0; //*********************************** if (gd.getNextBoolean()) selectAberrationsKernelDirectory(false, this.aberrationsKernelDirectory, false); if (gd.getNextBoolean()) selectAberrationsKernelDirectory(false, this.aberrationsKernelDirectory, false); this.noMessageBoxes= gd.getNextBoolean(); this.noMessageBoxes= gd.getNextBoolean(); this.overwriteResultFiles= gd.getNextBoolean(); this.overwriteResultFiles= gd.getNextBoolean(); this.partialToReprojected= gd.getNextBoolean(); this.seriesNumber= (int) gd.getNextNumber(); this.seriesNumber= (int) gd.getNextNumber(); this.allImages= gd.getNextBoolean(); this.allImages= gd.getNextBoolean(); this.autoRestore= gd.getNextBoolean(); this.autoRestore= gd.getNextBoolean(); Loading
src/main/java/Goniometer.java +2 −1 Original line number Original line Diff line number Diff line Loading @@ -598,7 +598,8 @@ horizontal axis: subCam, subCam, goniometerTiltAxial[0], // Tilt, goniometerHorizontal goniometerTiltAxial[0], // Tilt, goniometerHorizontal goniometerTiltAxial[1], // Axial,goniometerAxial goniometerTiltAxial[1], // Axial,goniometerAxial -1 // use camera parameters, not imageSet -1, // use camera parameters, not imageSet true // filter border ); ); if (hintGrid==null){ if (hintGrid==null){ String msg= "Target is not visible"; String msg= "Target is not visible"; Loading
src/main/java/MatchSimulatedPattern.java +45 −0 Original line number Original line Diff line number Diff line Loading @@ -6983,6 +6983,51 @@ y=xy0[1] + dU*deltaUV[0]*(xy1[1]-xy0[1])+dV*deltaUV[1]*(xy2[1]-xy0[1]) } } public int replaceGridXYWithProjected(double [][][] projectedGrid){ int minU=0,minV=0,maxU=0,maxV=0; boolean notYetSet=true; for (double [][]row:projectedGrid) for (double [] cell:row) if (cell!=null){ int u = (int) cell[2]; int v = (int) cell[3]; if (notYetSet){ minU=u; maxU=u; minV=v; maxV=v; notYetSet=false; } else { if (minU>u) minU=u; if (maxU<u) maxU=u; if (minV>v) minV=v; if (maxV<v) maxV=v; } } double [][][] grid=new double [maxV-minV+1][maxU-minU+1][]; // for (double [][]row:grid) for (double [] cell:row) cell=null; // See if this works with "enhanced for loop" for (double [][]row:grid) for (int u=0;u<row.length;u++) row[u]=null; // See if this works with "enhanced for loop" for (double [][] row:projectedGrid) for (double [] cell:row) if (cell!=null){ int u = (int) cell[2]; int v = (int) cell[3]; double [] xy={cell[0],cell[1]}; grid[v-minV][u-minU]=xy; } int numNewDefined=0; for (int v=0;v<this.PATTERN_GRID.length;v++) for (int u=0;u<this.PATTERN_GRID[v].length;u++) { double [][] cell=this.PATTERN_GRID[v][u]; if ((cell !=null) && (cell.length>0) &&(cell[0] !=null) && (cell[0].length>1)){ cell[0][0]=grid[this.targetUV[v][u][1]+minV][this.targetUV[v][u][0]+minU][0]; cell[0][1]=grid[this.targetUV[v][u][1]+minV][this.targetUV[v][u][0]+minU][1]; if (Double.isNaN(cell[0][0]) || Double.isNaN(cell[0][1])){ this.PATTERN_GRID[v][u]=null; // make it undefined } else { numNewDefined++; } } } return numNewDefined; } /* Get calibrated pattern as a 8-slice image (can be saved as TIFF) /* Get calibrated pattern as a 8-slice image (can be saved as TIFF) * first slice - pixel X or -1 for undefined * first slice - pixel X or -1 for undefined * second slice - pixel Y or -1 for undefined * second slice - pixel Y or -1 for undefined Loading