Loading src/main/java/com/elphel/imagej/calibration/Aberration_Calibration.java +30 −7 Original line number Diff line number Diff line Loading @@ -10465,6 +10465,7 @@ if (MORE_BUTTONS) { String [][] sourceFilesList=LWIR_PARAMETERS.getSourceFiles(sourceSetList, sel_chn); boolean saveGrids=DISTORTION_PROCESS_CONFIGURATION.saveGridImages; boolean overwriteGrids=DISTORTION_PROCESS_CONFIGURATION.overwriteResultFiles; int minGridFileSize = PATTERN_DETECT.minGridFileSize; if (sourceSetList==null) return; showPatternMinMaxPeriodDialog(PATTERN_DETECT, true); int saved_file = 0; Loading @@ -10487,6 +10488,7 @@ if (MORE_BUTTONS) { } } for (int nfile = 0; nfile < sourceFilesList[nset].length; nfile++) if (sourceFilesList[nset][nfile] != null){ in_file++; long startFileTime=System.nanoTime(); Loading @@ -10497,7 +10499,7 @@ if (MORE_BUTTONS) { } String grid_path = null; /* if (saveGrids && !overwriteGrids){ // check if result already exists if (saveGrids && !ovminGridFileSizeerwriteGrids){ // check if result already exists i = sourceFilesList[nset][nfile].lastIndexOf('/'); if (i>0){ String grid_name = prefix+sourceFilesList[nset][nfile].substring(i+1); Loading @@ -10508,6 +10510,7 @@ if (MORE_BUTTONS) { } } } patternDetectParameters.minGridFileSize */ if (saveGrids){ // check if result already exists Loading @@ -10515,9 +10518,22 @@ if (MORE_BUTTONS) { if (i>0){ String grid_name = prefix+sourceFilesList[nset][nfile].substring(i+1); grid_path = gridSetPath + Prefs.getFileSeparator() + grid_name; if (!overwriteGrids && ((new File(grid_path)).exists())){ // check if result already exists if (DEBUG_LEVEL>0) System.out.println("-->>> Skipping existing "+grid_path+" (as requested in \"Configure Process Distortions\")"); File grid_file = new File(grid_path); if (!overwriteGrids && (grid_file.exists())){ // check if result already exists if (grid_file.length() >= minGridFileSize) { if (DEBUG_LEVEL>0) { System.out.println("-->>> Skipping existing large enough ("+(grid_file.length())+ " bytes >= "+minGridFileSize+" bytes)"+grid_path+" (as requested in \"Configure Process Distortions\")"); } continue; } else { if (DEBUG_LEVEL>0) { System.out.println("-->>> Deleting small ("+(grid_file.length())+ " bytes < "+minGridFileSize+" bytes)"+grid_path+" (as requested in \"Configure Process Distortions\")"); grid_file.delete(); } } } } } Loading Loading @@ -10549,7 +10565,10 @@ if (MORE_BUTTONS) { noMessageBoxes); if (DEBUG_LEVEL>1) System.out.println("numAbsolutePoints="+numAbsolutePoints); if ((numAbsolutePoints==DISTORTION.errPatternNotFound) || (numAbsolutePoints==DISTORTION.errTooFewCells)) { if ((numAbsolutePoints==DISTORTION.errPatternNotFound) || (numAbsolutePoints==DISTORTION.errTooFewCells) || (numAbsolutePoints==DISTORTION.errRefineFailed) ) { if (DEBUG_LEVEL>0) System.out.println("Grid "+(in_file)+" not found or too small ("+numAbsolutePoints+"), wasted "+ IJ.d2s(0.000000001*(System.nanoTime()-startFileTime),3)+" seconds )\n"); if (this.SYNC_COMMAND.stopRequested.get()>0) { Loading Loading @@ -21107,6 +21126,9 @@ use the result to create a rejectiobn mask - if the energy was high, (multiplica gd.addNumericField("Minimal pattern grid period for LWIR sensors (<=0.0 - do not check)" , patternDetectParameters.minGridPeriodLwir, 2,5,"pix"); gd.addNumericField("Maximal pattern grid period for LWIR sensors (<=0.0 - do not check)" , patternDetectParameters.maxGridPeriodLwir, 2,5,"pix"); } gd.addNumericField("Minimal grid file size to overwrite" , patternDetectParameters.minGridFileSize, 0, 8, "bytes"); // public double minGridFileSize = 25000; // Minimal file size (to overwirite) gd.showDialog(); if (gd.wasCanceled()) return false; patternDetectParameters.minGridPeriod= gd.getNextNumber(); Loading @@ -21115,6 +21137,7 @@ use the result to create a rejectiobn mask - if the energy was high, (multiplica patternDetectParameters.minGridPeriodLwir= gd.getNextNumber(); patternDetectParameters.maxGridPeriodLwir= gd.getNextNumber(); } patternDetectParameters.minGridFileSize = (int) gd.getNextNumber(); return true; } src/main/java/com/elphel/imagej/calibration/MatchSimulatedPattern.java +18 −9 Original line number Diff line number Diff line Loading @@ -4372,12 +4372,14 @@ public class MatchSimulatedPattern { continue; } else if ((refCell[0] != null) && (refCell[0].length > 3)) { double dbg_contrast = (refCell[0].length > 2) ? refCell[0][2] : Double.NaN; if (debugLevel > debugThreshold) { System.out.println("**** refCell was deleted **** u=" + iUVRef[0] + " v=" + iUVRef[1] + " current=" + iUVdir[0] + "/" + iUVdir[1] + " ncell=" + ncell + " waveFrontList.size()=" + waveFrontList.size() + " ref_x=" + IJ.d2s(refCell[0][0], 3) + " ref_y=" + IJ.d2s(refCell[0][1], 3) + " contrast=" + IJ.d2s(dbg_contrast, 3)); } } // found reference cell, calculate x/y, make sure it is inside the selection w/o // borders double[][] wv = new double[2][]; Loading Loading @@ -6855,7 +6857,7 @@ public class MatchSimulatedPattern { IJ.showMessage("Error", "Pattern not found"); return distortionParameters.errPatternNotFound; } else { if (global_debug_level > (debugThreshold + 1)) if (global_debug_level > 0) // (debugThreshold + 1)) System.out.println("Initial pattern cluster has " + patternCells + " cells"); } if (global_debug_level > (debugThreshold + 1)) Loading @@ -6878,7 +6880,7 @@ public class MatchSimulatedPattern { imp_eq = imp; if (distortionParameters.refineCorrelations) { refineDistortionCorrelation( double maxActualCorr = refineDistortionCorrelation( lwirReaderParameters, // LwirReaderParameters lwirReaderParameters, // null is OK distortionParameters, // patternDetectParameters, Loading @@ -6889,7 +6891,10 @@ public class MatchSimulatedPattern { threadsMax, updateStatus, debug_level); // debug level System.out.println(".... maxActualCorr="+maxActualCorr); if (maxActualCorr <= 0.0) { return distortionParameters.errRefineFailed; // 2021 } recalculateWaveVectors( updateStatus, debug_level);// debug level used inside loops Loading Loading @@ -10560,6 +10565,7 @@ public class MatchSimulatedPattern { } contrast = contrasts[0]; result[2] = contrast; // System.out.println("cobntrasts = "+contrasts[0]+", "+contrasts[1]); if (Double.isNaN(contrasts[0]) || ((distortionParameters.correlationMinContrast > 0) && (contrasts[0] < distortionParameters.correlationMinContrast))) { if ((debug_level > (debug_threshold - 1))) Loading Loading @@ -12400,6 +12406,7 @@ public class MatchSimulatedPattern { public double minGridPeriod; public double maxGridPeriod; public double minGridPeriodLwir; public int minGridFileSize = 15000; // Minimal file size (to overwrite) public double maxGridPeriodLwir; public double debugX; public double debugY; Loading Loading @@ -12625,6 +12632,8 @@ public class MatchSimulatedPattern { // match pointers errors public int errTooFewCells = -10; public int errPatternNotFound = -11; public int errRefineFailed = -12; public boolean legacyMode = false; // legacy mode Loading
src/main/java/com/elphel/imagej/calibration/Aberration_Calibration.java +30 −7 Original line number Diff line number Diff line Loading @@ -10465,6 +10465,7 @@ if (MORE_BUTTONS) { String [][] sourceFilesList=LWIR_PARAMETERS.getSourceFiles(sourceSetList, sel_chn); boolean saveGrids=DISTORTION_PROCESS_CONFIGURATION.saveGridImages; boolean overwriteGrids=DISTORTION_PROCESS_CONFIGURATION.overwriteResultFiles; int minGridFileSize = PATTERN_DETECT.minGridFileSize; if (sourceSetList==null) return; showPatternMinMaxPeriodDialog(PATTERN_DETECT, true); int saved_file = 0; Loading @@ -10487,6 +10488,7 @@ if (MORE_BUTTONS) { } } for (int nfile = 0; nfile < sourceFilesList[nset].length; nfile++) if (sourceFilesList[nset][nfile] != null){ in_file++; long startFileTime=System.nanoTime(); Loading @@ -10497,7 +10499,7 @@ if (MORE_BUTTONS) { } String grid_path = null; /* if (saveGrids && !overwriteGrids){ // check if result already exists if (saveGrids && !ovminGridFileSizeerwriteGrids){ // check if result already exists i = sourceFilesList[nset][nfile].lastIndexOf('/'); if (i>0){ String grid_name = prefix+sourceFilesList[nset][nfile].substring(i+1); Loading @@ -10508,6 +10510,7 @@ if (MORE_BUTTONS) { } } } patternDetectParameters.minGridFileSize */ if (saveGrids){ // check if result already exists Loading @@ -10515,9 +10518,22 @@ if (MORE_BUTTONS) { if (i>0){ String grid_name = prefix+sourceFilesList[nset][nfile].substring(i+1); grid_path = gridSetPath + Prefs.getFileSeparator() + grid_name; if (!overwriteGrids && ((new File(grid_path)).exists())){ // check if result already exists if (DEBUG_LEVEL>0) System.out.println("-->>> Skipping existing "+grid_path+" (as requested in \"Configure Process Distortions\")"); File grid_file = new File(grid_path); if (!overwriteGrids && (grid_file.exists())){ // check if result already exists if (grid_file.length() >= minGridFileSize) { if (DEBUG_LEVEL>0) { System.out.println("-->>> Skipping existing large enough ("+(grid_file.length())+ " bytes >= "+minGridFileSize+" bytes)"+grid_path+" (as requested in \"Configure Process Distortions\")"); } continue; } else { if (DEBUG_LEVEL>0) { System.out.println("-->>> Deleting small ("+(grid_file.length())+ " bytes < "+minGridFileSize+" bytes)"+grid_path+" (as requested in \"Configure Process Distortions\")"); grid_file.delete(); } } } } } Loading Loading @@ -10549,7 +10565,10 @@ if (MORE_BUTTONS) { noMessageBoxes); if (DEBUG_LEVEL>1) System.out.println("numAbsolutePoints="+numAbsolutePoints); if ((numAbsolutePoints==DISTORTION.errPatternNotFound) || (numAbsolutePoints==DISTORTION.errTooFewCells)) { if ((numAbsolutePoints==DISTORTION.errPatternNotFound) || (numAbsolutePoints==DISTORTION.errTooFewCells) || (numAbsolutePoints==DISTORTION.errRefineFailed) ) { if (DEBUG_LEVEL>0) System.out.println("Grid "+(in_file)+" not found or too small ("+numAbsolutePoints+"), wasted "+ IJ.d2s(0.000000001*(System.nanoTime()-startFileTime),3)+" seconds )\n"); if (this.SYNC_COMMAND.stopRequested.get()>0) { Loading Loading @@ -21107,6 +21126,9 @@ use the result to create a rejectiobn mask - if the energy was high, (multiplica gd.addNumericField("Minimal pattern grid period for LWIR sensors (<=0.0 - do not check)" , patternDetectParameters.minGridPeriodLwir, 2,5,"pix"); gd.addNumericField("Maximal pattern grid period for LWIR sensors (<=0.0 - do not check)" , patternDetectParameters.maxGridPeriodLwir, 2,5,"pix"); } gd.addNumericField("Minimal grid file size to overwrite" , patternDetectParameters.minGridFileSize, 0, 8, "bytes"); // public double minGridFileSize = 25000; // Minimal file size (to overwirite) gd.showDialog(); if (gd.wasCanceled()) return false; patternDetectParameters.minGridPeriod= gd.getNextNumber(); Loading @@ -21115,6 +21137,7 @@ use the result to create a rejectiobn mask - if the energy was high, (multiplica patternDetectParameters.minGridPeriodLwir= gd.getNextNumber(); patternDetectParameters.maxGridPeriodLwir= gd.getNextNumber(); } patternDetectParameters.minGridFileSize = (int) gd.getNextNumber(); return true; }
src/main/java/com/elphel/imagej/calibration/MatchSimulatedPattern.java +18 −9 Original line number Diff line number Diff line Loading @@ -4372,12 +4372,14 @@ public class MatchSimulatedPattern { continue; } else if ((refCell[0] != null) && (refCell[0].length > 3)) { double dbg_contrast = (refCell[0].length > 2) ? refCell[0][2] : Double.NaN; if (debugLevel > debugThreshold) { System.out.println("**** refCell was deleted **** u=" + iUVRef[0] + " v=" + iUVRef[1] + " current=" + iUVdir[0] + "/" + iUVdir[1] + " ncell=" + ncell + " waveFrontList.size()=" + waveFrontList.size() + " ref_x=" + IJ.d2s(refCell[0][0], 3) + " ref_y=" + IJ.d2s(refCell[0][1], 3) + " contrast=" + IJ.d2s(dbg_contrast, 3)); } } // found reference cell, calculate x/y, make sure it is inside the selection w/o // borders double[][] wv = new double[2][]; Loading Loading @@ -6855,7 +6857,7 @@ public class MatchSimulatedPattern { IJ.showMessage("Error", "Pattern not found"); return distortionParameters.errPatternNotFound; } else { if (global_debug_level > (debugThreshold + 1)) if (global_debug_level > 0) // (debugThreshold + 1)) System.out.println("Initial pattern cluster has " + patternCells + " cells"); } if (global_debug_level > (debugThreshold + 1)) Loading @@ -6878,7 +6880,7 @@ public class MatchSimulatedPattern { imp_eq = imp; if (distortionParameters.refineCorrelations) { refineDistortionCorrelation( double maxActualCorr = refineDistortionCorrelation( lwirReaderParameters, // LwirReaderParameters lwirReaderParameters, // null is OK distortionParameters, // patternDetectParameters, Loading @@ -6889,7 +6891,10 @@ public class MatchSimulatedPattern { threadsMax, updateStatus, debug_level); // debug level System.out.println(".... maxActualCorr="+maxActualCorr); if (maxActualCorr <= 0.0) { return distortionParameters.errRefineFailed; // 2021 } recalculateWaveVectors( updateStatus, debug_level);// debug level used inside loops Loading Loading @@ -10560,6 +10565,7 @@ public class MatchSimulatedPattern { } contrast = contrasts[0]; result[2] = contrast; // System.out.println("cobntrasts = "+contrasts[0]+", "+contrasts[1]); if (Double.isNaN(contrasts[0]) || ((distortionParameters.correlationMinContrast > 0) && (contrasts[0] < distortionParameters.correlationMinContrast))) { if ((debug_level > (debug_threshold - 1))) Loading Loading @@ -12400,6 +12406,7 @@ public class MatchSimulatedPattern { public double minGridPeriod; public double maxGridPeriod; public double minGridPeriodLwir; public int minGridFileSize = 15000; // Minimal file size (to overwrite) public double maxGridPeriodLwir; public double debugX; public double debugY; Loading Loading @@ -12625,6 +12632,8 @@ public class MatchSimulatedPattern { // match pointers errors public int errTooFewCells = -10; public int errPatternNotFound = -11; public int errRefineFailed = -12; public boolean legacyMode = false; // legacy mode