Commit 24b642b0 authored by Andrey Filippov's avatar Andrey Filippov

Updating batch mode of the 3d scene processing

parent 91409a1a
......@@ -25,12 +25,12 @@
**
*/
import ij.ImageStack;
import ij.gui.GenericDialog;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicInteger;
import ij.ImageStack;
import ij.gui.GenericDialog;
public class CorrectionColorProc {
showDoubleFloatArrays SDFA_INSTANCE= new showDoubleFloatArrays();
......@@ -241,7 +241,7 @@ public class CorrectionColorProc {
//TODO: null DENOISE_MASK if it is not calculated
if (colorProcParameters.combineWithSharpnessMask) {
if (denoiseMask==null) {
System.out.println ( "Can not combine masks as denoiseMask is null (i.e. no denoise was performed)");
System.out.println ( "Can not combine masks as denoiseMask is null (i.e. no denoise was performed)"); // here
} else if (denoiseMask.length!=dmask.length) {
System.out.println ( "Can not combine masks as denoiseMask length is different from that of dmask");
} else {
......
......@@ -3004,6 +3004,9 @@ public class EyesisCorrectionParameters {
public HashMap<String,Double> z_corr_map = new HashMap<String,Double>();
public static String Z_CORR_PREFIX = "z_corr.";
public boolean batch_run = false; // turned on only while running in batch mode
public CLTParameters(){}
public void setProperties(String prefix,Properties properties){
......
......@@ -25,7 +25,6 @@
import java.util.Properties;
import java.util.concurrent.atomic.AtomicInteger;
import ij.CompositeImage;
import ij.IJ;
import ij.ImagePlus;
......@@ -150,6 +149,7 @@ public class EyesisDCT {
System.out.println("calculateDCTKernel():numberOfKernels="+numberOfKernels);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
DoubleGaussianBlur gb=null;
if (dct_parameters.decimateSigma > 0) gb=new DoubleGaussianBlur();
......@@ -1439,7 +1439,9 @@ public class EyesisDCT {
}
if (toRGB) {
if (debugLevel > 0){
System.out.println("correctionColorProc.YPrPbToRGB");
}
stack = YPrPbToRGB(yPrPb,
colorProcParameters.kr, // 0.299;
colorProcParameters.kb, // 0.114;
......@@ -1636,6 +1638,7 @@ public class EyesisDCT {
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
int tileY,tileX;
double [] neibs = new double[9]; // pixels around current, first Y, then each color diff
......@@ -1749,6 +1752,7 @@ public class EyesisDCT {
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
int tileY,tileX;
double [] neibs = new double[9]; // pixels around current, first Y, then each color diff
......
......@@ -776,7 +776,7 @@ private Panel panel1,
Runtime runtime = Runtime.getRuntime();
runtime.gc();
if (DEBUG_LEVEL>0) System.out.println("--- Free memory="+runtime.freeMemory()+" (of "+runtime.totalMemory()+")");
CLT_PARAMETERS.batch_run = false;
if (label==null) return;
/* ======================================================================== */
if (label.equals("Configure spilt")) {
......@@ -5051,7 +5051,6 @@ private Panel panel1,
RGB_PARAMETERS, // EyesisCorrectionParameters.RGBParameters rgbParameters,
THREADS_MAX, // final int threadsMax, // maximal number of threads to launch
UPDATE_STATUS, // final boolean updateStatus,
false, // final boolean batch_mode,
DEBUG_LEVEL); //final int debugLevel);
if (!OK) {
String msg="Image data not initialized, run 'CLT 3D' command first";
......@@ -5059,18 +5058,9 @@ private Panel panel1,
IJ.showMessage("Error",msg);
}
/*
if (configPath!=null) {
saveTimestampedProperties( // save config again
configPath, // full path or null
null, // use as default directory if path==null
true,
PROPERTIES);
}
*/
} else if (label.equals("CLT batch process")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
CLT_PARAMETERS.batch_run = true;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
if (QUAD_CLT == null){
QUAD_CLT = new QuadCLT (
......
......@@ -188,7 +188,7 @@ public class LinkPlanes {
plPrecision = clt_parameters.plPrecision;
plNormPow = clt_parameters.plNormPow;
dbg_tileX = clt_parameters.tileX;
dbg_tileX = clt_parameters.batch_run?-1:clt_parameters.tileX;
dbg_tileY = clt_parameters.tileY;
this.st = st;
}
......@@ -862,6 +862,7 @@ public class LinkPlanes {
// Select best symmetrical match, consider only N, NE, E, SE - later opposite ones will be copied
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
// TilePlanes.PlaneData [] dbg_planes = null;
for (int nsTile0 = ai.getAndIncrement(); nsTile0 < nStiles; nsTile0 = ai.getAndIncrement()) {
......@@ -960,6 +961,7 @@ public class LinkPlanes {
ai.set(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
// TilePlanes.PlaneData [][] dbg_planes = planes;
for (int nsTile0 = ai.getAndIncrement(); nsTile0 < nStiles; nsTile0 = ai.getAndIncrement()) {
......@@ -1056,6 +1058,7 @@ public class LinkPlanes {
final AtomicInteger ai = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
for (int nsTile0 = ai.getAndIncrement(); nsTile0 < nStiles; nsTile0 = ai.getAndIncrement()) {
// int dl = ((debugLevel > -1) && (nsTile0 == debug_stile)) ? 1:0;
......@@ -1159,6 +1162,7 @@ public class LinkPlanes {
// Reset neighbors
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
for (int nsTile0 = ai.getAndIncrement(); nsTile0 < nStiles; nsTile0 = ai.getAndIncrement()) {
if ( planes[nsTile0] != null) {
......@@ -1187,6 +1191,7 @@ public class LinkPlanes {
boolean hasConflict(LinkPair lp){
return (src == lp.src) || (dst == lp.dst);
}
@Override
public String toString(){
return String.format("%d-(%6.3f)->%d", src,cost,dst);
}
......@@ -1194,6 +1199,7 @@ public class LinkPlanes {
}
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
for (int nsTile0 = ai.getAndIncrement(); nsTile0 < nStiles; nsTile0 = ai.getAndIncrement()) {
// int dl = ((debugLevel > -1) && (nsTile0 == debug_stile)) ? 1:0;
......@@ -1298,6 +1304,7 @@ public class LinkPlanes {
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
// TilePlanes.PlaneData [][] dbg_planes = planes;
for (int nsTile0 = ai.getAndIncrement(); nsTile0 < nStiles; nsTile0 = ai.getAndIncrement()) {
......@@ -1412,6 +1419,7 @@ public class LinkPlanes {
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
// TilePlanes.PlaneData [][] dbg_planes = planes;
for (int nsTile0 = ai.getAndIncrement(); nsTile0 < nStiles; nsTile0 = ai.getAndIncrement()) {
......@@ -1666,6 +1674,7 @@ public class LinkPlanes {
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
for (int nsTile0 = ai.getAndIncrement(); nsTile0 < nStiles; nsTile0 = ai.getAndIncrement()) {
if ( planes[nsTile0] != null) {
......@@ -1684,6 +1693,7 @@ public class LinkPlanes {
ai.set(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
int numThread = ai_numThread.getAndIncrement(); // unique number of thread to write to rslt_diffs[numThread]
double [][] quality_stats = all_quality_stats[numThread];
......@@ -1911,6 +1921,7 @@ public class LinkPlanes {
final AtomicInteger ai = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
for (int nsTile = ai.getAndIncrement(); nsTile < nStiles; nsTile = ai.getAndIncrement()) if ( planes[nsTile] != null) {
ArrayList<LayersLinks> links_list = new ArrayList<LayersLinks>();
......@@ -2002,6 +2013,7 @@ public class LinkPlanes {
final AtomicInteger ai = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
for (int nsTile = ai.getAndIncrement(); nsTile < nStiles; nsTile = ai.getAndIncrement()) if ( merge_candidates[nsTile] != null) {
// merge_pairs[nsTile] = new boolean [merge_candidates[nsTile].length];
......@@ -2130,6 +2142,7 @@ public class LinkPlanes {
final AtomicInteger ai = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
for (int nsTile = ai.getAndIncrement(); nsTile < nStiles; nsTile = ai.getAndIncrement()) if ( merge_candidates[nsTile] != null) {
int dl = ((debugLevel > 0) && (nsTile == debug_stile)) ? 2: ((debugLevel > 1) ? 1:0);
......@@ -2305,6 +2318,7 @@ public class LinkPlanes {
final AtomicInteger ai = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
for (int nsTile0 = ai.getAndIncrement(); nsTile0 < nStiles; nsTile0 = ai.getAndIncrement()) if ( merge_candidates[nsTile0] != null) {
int sty0 = nsTile0 / stilesX;
......@@ -2461,6 +2475,7 @@ public class LinkPlanes {
final boolean [][] weak_fgnd = new boolean [valid_candidates.length][];
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
for (int nsTile = ai.getAndIncrement(); nsTile < nStiles; nsTile = ai.getAndIncrement()) if ( merge_candidates[nsTile] != null) {
int dl = ((debugLevel > 1) && (nsTile == debug_stile)) ? 3: debugLevel;
......@@ -2528,6 +2543,9 @@ public class LinkPlanes {
final int dbg_X,
final int dbg_Y)
{
if (debugLevel > 0) {
System.out.println("Debug debugLevel");
}
final int tilesX = st.tileProcessor.getTilesX();
final int tilesY = st.tileProcessor.getTilesY();
final int superTileSize = st.tileProcessor.getSuperTileSize();
......@@ -2541,6 +2559,7 @@ public class LinkPlanes {
final AtomicInteger ai = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
for (int nsTile0 = ai.getAndIncrement(); nsTile0 < nStiles; nsTile0 = ai.getAndIncrement()) if ( merge_candidates[nsTile0] != null) {
// int dl = ((debugLevel > 0) && (nsTile0 == debug_stile)) ? 3: ((debugLevel > 1) ? 2:0);
......@@ -2731,6 +2750,7 @@ public class LinkPlanes {
final AtomicInteger ai = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
for (int nsTile = ai.getAndIncrement(); nsTile < nStiles; nsTile = ai.getAndIncrement()) {
if ((merge_candidates[nsTile] != null) && (conflicts[nsTile] != null)) {
......@@ -2829,6 +2849,7 @@ public class LinkPlanes {
final AtomicInteger ai = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
for (int nsTile0 = ai.getAndIncrement(); nsTile0 < nStiles; nsTile0 = ai.getAndIncrement()) if ( merge_candidates[nsTile0] != null) {
// int dl = ((debugLevel > 0) && (nsTile0 == debug_stile)) ? 3: ((debugLevel > 1) ? 2:0);
......@@ -3055,6 +3076,7 @@ public class LinkPlanes {
final AtomicInteger ai = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
for (int nsTile0 = ai.getAndIncrement(); nsTile0 < nStiles; nsTile0 = ai.getAndIncrement()) if ( merge_candidates[nsTile0] != null) {
int sty0 = nsTile0 / stilesX;
......@@ -3271,6 +3293,7 @@ public class LinkPlanes {
final AtomicInteger ai = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
for (int nsTile = ai.getAndIncrement(); nsTile < nStiles; nsTile = ai.getAndIncrement()) if ( merge_candidates[nsTile] != null) {
merge_pairs[nsTile] = new boolean [merge_candidates[nsTile].length];
......@@ -3350,6 +3373,7 @@ public class LinkPlanes {
// TODO Make nooverlaps be overriden if ne of the planes is very weak and they are close by disparity
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
for (int nsTile = ai.getAndIncrement(); nsTile < nStiles; nsTile = ai.getAndIncrement()) if ( merge_candidates[nsTile] != null) {
if (planes[nsTile] == null){
......@@ -3680,6 +3704,7 @@ public class LinkPlanes {
final AtomicInteger ai = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
ConnectionCosts connectionCosts = new ConnectionCosts(
orthoWeight, // double orthoWeight,
......@@ -3738,6 +3763,7 @@ public class LinkPlanes {
final AtomicInteger ai = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
ConnectionCosts connectionCosts = new ConnectionCosts(
orthoWeight, // double orthoWeight,
......@@ -3970,6 +3996,7 @@ public class LinkPlanes {
final AtomicInteger ai = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
for (int nsTile = ai.getAndIncrement(); nsTile < src_planes.length; nsTile = ai.getAndIncrement()) {
if (src_planes[nsTile] != null){
......@@ -4059,6 +4086,7 @@ public class LinkPlanes {
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
double [][] dbg_img=null;
int numThread = ai_numThread.getAndIncrement(); // unique number of thread to write to rslt_diffs[numThread]
......@@ -4660,6 +4688,9 @@ public class LinkPlanes {
final TileNeibs tnSurface = new TileNeibs(stilesX, stilesY);
final int debug_stile = dbg_Y * stilesX + dbg_X;
// final int nStiles = stilesX * stilesY;
if (debugLevel >-1) {
System.out.println("fillSquares(): Debug debugLevel");
}
int num_added = 0;
for (int stY = 0; stY < (stilesY - 1); stY++ ) {
for (int stX = 0; stX < (stilesX - 1); stX++ ) {
......@@ -4732,6 +4763,10 @@ public class LinkPlanes {
final int stilesY = (tilesY + superTileSize -1)/superTileSize;
final TileNeibs tnSurface = new TileNeibs(stilesX, stilesY);
final int debug_stile = dbg_Y * stilesX + dbg_X;
if (debugLevel >-1) {
System.out.println("fillHypotenuse(): Debug debugLevel");
}
// final int nStiles = stilesX * stilesY;
int num_added = 0;
for (int stY = 0; stY < (stilesY - 1); stY++ ) {
......
......@@ -269,7 +269,7 @@ public class MacroCorrelation {
clt_parameters.corr_magic_scale, // still not understood coefficient that reduces reported disparity value. Seems to be around 0.85
clt_parameters.shift_x, // final int shiftX, // shift image horizontally (positive - right) - just for testing
clt_parameters.shift_y, // final int shiftY, // shift image vertically (positive - down)
31, // clt_parameters.tileX, // final int debug_tileX,
clt_parameters.batch_run? -1: 31, // clt_parameters.tileX, // final int debug_tileX,
10, // clt_parameters.tileY, // final int debug_tileY,
(clt_parameters.dbg_mode & 64) != 0, // no fract shift
true, // no convolve
......
......@@ -732,7 +732,7 @@ public class MeasuredLayers {
int st2 = 2 * superTileSize;
int st_half = superTileSize/2;
double [][] ds = new double [2][st2*st2];
final int dbg_tile = ((stX == 22) && (stY == 19)) ? (5 + 7*16) : -1;// 50397;
final int dbg_tile = -1; // = ((stX == 22) && (stY == 19)) ? (5 + 7*16) : -1;// 50397;
int num_selected = 0;
int smpl_center = mlfp.smplSide /2;
......@@ -1023,7 +1023,7 @@ public class MeasuredLayers {
int st2 = 2 * superTileSize;
int st_half = superTileSize/2;
double [][] ds = new double [2][st2*st2];
final int dbg_tile = ((stX == 22) && (stY == 19)) ? (5 + 7*16) : -1;// 50397;
final int dbg_tile =-1; // ((stX == 22) && (stY == 19)) ? (5 + 7*16) : -1;// 50397;
int num_selected = 0;
int smpl_center = mlfp.smplSide /2;
......
......@@ -1668,7 +1668,9 @@ public class QuadCLT {
}
if (toRGB) {
if (debugLevel > 0){
System.out.println("correctionColorProc.YPrPbToRGB");
}
stack = YPrPbToRGB(yPrPb,
colorProcParameters.kr, // 0.299;
colorProcParameters.kb, // 0.114;
......@@ -2315,7 +2317,9 @@ public class QuadCLT {
}
if (toRGB) {
if (debugLevel > 0){
System.out.println("correctionColorProc.YPrPbToRGB");
}
stack = YPrPbToRGB(yPrPb,
colorProcParameters.kr, // 0.299;
colorProcParameters.kb, // 0.114;
......@@ -2890,7 +2894,9 @@ public class QuadCLT {
}
if (toRGB) {
if (debugLevel > 0){
System.out.println("correctionColorProc.YPrPbToRGB");
}
stack = YPrPbToRGB(yPrPb,
colorProcParameters.kr, // 0.299;
colorProcParameters.kb, // 0.114;
......@@ -3315,7 +3321,6 @@ public class QuadCLT {
infinity_corr, // calculate and apply geometry correction at infinity
threadsMax, // maximal number of threads to launch
updateStatus,
false, // batch_mode
debugLevel);
Runtime.getRuntime().gc();
if (debugLevel >-1) System.out.println("Processing set "+(nSet+1)+" (of "+setNames.size()+") finished at "+
......@@ -3562,8 +3567,8 @@ public class QuadCLT {
final boolean infinity_corr, // calculate and apply geometry correction at infinity
final int threadsMax, // maximal number of threads to launch
final boolean updateStatus,
final boolean batch_mode, //no debug images
final int debugLevel){
final boolean batch_mode = clt_parameters.batch_run; //disable any debug images
boolean advanced=this.correctionsParameters.zcorrect || this.correctionsParameters.equirectangular;
// boolean crop= advanced? true: this.correctionsParameters.crop;
// boolean rotate= advanced? false: this.correctionsParameters.rotate;
......@@ -3807,7 +3812,6 @@ public class QuadCLT {
// visualize correlation results
if (clt_corr_combo!=null){
if (disparity_map != null){
// if (!batch_mode && !infinity_corr && clt_parameters.show_map && (debugLevel > -1)){
if (!batch_mode && clt_parameters.show_map && (debugLevel > -1)){
sdfa_instance.showArrays(
disparity_map,
......@@ -4241,7 +4245,9 @@ public class QuadCLT {
}
String titleFull = "";
if (toRGB) {
if (debugLevel > 0){
System.out.println("correctionColorProc.YPrPbToRGB");
}
stack = YPrPbToRGB(yPrPb,
colorProcParameters.kr, // 0.299;
colorProcParameters.kb, // 0.114;
......@@ -5223,7 +5229,7 @@ public class QuadCLT {
geometryCorrection,
threadsMax,
updateStatus,
false, // batch_mode
// false, // batch_mode
debugLevel);
Runtime.getRuntime().gc();
System.out.println("showCLTPlanes(): processing finished at "+
......@@ -5250,7 +5256,7 @@ public class QuadCLT {
geometryCorrection,
threadsMax,
updateStatus,
false, // boolean batch_mode,
// false, // boolean batch_mode,
debugLevel);
Runtime.getRuntime().gc();
System.out.println("assignCLTPlanes(): processing finished at "+
......@@ -5279,7 +5285,7 @@ public class QuadCLT {
geometryCorrection,
threadsMax,
updateStatus,
false, // batch_mode
// false, // batch_mode
debugLevel);
// CLTPass3d last_scan = tp.clt_3d_passes.get(tp.clt_3d_passes.size() -1); // get last one
......@@ -5566,7 +5572,7 @@ public class QuadCLT {
adjust_poly,
threadsMax, //final int threadsMax, // maximal number of threads to launch
updateStatus,// final boolean updateStatus,
false, // final boolean batch_mode,
// false, // final boolean batch_mode,
debugLevel); // final int debugLevel)
......@@ -5581,7 +5587,6 @@ public class QuadCLT {
rgbParameters,
threadsMax, // maximal number of threads to launch
updateStatus,
false, // final boolean batch_mode,
debugLevel);
}
......@@ -6045,9 +6050,9 @@ public class QuadCLT {
boolean adjust_poly,
final int threadsMax, // maximal number of threads to launch
final boolean updateStatus,
final boolean batch_mode,
final int debugLevel)
{
final boolean batch_mode = clt_parameters.batch_run;
int debugLevelInner = batch_mode ? -5: debugLevel;
boolean update_disp_from_latest = clt_parameters.lym_update_disp ; // true;
int max_tries = clt_parameters.lym_iter; // 25;
......@@ -6361,13 +6366,11 @@ public class QuadCLT {
EyesisCorrectionParameters.RGBParameters rgbParameters,
final int threadsMax, // maximal number of threads to launch
final boolean updateStatus,
final boolean batch_mode,
// final boolean batch_mode,
final int debugLevel)
{
final boolean batch_mode = clt_parameters.batch_run; //disable any debug images
final int debugLevelInner = batch_mode ? -3: debugLevel;
// final int tilesX = tp.getTilesX();
// final int tilesY = tp.getTilesY();
final double trustedCorrelation = tp.getTrustedCorrelation();
final int max_expand = 500; // 150; // 30;
final boolean show_retry_far = clt_parameters.show_retry_far && false; // (max_expand <= 10);
......@@ -6569,7 +6572,6 @@ public class QuadCLT {
/// int next_pass = tp.clt_3d_passes.size(); //
tp.secondPassSetup( // prepare tile tasks for the second pass based on the previous one(s)
// final double [][][] image_data, // first index - number of image in a quad
clt_parameters,
clt_parameters.stUsePass2, // use supertiles
bg_pass,
......@@ -6587,7 +6589,6 @@ public class QuadCLT {
geometryCorrection,
threadsMax, // maximal number of threads to launch
updateStatus,
batch_mode,
debugLevelInner);
// Save tp.clt_3d_passes.size() to roll back without restarting the program
......@@ -7035,9 +7036,9 @@ public class QuadCLT {
EyesisCorrectionParameters.RGBParameters rgbParameters,
final int threadsMax, // maximal number of threads to launch
final boolean updateStatus,
final boolean batch_mode,
final int debugLevel)
{
final boolean batch_mode = clt_parameters.batch_run;
this.startStepTime=System.nanoTime();
final int tilesX = tp.getTilesX();
final int tilesY = tp.getTilesY();
......@@ -8155,9 +8156,9 @@ public class QuadCLT {
final double [] referenceExposures, // =eyesisCorrections.calcReferenceExposures(debugLevel); // multiply each image by this and divide by individual (if not NaN)
final double [] scaleExposures, // = new double[channelFiles.length]; //
final boolean [][] saturation_imp, // = (clt_parameters.sat_level > 0.0)? new boolean[channelFiles.length][] : null;
final boolean batch_mode, // disable any debug images
final int debugLevel)
{
final boolean batch_mode = clt_parameters.batch_run; //disable any debug images
String [] sourceFiles=correctionsParameters.getSourcePaths();
int maxChn = 0;
for (int i = 0; i < setFiles.get(nSet).size(); i++){
......@@ -8410,6 +8411,7 @@ public class QuadCLT {
final boolean updateStatus,
final int debugLevel)
{
final int debugLevelInner=clt_parameters.batch_run? -2: debugLevel;
this.startTime=System.nanoTime();
String [] sourceFiles=correctionsParameters.getSourcePaths();
boolean [] enabledFiles=new boolean[sourceFiles.length];
......@@ -8439,7 +8441,7 @@ public class QuadCLT {
} else {
if (debugLevel>0) System.out.println(numFilesToProcess+ " files to process (of "+sourceFiles.length+"), "+numImagesToProcess+" images to process");
}
double [] referenceExposures=eyesisCorrections.calcReferenceExposures(debugLevel); // multiply each image by this and divide by individual (if not NaN)
double [] referenceExposures=eyesisCorrections.calcReferenceExposures(debugLevelInner); // multiply each image by this and divide by individual (if not NaN)
int [][] fileIndices=new int [numImagesToProcess][2]; // file index, channel number
int index=0;
for (int nFile=0;nFile<enabledFiles.length;nFile++){
......@@ -8469,7 +8471,11 @@ public class QuadCLT {
}
setFiles.get(setNames.indexOf(setName)).add(new Integer(nFile));
}
boolean batch_dbg = correctionsParameters.clt_batch_dbg1 && (setNames.size() < 2) ;
// enable debug for single-image when clt_batch_dbg1 is on
if (correctionsParameters.clt_batch_dbg1 && (setNames.size() < 2)) {
clt_parameters.batch_run = false; // disable batch_run for single image if clt_batch_dbg1 is on
}
// Do per 4-image set processing
int nSet = 0;
......@@ -8490,8 +8496,7 @@ public class QuadCLT {
referenceExposures, //final double [] referenceExposures, // =eyesisCorrections.calcReferenceExposures(debugLevel); // multiply each image by this and divide by individual (if not NaN)
scaleExposures, // final double [] scaleExposures, // = new double[channelFiles.length]; //
saturation_imp, // final boolean [][] saturation_imp, // = (clt_parameters.sat_level > 0.0)? new boolean[channelFiles.length][] : null;
!batch_dbg, // final boolean batch_mode, // disable any debug images
debugLevel); // final int debugLevel)
debugLevelInner); // final int debugLevel)
// once per quad here
if (imp_srcs == null) continue;
......@@ -8565,7 +8570,7 @@ public class QuadCLT {
rgbParameters,
threadsMax, // maximal number of threads to launch
updateStatus,
debugLevel);
debugLevelInner);
if (ok) {
System.out.println("Adjusting extrinsics");
extrinsicsCLT(
......@@ -8573,8 +8578,7 @@ public class QuadCLT {
false, // adjust_poly,
threadsMax, //final int threadsMax, // maximal number of threads to launch
updateStatus, // final boolean updateStatus,
!batch_dbg, // final boolean batch_mode,
debugLevel); // final int debugLevel)
debugLevelInner); // final int debugLevel)
}
}
if (correctionsParameters.clt_batch_poly) {
......@@ -8590,7 +8594,7 @@ public class QuadCLT {
rgbParameters,
threadsMax, // maximal number of threads to launch
updateStatus,
debugLevel);
debugLevelInner);
if (ok) {
System.out.println("Adjusting polynomial fine crorection");
extrinsicsCLT(
......@@ -8598,8 +8602,7 @@ public class QuadCLT {
true, // adjust_poly,
threadsMax, //final int threadsMax, // maximal number of threads to launch
updateStatus, // final boolean updateStatus,
!batch_dbg, // final boolean batch_mode,
debugLevel); // final int debugLevel)
debugLevelInner); // final int debugLevel)
}
}
......@@ -8618,9 +8621,8 @@ public class QuadCLT {
false, // apply_corr, // calculate and apply additional fine geometry correction
false, // infinity_corr, // calculate and apply geometry correction at infinity
threadsMax, // maximal number of threads to launch
!batch_dbg, // batch_mode
updateStatus,
debugLevel);
debugLevelInner);
}
if (correctionsParameters.clt_batch_explore) {
if (tp != null) tp.resetCLTPasses();
......@@ -8635,7 +8637,7 @@ public class QuadCLT {
rgbParameters,
threadsMax, // maximal number of threads to launch
updateStatus,
debugLevel);
debugLevelInner);
if (ok) {
System.out.println("Explore 3d space");
expandCLTQuad3d( // returns ImagePlus, but it already should be saved/shown
......@@ -8648,8 +8650,7 @@ public class QuadCLT {
rgbParameters,
threadsMax, // maximal number of threads to launch
updateStatus,
!batch_dbg, // final boolean batch_mode,
debugLevel);
debugLevelInner);
} else continue;
} else continue; // if (correctionsParameters.clt_batch_explore)
......@@ -8660,8 +8661,7 @@ public class QuadCLT {
geometryCorrection,
threadsMax,
updateStatus,
!batch_dbg, // batch_mode
debugLevel);
debugLevelInner);
} else continue; // if (correctionsParameters.clt_batch_surf)
......@@ -8671,8 +8671,7 @@ public class QuadCLT {
geometryCorrection,
threadsMax,
updateStatus,
!batch_dbg, // boolean batch_mode,
debugLevel);
debugLevelInner);
if (!ok) continue;
} else continue; // if (correctionsParameters.clt_batch_assign)
......@@ -8683,8 +8682,8 @@ public class QuadCLT {
rgbParameters, // EyesisCorrectionParameters.RGBParameters rgbParameters,
threadsMax, // final int threadsMax, // maximal number of threads to launch
updateStatus, // final boolean updateStatus,
!batch_dbg, // final boolean batch_mode,
debugLevel); // final int debugLevel)
// !clt_parameters.batch_run, // !batch_dbg, // final boolean batch_mode,
debugLevelInner); // final int debugLevel)
if (!ok) continue;
} else continue; // if (correctionsParameters.clt_batch_gen3d)
......
......@@ -663,9 +663,9 @@ public class SuperTiles{
int numMax = 0;
int lo = 0;
int hi = 1;
if ((globalDebugLevel > -1 ) && (nsTile == 795)) {
System.out.println(nsTile);
}
// if ((globalDebugLevel > -1 ) && (nsTile == 795)) {
// System.out.println("getMaxMinMax(): nsTile="+nsTile);
// }
while (hi < numBins) {
// looking for next max
while ((hi < numBins) && (dh[hi] >= dh[hi - 1])) hi++; // flat or higher - continue
......@@ -949,9 +949,9 @@ public class SuperTiles{
}
}
for (int nsTile = 0; nsTile < sTiles; nsTile++){
if (nsTile == 795){
System.out.println("showMaxMinMax(), nsTile="+nsTile);
}
// if (nsTile == 795){
// System.out.println("showMaxMinMax(), nsTile="+nsTile);
// }
int stileY = nsTile / sTilesX;
int stileX = nsTile % sTilesX;
int x0 = stileX * (numBins + 1);
......@@ -1580,6 +1580,9 @@ public class SuperTiles{
final double [][][][] plane_disp_strength = new double [nStiles][][][];
// DEBUG feature:
final double [][] zero_tilts = {{0.0,0.0}}; // set to null for float
if (debugLevel > -1) {
System.out.println("getPlaneDispStrengthsST(x): debugLevel == "+debugLevel);
}
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
......
......@@ -175,6 +175,7 @@ diff_best= 0.06731 diff9= 1.09087 weak_fgnd= 0.22250 flaps= 0.07229 ml_mismatch
return titles;
}
@Override
public String toString()
{
String s = "";
......@@ -334,6 +335,7 @@ diff_best= 0.06731 diff9= 1.09087 weak_fgnd= 0.22250 flaps= 0.07229 ml_mismatch
final AtomicInteger ai = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
for (int nSurfTile = ai.getAndIncrement(); nSurfTile < tone_diff_weight.length; nSurfTile = ai.getAndIncrement()) {
if (nSurfTile >= 0){
......@@ -383,6 +385,7 @@ diff_best= 0.06731 diff9= 1.09087 weak_fgnd= 0.22250 flaps= 0.07229 ml_mismatch
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
for (int dir = ai.getAndIncrement(); dir < 4; dir = ai.getAndIncrement()) {
for (int nSurfTile = 0; nSurfTile < num_tiles; nSurfTile++){
......@@ -803,7 +806,7 @@ diff_best= 0.06731 diff9= 1.09087 weak_fgnd= 0.22250 flaps= 0.07229 ml_mismatch
{
TACosts costs = new TACosts();
int debugLevel = 0;
if (nSurfTile == 51360) { // 44831) { // 47459){
if (nSurfTile == -51360) { // 44831) { // 47459){
System.out.println("getTileCosts() nSurfTile="+nSurfTile);
debugLevel = 1;
}
......@@ -1093,6 +1096,7 @@ diff_best= 0.06731 diff9= 1.09087 weak_fgnd= 0.22250 flaps= 0.07229 ml_mismatch
if (noEdge) {
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
for (int nSurfTile = ai.getAndIncrement(); nSurfTile < num_tiles; nSurfTile = ai.getAndIncrement()) {
if (tileData[nSurfTile] != null){
......@@ -1122,6 +1126,7 @@ diff_best= 0.06731 diff9= 1.09087 weak_fgnd= 0.22250 flaps= 0.07229 ml_mismatch
ai_numThread.set(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
int numThread = ai_numThread.getAndIncrement(); // unique number of thread to write to rslt_diffs[numThread]
for (int iTile = ai.getAndIncrement(); iTile < tile_indices[fnSeries].length; iTile = ai.getAndIncrement()) {
......@@ -1305,6 +1310,7 @@ diff_best= 0.06731 diff9= 1.09087 weak_fgnd= 0.22250 flaps= 0.07229 ml_mismatch
if (noEdge) {
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
for (int nSurfTile = ai.getAndIncrement(); nSurfTile < num_tiles; nSurfTile = ai.getAndIncrement()) {
if (tileData[nSurfTile] != null){
......@@ -1334,6 +1340,7 @@ diff_best= 0.06731 diff9= 1.09087 weak_fgnd= 0.22250 flaps= 0.07229 ml_mismatch
ai_numThread.set(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
int numThread = ai_numThread.getAndIncrement(); // unique number of thread to write to rslt_diffs[numThread]
for (int iTile = ai.getAndIncrement(); iTile < tile_indices[fnSeries].length; iTile = ai.getAndIncrement()) {
......
......@@ -3504,12 +3504,14 @@ public class TilePlanes {
System.out.println("mergePlaneToThisWorld()");
}
if (wvalues == null ) {
if (debugLevel > -2) {
System.out.println("mergePlaneToThisWorld(): wvalues=null:\n"+toString());
}
return null;
}
if (otherPd.wvalues == null ) {
System.out.println("mergePlaneToThisWorld(): otherPd.wvalues=null:\n"+otherPd.toString());
if (debugLevel > -1) System.out.println("mergePlaneToThisWorld(): otherPd.wvalues=null:\n"+otherPd.toString());
return null;
}
double [][] this_eig_avals = {
......@@ -4036,6 +4038,9 @@ public class TilePlanes {
if (debugLevel > 2) {
debugLevel += 0; // +=1 // no show all eigen stuff (debugLevel > 3)
}
if (debugLevel > 0) {
System.out.println("Debug debugLevel"); // +=1 // no show all eigen stuff (debugLevel > 3)
}
// first make a plane from all tiles
ArrayList<PlaneData> st_planes = new ArrayList<PlaneData>();
......
......@@ -4572,9 +4572,10 @@ public class TileProcessor {
GeometryCorrection geometryCorrection,
final int threadsMax, // maximal number of threads to launch
final boolean updateStatus,
final boolean batch_mode,
// final boolean batch_mode,
final int debugLevel)
{
final boolean batch_mode = clt_parameters.batch_run;
final int debugLevelInner = batch_mode ? -5: debugLevel;
trimCLTPasses(); // make possible to run this method multiple times - remove extra passes added by it last time
CLTPass3d scan_prev = clt_3d_passes.get(clt_3d_passes.size() -1); // get last one
......@@ -5140,9 +5141,9 @@ public class TileProcessor {
GeometryCorrection geometryCorrection,
final int threadsMax, // maximal number of threads to launch
final boolean updateStatus,
final boolean batch_mode,
final int debugLevel)
{
final boolean batch_mode = clt_parameters.batch_run; //disable any debug images
trimCLTPasses(); // make possible to run this method multiple time - remove extra passes added by it last time
CLTPass3d scan_prev = clt_3d_passes.get(clt_3d_passes.size() -1); // get last one
......@@ -5311,7 +5312,7 @@ public class TileProcessor {
clt_parameters.stHighMix, // stHighMix = 0.4; // Consider merging initial planes if jumps between ratio above
world_hor, // final double [] world_hor, // horizontal plane normal (default [0.0, 1.0, 0.0])
clt_parameters.show_histograms, // final boolean show_histograms,
1, // -1, // debugLevel, // final int debugLevel)
clt_parameters.batch_run?-1:1, // -1, // debugLevel, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
// showDoubleFloatArrays sdfa_instance = null;
......@@ -5334,7 +5335,7 @@ public class TileProcessor {
lp.conditionSuperTiles(
st.planes, // final TilePlanes.PlaneData [][] planes,
10, // final int max_num_merge_try,
0); // 1); // debugLevel); // final int debugLevel);
clt_parameters.batch_run?-2:0); // 1); // debugLevel); // final int debugLevel);
// Used only by conflicts (not processed currently)
lp.calcStarValueStrength(
true, // boolean set_start_planes,
......@@ -5398,7 +5399,7 @@ public class TileProcessor {
clt_parameters.plDiscrXMedian, // final double plDiscrXMedian, // = 1.5; // Remove outliers from the final selection that have distance more than scaled median
debugLevel, // -1, // debugLevel, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.batch_run ? -1 : clt_parameters.tileX, // clt_parameters.tileX,
clt_parameters.tileY);
// condition the redefined planes
......@@ -6064,9 +6065,9 @@ public class TileProcessor {
GeometryCorrection geometryCorrection,
final int threadsMax, // maximal number of threads to launch
final boolean updateStatus,
final boolean batch_mode,
final int debugLevel)
{
final boolean batch_mode = clt_parameters.batch_run; //disable any debug images
int debugLevelInner = batch_mode ? -5: debugLevel;
CLTPass3d scan_bg = clt_3d_passes.get(bg_scan_index); //
CLTPass3d scan_prev = clt_3d_passes.get(clt_3d_passes.size() -1); // get last one
......@@ -6146,7 +6147,7 @@ public class TileProcessor {
true, // final boolean keep_raw_fg, // do not replace raw tiles by the plates, if raw is closer (like poles)
0.0, // final double scale_filtered_strength_pre, // scale plate_ds[1] before comparing to raw strength
0.0,// final double scale_filtered_strength_post,// scale plate_ds[1] when replacing raw (generally plate_ds is more reliable if it exists)
true, // clt_parameters.show_filter_scan,
batch_mode, // true, // clt_parameters.show_filter_scan,
clt_parameters.min_clstr_seed, // clt_parameters.min_clstr_seed
clt_parameters.min_clstr_weight, // double min_weight // minimal total weight of the cluster
clt_parameters.min_clstr_max, // double min_max_weight // minimal value of the maximal strengh in the cluster
......
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