Loading src/main/java/AlignmentCorrection.java +1036 −47 File changed.Preview size limit exceeded, changes collapsed. Show changes src/main/java/EyesisCorrectionParameters.java +109 −4 Original line number Original line Diff line number Diff line Loading @@ -2008,20 +2008,41 @@ public class EyesisCorrectionParameters { public double fcorr_disp_diff = 1.5; // consider only tiles with absolute residual disparity lower than public double fcorr_disp_diff = 1.5; // consider only tiles with absolute residual disparity lower than public boolean fcorr_quadratic = true; // Use quadratic polynomial for fine correction (false - only linear) public boolean fcorr_quadratic = true; // Use quadratic polynomial for fine correction (false - only linear) public boolean fcorr_ignore = false; // Ignore currently calculated fine correction public boolean fcorr_ignore = false; // Ignore currently calculated fine correction public double fcorr_inf_strength = 0.20 ; // Minimal correlation strength to use for infinity correction public double fcorr_inf_strength = 0.20 ; // Minimal correlation strength to use for infinity correction public double fcorr_inf_diff = 0.2; // Disparity half-range for infinity public double fcorr_inf_diff = 0.2; // Disparity half-range for infinity public boolean fcorr_inf_quad = true; // Use quadratic polynomial for infinity correction (false - only linear) public boolean fcorr_inf_quad = true; // Use quadratic polynomial for infinity correction (false - only linear) public boolean fcorr_inf_vert = false; // Correct infinity in vertical direction (false - only horizontal) public boolean fcorr_inf_vert = false; // Correct infinity in vertical direction (false - only horizontal) //-- public boolean inf_disp_apply = true; // Apply disparity correction to zero at infinity public boolean inf_mism_apply = true; // Apply lazy eye correction at infinity public int inf_iters = 20; // Infinity extraction - maximum iterations public double inf_final_diff = 0.0001; // Coefficients maximal increment to exit iterations public double inf_far_pull = 0.0; // include farther tiles than tolerance, but scale their weights // infinity filter public double inf_str_pow = 1.0; // Strength power for infinity filtering public int inf_smpl_side = 3; // Sample size (side of a square) for infinity filtering public int inf_smpl_num = 5; // Number after removing worst (should be >1) for infinity filtering public double inf_smpl_rms = 0.1; // Maximal RMS of the remaining tiles in a sample for infinity filtering //Histogram infinity filter public int ih_smpl_step = 8; // Square sample step (50% overlap) public double ih_disp_min = -1.0; // Minimal disparity public double ih_disp_step = 0.05; // Disparity step public int ih_num_bins = 40; // Number of bins public double ih_sigma = 0.1; // Gaussian sigma (in disparity pixels) public double ih_max_diff = 0.1; // Keep samples within this difference from farthest maximum public int ih_min_samples = 10; // Minimal number of remaining samples public boolean ih_norm_center = true; // Replace samples with a single average with equal weight // old fcorr parameters, reuse? public int fcorr_sample_size = 32; // Use square this size side to detect outliers public int fcorr_sample_size = 32; // Use square this size side to detect outliers public int fcorr_mintiles = 8; // Keep tiles only if there are more in each square public int fcorr_mintiles = 8; // Keep tiles only if there are more in each square public double fcorr_reloutliers = 0.5; // Remove this fraction of tiles from each sample public double fcorr_reloutliers = 0.5; // Remove this fraction of tiles from each sample public double fcorr_sigma = 20.0; // Gaussian blur channel mismatch data public double fcorr_sigma = 20.0; // Gaussian blur channel mismatch data public double corr_magic_scale = 0.85; // reported correlation offset vs. actual one (not yet understood) public double corr_magic_scale = 0.85; // reported correlation offset vs. actual one (not yet understood) // 3d reconstruction // 3d reconstruction Loading Loading @@ -2525,6 +2546,25 @@ public class EyesisCorrectionParameters { properties.setProperty(prefix+"fcorr_inf_quad", this.fcorr_inf_quad+""); properties.setProperty(prefix+"fcorr_inf_quad", this.fcorr_inf_quad+""); properties.setProperty(prefix+"fcorr_inf_vert", this.fcorr_inf_vert+""); properties.setProperty(prefix+"fcorr_inf_vert", this.fcorr_inf_vert+""); properties.setProperty(prefix+"inf_disp_apply", this.inf_disp_apply+""); properties.setProperty(prefix+"inf_mism_apply", this.inf_mism_apply+""); properties.setProperty(prefix+"inf_iters", this.inf_iters+""); properties.setProperty(prefix+"inf_final_diff", this.inf_final_diff +""); properties.setProperty(prefix+"inf_far_pull", this.inf_far_pull +""); properties.setProperty(prefix+"inf_str_pow", this.inf_str_pow +""); properties.setProperty(prefix+"inf_smpl_side", this.inf_smpl_side+""); properties.setProperty(prefix+"inf_smpl_num", this.inf_smpl_num+""); properties.setProperty(prefix+"inf_smpl_rms", this.inf_smpl_rms +""); properties.setProperty(prefix+"ih_smpl_step", this.ih_smpl_step+""); properties.setProperty(prefix+"ih_disp_min", this.ih_disp_min +""); properties.setProperty(prefix+"ih_disp_step", this.ih_disp_step +""); properties.setProperty(prefix+"ih_num_bins", this.ih_num_bins+""); properties.setProperty(prefix+"ih_sigma", this.ih_sigma +""); properties.setProperty(prefix+"ih_max_diff", this.ih_max_diff +""); properties.setProperty(prefix+"ih_min_samples", this.ih_min_samples+""); properties.setProperty(prefix+"ih_norm_center", this.ih_norm_center+""); properties.setProperty(prefix+"fcorr_sample_size",this.fcorr_sample_size+""); properties.setProperty(prefix+"fcorr_sample_size",this.fcorr_sample_size+""); properties.setProperty(prefix+"fcorr_mintiles", this.fcorr_mintiles+""); properties.setProperty(prefix+"fcorr_mintiles", this.fcorr_mintiles+""); properties.setProperty(prefix+"fcorr_reloutliers",this.fcorr_reloutliers +""); properties.setProperty(prefix+"fcorr_reloutliers",this.fcorr_reloutliers +""); Loading Loading @@ -2995,6 +3035,30 @@ public class EyesisCorrectionParameters { if (properties.getProperty(prefix+"fcorr_inf_quad")!=null) this.fcorr_inf_quad=Boolean.parseBoolean(properties.getProperty(prefix+"fcorr_inf_quad")); if (properties.getProperty(prefix+"fcorr_inf_quad")!=null) this.fcorr_inf_quad=Boolean.parseBoolean(properties.getProperty(prefix+"fcorr_inf_quad")); if (properties.getProperty(prefix+"fcorr_inf_vert")!=null) this.fcorr_inf_vert=Boolean.parseBoolean(properties.getProperty(prefix+"fcorr_inf_vert")); if (properties.getProperty(prefix+"fcorr_inf_vert")!=null) this.fcorr_inf_vert=Boolean.parseBoolean(properties.getProperty(prefix+"fcorr_inf_vert")); if (properties.getProperty(prefix+"inf_disp_apply")!=null) this.inf_disp_apply=Boolean.parseBoolean(properties.getProperty(prefix+"inf_disp_apply")); if (properties.getProperty(prefix+"inf_mism_apply")!=null) this.inf_mism_apply=Boolean.parseBoolean(properties.getProperty(prefix+"inf_mism_apply")); if (properties.getProperty(prefix+"inf_iters")!=null) this.inf_iters=Integer.parseInt(properties.getProperty(prefix+"inf_iters")); if (properties.getProperty(prefix+"inf_final_diff")!=null) this.inf_final_diff=Double.parseDouble(properties.getProperty(prefix+"inf_final_diff")); if (properties.getProperty(prefix+"inf_far_pull")!=null) this.inf_far_pull=Double.parseDouble(properties.getProperty(prefix+"inf_far_pull")); if (properties.getProperty(prefix+"inf_str_pow")!=null) this.inf_str_pow=Double.parseDouble(properties.getProperty(prefix+"inf_str_pow")); if (properties.getProperty(prefix+"inf_smpl_side")!=null) this.inf_smpl_side=Integer.parseInt(properties.getProperty(prefix+"inf_smpl_side")); if (properties.getProperty(prefix+"inf_smpl_num")!=null) this.inf_smpl_num=Integer.parseInt(properties.getProperty(prefix+"inf_smpl_num")); if (properties.getProperty(prefix+"inf_smpl_rms")!=null) this.inf_smpl_rms=Double.parseDouble(properties.getProperty(prefix+"inf_smpl_rms")); if (properties.getProperty(prefix+"ih_smpl_step")!=null) this.ih_smpl_step=Integer.parseInt(properties.getProperty(prefix+"ih_smpl_step")); if (properties.getProperty(prefix+"ih_disp_min")!=null) this.ih_disp_min=Double.parseDouble(properties.getProperty(prefix+"ih_disp_min")); if (properties.getProperty(prefix+"ih_disp_step")!=null) this.ih_disp_step=Double.parseDouble(properties.getProperty(prefix+"ih_disp_step")); if (properties.getProperty(prefix+"ih_num_bins")!=null) this.ih_num_bins=Integer.parseInt(properties.getProperty(prefix+"ih_num_bins")); if (properties.getProperty(prefix+"ih_sigma")!=null) this.ih_sigma=Double.parseDouble(properties.getProperty(prefix+"ih_sigma")); if (properties.getProperty(prefix+"ih_max_diff")!=null) this.ih_max_diff=Double.parseDouble(properties.getProperty(prefix+"ih_max_diff")); if (properties.getProperty(prefix+"ih_min_samples")!=null) this.ih_min_samples=Integer.parseInt(properties.getProperty(prefix+"ih_min_samples")); if (properties.getProperty(prefix+"ih_norm_center")!=null) this.ih_norm_center=Boolean.parseBoolean(properties.getProperty(prefix+"ih_norm_center")); if (properties.getProperty(prefix+"fcorr_sample_size")!=null) this.fcorr_sample_size=Integer.parseInt(properties.getProperty(prefix+"fcorr_sample_size")); if (properties.getProperty(prefix+"fcorr_sample_size")!=null) this.fcorr_sample_size=Integer.parseInt(properties.getProperty(prefix+"fcorr_sample_size")); if (properties.getProperty(prefix+"fcorr_mintiles")!=null) this.fcorr_mintiles=Integer.parseInt(properties.getProperty(prefix+"fcorr_mintiles")); if (properties.getProperty(prefix+"fcorr_mintiles")!=null) this.fcorr_mintiles=Integer.parseInt(properties.getProperty(prefix+"fcorr_mintiles")); if (properties.getProperty(prefix+"fcorr_reloutliers")!=null) this.fcorr_reloutliers=Double.parseDouble(properties.getProperty(prefix+"fcorr_reloutliers")); if (properties.getProperty(prefix+"fcorr_reloutliers")!=null) this.fcorr_reloutliers=Double.parseDouble(properties.getProperty(prefix+"fcorr_reloutliers")); Loading Loading @@ -3480,6 +3544,27 @@ public class EyesisCorrectionParameters { gd.addCheckbox ("Use quadratic polynomial for infinity correction (false - only linear)", this.fcorr_inf_quad); gd.addCheckbox ("Use quadratic polynomial for infinity correction (false - only linear)", this.fcorr_inf_quad); gd.addCheckbox ("Correct infinity in vertical direction (false - only horizontal)", this.fcorr_inf_vert); gd.addCheckbox ("Correct infinity in vertical direction (false - only horizontal)", this.fcorr_inf_vert); gd.addCheckbox ("Apply disparity correction to zero at infinity", this.inf_disp_apply); gd.addCheckbox ("Apply lazy eye correction at infinity", this.inf_mism_apply); gd.addNumericField("Infinity extraction - maximum iterations", this.inf_iters, 0); gd.addNumericField("Coefficients maximal increment to exit iterations", this.inf_final_diff, 6); gd.addNumericField("Include farther tiles than tolerance, but scale their weights", this.inf_far_pull, 3); gd.addMessage ("--- Infinity filter ---"); gd.addNumericField("Strength power", this.inf_str_pow, 3); gd.addNumericField("Sample size (side of a square)", this.inf_smpl_side, 0); gd.addNumericField("Number after removing worst (should be >1)", this.inf_smpl_num, 0); gd.addNumericField("Maximal RMS of the remaining tiles in a sample", this.inf_smpl_rms, 3); gd.addMessage ("--- Infinity histogram filter ---"); gd.addNumericField("Square sample step (50% overlap)", this.ih_smpl_step, 0); gd.addNumericField("Histogram minimal disparity", this.ih_disp_min, 3); gd.addNumericField("Histogram disparity step", this.ih_disp_step, 3); gd.addNumericField("Histogram number of bins", this.ih_num_bins, 0); gd.addNumericField("Histogram Gaussian sigma (in disparity pixels)", this.ih_sigma, 3); gd.addNumericField("Keep samples within this difference from farthest maximum", this.ih_max_diff, 3); gd.addNumericField("Minimal number of remaining samples", this.ih_min_samples, 0); gd.addCheckbox ("Replace samples with a single average with equal weight", this.ih_norm_center); gd.addNumericField("Use square this size side to detect outliers", this.fcorr_sample_size, 0); gd.addNumericField("Use square this size side to detect outliers", this.fcorr_sample_size, 0); gd.addNumericField("Keep tiles only if there are more in each square", this.fcorr_mintiles, 0); gd.addNumericField("Keep tiles only if there are more in each square", this.fcorr_mintiles, 0); gd.addNumericField("Remove this fraction of tiles from each sample", this.fcorr_reloutliers, 3); gd.addNumericField("Remove this fraction of tiles from each sample", this.fcorr_reloutliers, 3); Loading Loading @@ -3973,6 +4058,26 @@ public class EyesisCorrectionParameters { this.fcorr_inf_quad= gd.getNextBoolean(); this.fcorr_inf_quad= gd.getNextBoolean(); this.fcorr_inf_vert= gd.getNextBoolean(); this.fcorr_inf_vert= gd.getNextBoolean(); this.inf_disp_apply= gd.getNextBoolean(); this.inf_mism_apply= gd.getNextBoolean(); this.inf_iters= (int) gd.getNextNumber(); this.inf_final_diff= gd.getNextNumber(); this.inf_far_pull= gd.getNextNumber(); this.inf_str_pow= gd.getNextNumber(); this.inf_smpl_side= (int) gd.getNextNumber(); this.inf_smpl_num= (int) gd.getNextNumber(); this.inf_smpl_rms= gd.getNextNumber(); this.ih_smpl_step= (int) gd.getNextNumber(); this.ih_disp_min= gd.getNextNumber(); this.ih_disp_step= gd.getNextNumber(); this.ih_num_bins= (int) gd.getNextNumber(); this.ih_sigma= gd.getNextNumber(); this.ih_max_diff= gd.getNextNumber(); this.ih_min_samples= (int) gd.getNextNumber(); this.ih_norm_center= gd.getNextBoolean(); this.fcorr_sample_size= (int)gd.getNextNumber(); this.fcorr_sample_size= (int)gd.getNextNumber(); this.fcorr_mintiles= (int) gd.getNextNumber(); this.fcorr_mintiles= (int) gd.getNextNumber(); this.fcorr_reloutliers= gd.getNextNumber(); this.fcorr_reloutliers= gd.getNextNumber(); Loading src/main/java/Eyesis_Correction.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -4609,10 +4609,16 @@ private Panel panel1, System.out.println("Created new QuadCLT instance, will need to read CLT kernels"); System.out.println("Created new QuadCLT instance, will need to read CLT kernels"); } } } } /* QUAD_CLT.process_fine_corr( QUAD_CLT.process_fine_corr( dry_run, // boolean dry_run dry_run, // boolean dry_run CLT_PARAMETERS, CLT_PARAMETERS, DEBUG_LEVEL); DEBUG_LEVEL); */ QUAD_CLT.processLazyEye( CLT_PARAMETERS, DEBUG_LEVEL); return; return; } else if (label.equals("CLT ext infinity corr")) { } else if (label.equals("CLT ext infinity corr")) { Loading src/main/java/ImageDtt.java +3 −2 Original line number Original line Diff line number Diff line Loading @@ -964,6 +964,7 @@ public class ImageDtt { final double [][][][][] clt_corr_partial,// [tilesY][tilesX][quad]color][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate final double [][][][][] clt_corr_partial,// [tilesY][tilesX][quad]color][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate // [tilesY][tilesX] should be set by caller // [tilesY][tilesX] should be set by caller final double [][] clt_mismatch, // [12][tilesY * tilesX] // transpose unapplied. null - do not calculate final double [][] clt_mismatch, // [12][tilesY * tilesX] // transpose unapplied. null - do not calculate // values in the "main" directions have disparity (*_CM) subtracted, in the perpendicular - as is final double [][] disparity_map, // [8][tilesY][tilesX], only [6][] is needed on input or null - do not calculate final double [][] disparity_map, // [8][tilesY][tilesX], only [6][] is needed on input or null - do not calculate // last 2 - contrast, avg/ "geometric average) // last 2 - contrast, avg/ "geometric average) Loading Loading @@ -1606,11 +1607,11 @@ public class ImageDtt { double yp,xp; double yp,xp; if (corr_pairs[pair][2] > 0){ // transpose - switch x <-> y if (corr_pairs[pair][2] > 0){ // transpose - switch x <-> y yp = transform_size - 1 -corr_max_XYmp[0] - disparity_map[DISPARITY_INDEX_CM][tIndex]; yp = transform_size - 1 -corr_max_XYmp[0] - disparity_map[DISPARITY_INDEX_CM][tIndex]; xp = transform_size - 1 -corr_max_XYmp[1]; // do not campare to average - it should be 0 anyway xp = transform_size - 1 -corr_max_XYmp[1]; // do not compare to average - it should be 0 anyway } else { } else { xp = transform_size - 1 -corr_max_XYmp[0] - disparity_map[DISPARITY_INDEX_CM][tIndex]; xp = transform_size - 1 -corr_max_XYmp[0] - disparity_map[DISPARITY_INDEX_CM][tIndex]; yp = transform_size - 1 -corr_max_XYmp[1]; // do not campare to average - it should be 0 anyway yp = transform_size - 1 -corr_max_XYmp[1]; // do not compare to average - it should be 0 anyway } } double strength = tcorr_partial[pair][numcol][max_index]; // using the new location than for combined double strength = tcorr_partial[pair][numcol][max_index]; // using the new location than for combined clt_mismatch[3*pair + 0 ][tIndex] = xp; clt_mismatch[3*pair + 0 ][tIndex] = xp; Loading src/main/java/QuadCLT.java +92 −16 Original line number Original line Diff line number Diff line Loading @@ -5237,22 +5237,22 @@ public class QuadCLT { double [][][] new_corr = ac.infinityCorrection( double [][][] new_corr = ac.infinityCorrection( clt_parameters.fcorr_inf_strength, // final double min_strenth, clt_parameters.fcorr_inf_strength, // final double min_strenth, clt_parameters.fcorr_inf_diff, // final double max_diff, clt_parameters.fcorr_inf_diff, // final double max_diff, 20, // 0, // final int max_iterations, clt_parameters.inf_iters, // 20, // 0, // final int max_iterations, 0.0001, // final double max_coeff_diff, clt_parameters.inf_final_diff, // 0.0001, // final double max_coeff_diff, 0.0, // 0.25, // final double far_pull, // = 0.2; // 1; // 0.5; clt_parameters.inf_far_pull, // 0.0, // 0.25, // final double far_pull, // = 0.2; // 1; // 0.5; 1.0, // final double strength_pow, clt_parameters.inf_str_pow, // 1.0, // final double strength_pow, 3, // final int smplSide, // = 2; // Sample size (side of a square) clt_parameters.inf_smpl_side, // 3, // final int smplSide, // = 2; // Sample size (side of a square) 5, // final int smplNum, // = 3; // Number after removing worst (should be >1) clt_parameters.inf_smpl_num, // 5, // final int smplNum, // = 3; // Number after removing worst (should be >1) 0.1, // 0.05, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample clt_parameters.inf_smpl_rms, // 0.1, // 0.05, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // histogram parameters // histogram parameters 8, // final int hist_smpl_side, // 8 x8 masked, 16x16 sampled clt_parameters.ih_smpl_step, // 8, // final int hist_smpl_side, // 8 x8 masked, 16x16 sampled -1.0, // final double hist_disp_min, clt_parameters.ih_disp_min, // -1.0, // final double hist_disp_min, 0.05, // final double hist_disp_step, clt_parameters.ih_disp_step, // 0.05, // final double hist_disp_step, 40, // final int hist_num_bins, clt_parameters.ih_num_bins, // 40, // final int hist_num_bins, 0.1, // final double hist_sigma, clt_parameters.ih_sigma, // 0.1, // final double hist_sigma, 0.1, // final double hist_max_diff, clt_parameters.ih_max_diff, // 0.1, // final double hist_max_diff, 10, // final int hist_min_samples, clt_parameters.ih_min_samples, // 10, // final int hist_min_samples, true, // final boolean hist_norm_center, // if there are more tiles that fit than min_samples, replace with clt_parameters.ih_norm_center, // true, // final boolean hist_norm_center, // if there are more tiles that fit than min_samples, replace with clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters, clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters, inf_disp_strength, // double [][] disp_strength, inf_disp_strength, // double [][] disp_strength, tilesX, // int tilesX, tilesX, // int tilesX, Loading @@ -5260,6 +5260,8 @@ public class QuadCLT { debugLevel + 1); // int debugLevel) debugLevel + 1); // int debugLevel) if (debugLevel > -1){ if (debugLevel > -1){ System.out.println("process_infinity_corr(): ready to apply infinity correction"); System.out.println("process_infinity_corr(): ready to apply infinity correction"); show_fine_corr( show_fine_corr( Loading @@ -5274,11 +5276,85 @@ public class QuadCLT { debugLevel + 2); debugLevel + 2); } } } } public void processLazyEye( EyesisCorrectionParameters.CLTParameters clt_parameters, int debugLevel ) { ImagePlus imp_src = WindowManager.getCurrentImage(); if (imp_src==null){ IJ.showMessage("Error","2*n-layer file with disparities/strengthspairs measured at infinity is required"); return; } ImageStack disp_strength_stack= imp_src.getStack(); final int tilesX = disp_strength_stack.getWidth(); // tp.getTilesX(); final int tilesY = disp_strength_stack.getHeight(); // tp.getTilesY(); final int nTiles =tilesX * tilesY; AlignmentCorrection ac = new AlignmentCorrection(this); double [][] scans = ac.getFineCorrFromImage( imp_src, // 0.2, // double min_comp_strength, // 0.2 debugLevel); double [][][] new_corr = ac.lazyEyeCorrection( clt_parameters.fcorr_inf_strength, // final double min_strenth, clt_parameters.fcorr_inf_diff, // final double max_diff, 1.3, // final double comp_strength_var, clt_parameters.inf_iters, // 20, // 0, // final int max_iterations, clt_parameters.inf_final_diff, // 0.0001, // final double max_coeff_diff, clt_parameters.inf_far_pull, // 0.0, // 0.25, // final double far_pull, // = 0.2; // 1; // 0.5; clt_parameters.inf_str_pow, // 1.0, // final double strength_pow, 1.5, // final double lazyEyeCompDiff, // clt_parameters.fcorr_disp_diff clt_parameters.inf_smpl_side, // final int lazyEyeSmplSide, // = 2; // Sample size (side of a square) clt_parameters.inf_smpl_num, // final int lazyEyeSmplNum, // = 3; // Number after removing worst (should be >1) 0.1, // final double lazyEyeSmplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample 0.2, // final double lazyEyeDispVariation, // 0.2, maximal full disparity difference between tgh tile and 8 neighborxs clt_parameters.inf_smpl_side, // 3, // final int smplSide, // = 2; // Sample size (side of a square) clt_parameters.inf_smpl_num, // 5, // final int smplNum, // = 3; // Number after removing worst (should be >1) clt_parameters.inf_smpl_rms, // 0.1, // 0.05, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // histogram parameters clt_parameters.ih_smpl_step, // 8, // final int hist_smpl_side, // 8 x8 masked, 16x16 sampled clt_parameters.ih_disp_min, // -1.0, // final double hist_disp_min, clt_parameters.ih_disp_step, // 0.05, // final double hist_disp_step, clt_parameters.ih_num_bins, // 40, // final int hist_num_bins, clt_parameters.ih_sigma, // 0.1, // final double hist_sigma, clt_parameters.ih_max_diff, // 0.1, // final double hist_max_diff, clt_parameters.ih_min_samples, // 10, // final int hist_min_samples, clt_parameters.ih_norm_center, // true, // final boolean hist_norm_center, // if there are more tiles that fit than min_samples, replace with 0.5, // final double inf_fraction, // fraction of the weight for the infinity tiles clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters, scans, // double [][] disp_strength, tilesX, // int tilesX, clt_parameters.corr_magic_scale, // double magic_coeff, // still not understood coefficent that reduces reported disparity value. Seems to be around 8.5 debugLevel + 1); // int debugLevel) if (debugLevel > -100){ apply_fine_corr( new_corr, debugLevel + 2); } } public void process_fine_corr( public void process_fine_corr( boolean dry_run, boolean dry_run, EyesisCorrectionParameters.CLTParameters clt_parameters, EyesisCorrectionParameters.CLTParameters clt_parameters, int debugLevel int debugLevel ) { ) { if (dry_run) { AlignmentCorrection ac = new AlignmentCorrection(this); ac.process_fine_corr( dry_run, // boolean dry_run, clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters, debugLevel); // int debugLevel return; } ImagePlus imp_src = WindowManager.getCurrentImage(); ImagePlus imp_src = WindowManager.getCurrentImage(); if (imp_src==null){ if (imp_src==null){ IJ.showMessage("Error","12*n-layer file clt_mismatches is required"); IJ.showMessage("Error","12*n-layer file clt_mismatches is required"); Loading Loading
src/main/java/AlignmentCorrection.java +1036 −47 File changed.Preview size limit exceeded, changes collapsed. Show changes
src/main/java/EyesisCorrectionParameters.java +109 −4 Original line number Original line Diff line number Diff line Loading @@ -2008,20 +2008,41 @@ public class EyesisCorrectionParameters { public double fcorr_disp_diff = 1.5; // consider only tiles with absolute residual disparity lower than public double fcorr_disp_diff = 1.5; // consider only tiles with absolute residual disparity lower than public boolean fcorr_quadratic = true; // Use quadratic polynomial for fine correction (false - only linear) public boolean fcorr_quadratic = true; // Use quadratic polynomial for fine correction (false - only linear) public boolean fcorr_ignore = false; // Ignore currently calculated fine correction public boolean fcorr_ignore = false; // Ignore currently calculated fine correction public double fcorr_inf_strength = 0.20 ; // Minimal correlation strength to use for infinity correction public double fcorr_inf_strength = 0.20 ; // Minimal correlation strength to use for infinity correction public double fcorr_inf_diff = 0.2; // Disparity half-range for infinity public double fcorr_inf_diff = 0.2; // Disparity half-range for infinity public boolean fcorr_inf_quad = true; // Use quadratic polynomial for infinity correction (false - only linear) public boolean fcorr_inf_quad = true; // Use quadratic polynomial for infinity correction (false - only linear) public boolean fcorr_inf_vert = false; // Correct infinity in vertical direction (false - only horizontal) public boolean fcorr_inf_vert = false; // Correct infinity in vertical direction (false - only horizontal) //-- public boolean inf_disp_apply = true; // Apply disparity correction to zero at infinity public boolean inf_mism_apply = true; // Apply lazy eye correction at infinity public int inf_iters = 20; // Infinity extraction - maximum iterations public double inf_final_diff = 0.0001; // Coefficients maximal increment to exit iterations public double inf_far_pull = 0.0; // include farther tiles than tolerance, but scale their weights // infinity filter public double inf_str_pow = 1.0; // Strength power for infinity filtering public int inf_smpl_side = 3; // Sample size (side of a square) for infinity filtering public int inf_smpl_num = 5; // Number after removing worst (should be >1) for infinity filtering public double inf_smpl_rms = 0.1; // Maximal RMS of the remaining tiles in a sample for infinity filtering //Histogram infinity filter public int ih_smpl_step = 8; // Square sample step (50% overlap) public double ih_disp_min = -1.0; // Minimal disparity public double ih_disp_step = 0.05; // Disparity step public int ih_num_bins = 40; // Number of bins public double ih_sigma = 0.1; // Gaussian sigma (in disparity pixels) public double ih_max_diff = 0.1; // Keep samples within this difference from farthest maximum public int ih_min_samples = 10; // Minimal number of remaining samples public boolean ih_norm_center = true; // Replace samples with a single average with equal weight // old fcorr parameters, reuse? public int fcorr_sample_size = 32; // Use square this size side to detect outliers public int fcorr_sample_size = 32; // Use square this size side to detect outliers public int fcorr_mintiles = 8; // Keep tiles only if there are more in each square public int fcorr_mintiles = 8; // Keep tiles only if there are more in each square public double fcorr_reloutliers = 0.5; // Remove this fraction of tiles from each sample public double fcorr_reloutliers = 0.5; // Remove this fraction of tiles from each sample public double fcorr_sigma = 20.0; // Gaussian blur channel mismatch data public double fcorr_sigma = 20.0; // Gaussian blur channel mismatch data public double corr_magic_scale = 0.85; // reported correlation offset vs. actual one (not yet understood) public double corr_magic_scale = 0.85; // reported correlation offset vs. actual one (not yet understood) // 3d reconstruction // 3d reconstruction Loading Loading @@ -2525,6 +2546,25 @@ public class EyesisCorrectionParameters { properties.setProperty(prefix+"fcorr_inf_quad", this.fcorr_inf_quad+""); properties.setProperty(prefix+"fcorr_inf_quad", this.fcorr_inf_quad+""); properties.setProperty(prefix+"fcorr_inf_vert", this.fcorr_inf_vert+""); properties.setProperty(prefix+"fcorr_inf_vert", this.fcorr_inf_vert+""); properties.setProperty(prefix+"inf_disp_apply", this.inf_disp_apply+""); properties.setProperty(prefix+"inf_mism_apply", this.inf_mism_apply+""); properties.setProperty(prefix+"inf_iters", this.inf_iters+""); properties.setProperty(prefix+"inf_final_diff", this.inf_final_diff +""); properties.setProperty(prefix+"inf_far_pull", this.inf_far_pull +""); properties.setProperty(prefix+"inf_str_pow", this.inf_str_pow +""); properties.setProperty(prefix+"inf_smpl_side", this.inf_smpl_side+""); properties.setProperty(prefix+"inf_smpl_num", this.inf_smpl_num+""); properties.setProperty(prefix+"inf_smpl_rms", this.inf_smpl_rms +""); properties.setProperty(prefix+"ih_smpl_step", this.ih_smpl_step+""); properties.setProperty(prefix+"ih_disp_min", this.ih_disp_min +""); properties.setProperty(prefix+"ih_disp_step", this.ih_disp_step +""); properties.setProperty(prefix+"ih_num_bins", this.ih_num_bins+""); properties.setProperty(prefix+"ih_sigma", this.ih_sigma +""); properties.setProperty(prefix+"ih_max_diff", this.ih_max_diff +""); properties.setProperty(prefix+"ih_min_samples", this.ih_min_samples+""); properties.setProperty(prefix+"ih_norm_center", this.ih_norm_center+""); properties.setProperty(prefix+"fcorr_sample_size",this.fcorr_sample_size+""); properties.setProperty(prefix+"fcorr_sample_size",this.fcorr_sample_size+""); properties.setProperty(prefix+"fcorr_mintiles", this.fcorr_mintiles+""); properties.setProperty(prefix+"fcorr_mintiles", this.fcorr_mintiles+""); properties.setProperty(prefix+"fcorr_reloutliers",this.fcorr_reloutliers +""); properties.setProperty(prefix+"fcorr_reloutliers",this.fcorr_reloutliers +""); Loading Loading @@ -2995,6 +3035,30 @@ public class EyesisCorrectionParameters { if (properties.getProperty(prefix+"fcorr_inf_quad")!=null) this.fcorr_inf_quad=Boolean.parseBoolean(properties.getProperty(prefix+"fcorr_inf_quad")); if (properties.getProperty(prefix+"fcorr_inf_quad")!=null) this.fcorr_inf_quad=Boolean.parseBoolean(properties.getProperty(prefix+"fcorr_inf_quad")); if (properties.getProperty(prefix+"fcorr_inf_vert")!=null) this.fcorr_inf_vert=Boolean.parseBoolean(properties.getProperty(prefix+"fcorr_inf_vert")); if (properties.getProperty(prefix+"fcorr_inf_vert")!=null) this.fcorr_inf_vert=Boolean.parseBoolean(properties.getProperty(prefix+"fcorr_inf_vert")); if (properties.getProperty(prefix+"inf_disp_apply")!=null) this.inf_disp_apply=Boolean.parseBoolean(properties.getProperty(prefix+"inf_disp_apply")); if (properties.getProperty(prefix+"inf_mism_apply")!=null) this.inf_mism_apply=Boolean.parseBoolean(properties.getProperty(prefix+"inf_mism_apply")); if (properties.getProperty(prefix+"inf_iters")!=null) this.inf_iters=Integer.parseInt(properties.getProperty(prefix+"inf_iters")); if (properties.getProperty(prefix+"inf_final_diff")!=null) this.inf_final_diff=Double.parseDouble(properties.getProperty(prefix+"inf_final_diff")); if (properties.getProperty(prefix+"inf_far_pull")!=null) this.inf_far_pull=Double.parseDouble(properties.getProperty(prefix+"inf_far_pull")); if (properties.getProperty(prefix+"inf_str_pow")!=null) this.inf_str_pow=Double.parseDouble(properties.getProperty(prefix+"inf_str_pow")); if (properties.getProperty(prefix+"inf_smpl_side")!=null) this.inf_smpl_side=Integer.parseInt(properties.getProperty(prefix+"inf_smpl_side")); if (properties.getProperty(prefix+"inf_smpl_num")!=null) this.inf_smpl_num=Integer.parseInt(properties.getProperty(prefix+"inf_smpl_num")); if (properties.getProperty(prefix+"inf_smpl_rms")!=null) this.inf_smpl_rms=Double.parseDouble(properties.getProperty(prefix+"inf_smpl_rms")); if (properties.getProperty(prefix+"ih_smpl_step")!=null) this.ih_smpl_step=Integer.parseInt(properties.getProperty(prefix+"ih_smpl_step")); if (properties.getProperty(prefix+"ih_disp_min")!=null) this.ih_disp_min=Double.parseDouble(properties.getProperty(prefix+"ih_disp_min")); if (properties.getProperty(prefix+"ih_disp_step")!=null) this.ih_disp_step=Double.parseDouble(properties.getProperty(prefix+"ih_disp_step")); if (properties.getProperty(prefix+"ih_num_bins")!=null) this.ih_num_bins=Integer.parseInt(properties.getProperty(prefix+"ih_num_bins")); if (properties.getProperty(prefix+"ih_sigma")!=null) this.ih_sigma=Double.parseDouble(properties.getProperty(prefix+"ih_sigma")); if (properties.getProperty(prefix+"ih_max_diff")!=null) this.ih_max_diff=Double.parseDouble(properties.getProperty(prefix+"ih_max_diff")); if (properties.getProperty(prefix+"ih_min_samples")!=null) this.ih_min_samples=Integer.parseInt(properties.getProperty(prefix+"ih_min_samples")); if (properties.getProperty(prefix+"ih_norm_center")!=null) this.ih_norm_center=Boolean.parseBoolean(properties.getProperty(prefix+"ih_norm_center")); if (properties.getProperty(prefix+"fcorr_sample_size")!=null) this.fcorr_sample_size=Integer.parseInt(properties.getProperty(prefix+"fcorr_sample_size")); if (properties.getProperty(prefix+"fcorr_sample_size")!=null) this.fcorr_sample_size=Integer.parseInt(properties.getProperty(prefix+"fcorr_sample_size")); if (properties.getProperty(prefix+"fcorr_mintiles")!=null) this.fcorr_mintiles=Integer.parseInt(properties.getProperty(prefix+"fcorr_mintiles")); if (properties.getProperty(prefix+"fcorr_mintiles")!=null) this.fcorr_mintiles=Integer.parseInt(properties.getProperty(prefix+"fcorr_mintiles")); if (properties.getProperty(prefix+"fcorr_reloutliers")!=null) this.fcorr_reloutliers=Double.parseDouble(properties.getProperty(prefix+"fcorr_reloutliers")); if (properties.getProperty(prefix+"fcorr_reloutliers")!=null) this.fcorr_reloutliers=Double.parseDouble(properties.getProperty(prefix+"fcorr_reloutliers")); Loading Loading @@ -3480,6 +3544,27 @@ public class EyesisCorrectionParameters { gd.addCheckbox ("Use quadratic polynomial for infinity correction (false - only linear)", this.fcorr_inf_quad); gd.addCheckbox ("Use quadratic polynomial for infinity correction (false - only linear)", this.fcorr_inf_quad); gd.addCheckbox ("Correct infinity in vertical direction (false - only horizontal)", this.fcorr_inf_vert); gd.addCheckbox ("Correct infinity in vertical direction (false - only horizontal)", this.fcorr_inf_vert); gd.addCheckbox ("Apply disparity correction to zero at infinity", this.inf_disp_apply); gd.addCheckbox ("Apply lazy eye correction at infinity", this.inf_mism_apply); gd.addNumericField("Infinity extraction - maximum iterations", this.inf_iters, 0); gd.addNumericField("Coefficients maximal increment to exit iterations", this.inf_final_diff, 6); gd.addNumericField("Include farther tiles than tolerance, but scale their weights", this.inf_far_pull, 3); gd.addMessage ("--- Infinity filter ---"); gd.addNumericField("Strength power", this.inf_str_pow, 3); gd.addNumericField("Sample size (side of a square)", this.inf_smpl_side, 0); gd.addNumericField("Number after removing worst (should be >1)", this.inf_smpl_num, 0); gd.addNumericField("Maximal RMS of the remaining tiles in a sample", this.inf_smpl_rms, 3); gd.addMessage ("--- Infinity histogram filter ---"); gd.addNumericField("Square sample step (50% overlap)", this.ih_smpl_step, 0); gd.addNumericField("Histogram minimal disparity", this.ih_disp_min, 3); gd.addNumericField("Histogram disparity step", this.ih_disp_step, 3); gd.addNumericField("Histogram number of bins", this.ih_num_bins, 0); gd.addNumericField("Histogram Gaussian sigma (in disparity pixels)", this.ih_sigma, 3); gd.addNumericField("Keep samples within this difference from farthest maximum", this.ih_max_diff, 3); gd.addNumericField("Minimal number of remaining samples", this.ih_min_samples, 0); gd.addCheckbox ("Replace samples with a single average with equal weight", this.ih_norm_center); gd.addNumericField("Use square this size side to detect outliers", this.fcorr_sample_size, 0); gd.addNumericField("Use square this size side to detect outliers", this.fcorr_sample_size, 0); gd.addNumericField("Keep tiles only if there are more in each square", this.fcorr_mintiles, 0); gd.addNumericField("Keep tiles only if there are more in each square", this.fcorr_mintiles, 0); gd.addNumericField("Remove this fraction of tiles from each sample", this.fcorr_reloutliers, 3); gd.addNumericField("Remove this fraction of tiles from each sample", this.fcorr_reloutliers, 3); Loading Loading @@ -3973,6 +4058,26 @@ public class EyesisCorrectionParameters { this.fcorr_inf_quad= gd.getNextBoolean(); this.fcorr_inf_quad= gd.getNextBoolean(); this.fcorr_inf_vert= gd.getNextBoolean(); this.fcorr_inf_vert= gd.getNextBoolean(); this.inf_disp_apply= gd.getNextBoolean(); this.inf_mism_apply= gd.getNextBoolean(); this.inf_iters= (int) gd.getNextNumber(); this.inf_final_diff= gd.getNextNumber(); this.inf_far_pull= gd.getNextNumber(); this.inf_str_pow= gd.getNextNumber(); this.inf_smpl_side= (int) gd.getNextNumber(); this.inf_smpl_num= (int) gd.getNextNumber(); this.inf_smpl_rms= gd.getNextNumber(); this.ih_smpl_step= (int) gd.getNextNumber(); this.ih_disp_min= gd.getNextNumber(); this.ih_disp_step= gd.getNextNumber(); this.ih_num_bins= (int) gd.getNextNumber(); this.ih_sigma= gd.getNextNumber(); this.ih_max_diff= gd.getNextNumber(); this.ih_min_samples= (int) gd.getNextNumber(); this.ih_norm_center= gd.getNextBoolean(); this.fcorr_sample_size= (int)gd.getNextNumber(); this.fcorr_sample_size= (int)gd.getNextNumber(); this.fcorr_mintiles= (int) gd.getNextNumber(); this.fcorr_mintiles= (int) gd.getNextNumber(); this.fcorr_reloutliers= gd.getNextNumber(); this.fcorr_reloutliers= gd.getNextNumber(); Loading
src/main/java/Eyesis_Correction.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -4609,10 +4609,16 @@ private Panel panel1, System.out.println("Created new QuadCLT instance, will need to read CLT kernels"); System.out.println("Created new QuadCLT instance, will need to read CLT kernels"); } } } } /* QUAD_CLT.process_fine_corr( QUAD_CLT.process_fine_corr( dry_run, // boolean dry_run dry_run, // boolean dry_run CLT_PARAMETERS, CLT_PARAMETERS, DEBUG_LEVEL); DEBUG_LEVEL); */ QUAD_CLT.processLazyEye( CLT_PARAMETERS, DEBUG_LEVEL); return; return; } else if (label.equals("CLT ext infinity corr")) { } else if (label.equals("CLT ext infinity corr")) { Loading
src/main/java/ImageDtt.java +3 −2 Original line number Original line Diff line number Diff line Loading @@ -964,6 +964,7 @@ public class ImageDtt { final double [][][][][] clt_corr_partial,// [tilesY][tilesX][quad]color][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate final double [][][][][] clt_corr_partial,// [tilesY][tilesX][quad]color][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate // [tilesY][tilesX] should be set by caller // [tilesY][tilesX] should be set by caller final double [][] clt_mismatch, // [12][tilesY * tilesX] // transpose unapplied. null - do not calculate final double [][] clt_mismatch, // [12][tilesY * tilesX] // transpose unapplied. null - do not calculate // values in the "main" directions have disparity (*_CM) subtracted, in the perpendicular - as is final double [][] disparity_map, // [8][tilesY][tilesX], only [6][] is needed on input or null - do not calculate final double [][] disparity_map, // [8][tilesY][tilesX], only [6][] is needed on input or null - do not calculate // last 2 - contrast, avg/ "geometric average) // last 2 - contrast, avg/ "geometric average) Loading Loading @@ -1606,11 +1607,11 @@ public class ImageDtt { double yp,xp; double yp,xp; if (corr_pairs[pair][2] > 0){ // transpose - switch x <-> y if (corr_pairs[pair][2] > 0){ // transpose - switch x <-> y yp = transform_size - 1 -corr_max_XYmp[0] - disparity_map[DISPARITY_INDEX_CM][tIndex]; yp = transform_size - 1 -corr_max_XYmp[0] - disparity_map[DISPARITY_INDEX_CM][tIndex]; xp = transform_size - 1 -corr_max_XYmp[1]; // do not campare to average - it should be 0 anyway xp = transform_size - 1 -corr_max_XYmp[1]; // do not compare to average - it should be 0 anyway } else { } else { xp = transform_size - 1 -corr_max_XYmp[0] - disparity_map[DISPARITY_INDEX_CM][tIndex]; xp = transform_size - 1 -corr_max_XYmp[0] - disparity_map[DISPARITY_INDEX_CM][tIndex]; yp = transform_size - 1 -corr_max_XYmp[1]; // do not campare to average - it should be 0 anyway yp = transform_size - 1 -corr_max_XYmp[1]; // do not compare to average - it should be 0 anyway } } double strength = tcorr_partial[pair][numcol][max_index]; // using the new location than for combined double strength = tcorr_partial[pair][numcol][max_index]; // using the new location than for combined clt_mismatch[3*pair + 0 ][tIndex] = xp; clt_mismatch[3*pair + 0 ][tIndex] = xp; Loading
src/main/java/QuadCLT.java +92 −16 Original line number Original line Diff line number Diff line Loading @@ -5237,22 +5237,22 @@ public class QuadCLT { double [][][] new_corr = ac.infinityCorrection( double [][][] new_corr = ac.infinityCorrection( clt_parameters.fcorr_inf_strength, // final double min_strenth, clt_parameters.fcorr_inf_strength, // final double min_strenth, clt_parameters.fcorr_inf_diff, // final double max_diff, clt_parameters.fcorr_inf_diff, // final double max_diff, 20, // 0, // final int max_iterations, clt_parameters.inf_iters, // 20, // 0, // final int max_iterations, 0.0001, // final double max_coeff_diff, clt_parameters.inf_final_diff, // 0.0001, // final double max_coeff_diff, 0.0, // 0.25, // final double far_pull, // = 0.2; // 1; // 0.5; clt_parameters.inf_far_pull, // 0.0, // 0.25, // final double far_pull, // = 0.2; // 1; // 0.5; 1.0, // final double strength_pow, clt_parameters.inf_str_pow, // 1.0, // final double strength_pow, 3, // final int smplSide, // = 2; // Sample size (side of a square) clt_parameters.inf_smpl_side, // 3, // final int smplSide, // = 2; // Sample size (side of a square) 5, // final int smplNum, // = 3; // Number after removing worst (should be >1) clt_parameters.inf_smpl_num, // 5, // final int smplNum, // = 3; // Number after removing worst (should be >1) 0.1, // 0.05, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample clt_parameters.inf_smpl_rms, // 0.1, // 0.05, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // histogram parameters // histogram parameters 8, // final int hist_smpl_side, // 8 x8 masked, 16x16 sampled clt_parameters.ih_smpl_step, // 8, // final int hist_smpl_side, // 8 x8 masked, 16x16 sampled -1.0, // final double hist_disp_min, clt_parameters.ih_disp_min, // -1.0, // final double hist_disp_min, 0.05, // final double hist_disp_step, clt_parameters.ih_disp_step, // 0.05, // final double hist_disp_step, 40, // final int hist_num_bins, clt_parameters.ih_num_bins, // 40, // final int hist_num_bins, 0.1, // final double hist_sigma, clt_parameters.ih_sigma, // 0.1, // final double hist_sigma, 0.1, // final double hist_max_diff, clt_parameters.ih_max_diff, // 0.1, // final double hist_max_diff, 10, // final int hist_min_samples, clt_parameters.ih_min_samples, // 10, // final int hist_min_samples, true, // final boolean hist_norm_center, // if there are more tiles that fit than min_samples, replace with clt_parameters.ih_norm_center, // true, // final boolean hist_norm_center, // if there are more tiles that fit than min_samples, replace with clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters, clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters, inf_disp_strength, // double [][] disp_strength, inf_disp_strength, // double [][] disp_strength, tilesX, // int tilesX, tilesX, // int tilesX, Loading @@ -5260,6 +5260,8 @@ public class QuadCLT { debugLevel + 1); // int debugLevel) debugLevel + 1); // int debugLevel) if (debugLevel > -1){ if (debugLevel > -1){ System.out.println("process_infinity_corr(): ready to apply infinity correction"); System.out.println("process_infinity_corr(): ready to apply infinity correction"); show_fine_corr( show_fine_corr( Loading @@ -5274,11 +5276,85 @@ public class QuadCLT { debugLevel + 2); debugLevel + 2); } } } } public void processLazyEye( EyesisCorrectionParameters.CLTParameters clt_parameters, int debugLevel ) { ImagePlus imp_src = WindowManager.getCurrentImage(); if (imp_src==null){ IJ.showMessage("Error","2*n-layer file with disparities/strengthspairs measured at infinity is required"); return; } ImageStack disp_strength_stack= imp_src.getStack(); final int tilesX = disp_strength_stack.getWidth(); // tp.getTilesX(); final int tilesY = disp_strength_stack.getHeight(); // tp.getTilesY(); final int nTiles =tilesX * tilesY; AlignmentCorrection ac = new AlignmentCorrection(this); double [][] scans = ac.getFineCorrFromImage( imp_src, // 0.2, // double min_comp_strength, // 0.2 debugLevel); double [][][] new_corr = ac.lazyEyeCorrection( clt_parameters.fcorr_inf_strength, // final double min_strenth, clt_parameters.fcorr_inf_diff, // final double max_diff, 1.3, // final double comp_strength_var, clt_parameters.inf_iters, // 20, // 0, // final int max_iterations, clt_parameters.inf_final_diff, // 0.0001, // final double max_coeff_diff, clt_parameters.inf_far_pull, // 0.0, // 0.25, // final double far_pull, // = 0.2; // 1; // 0.5; clt_parameters.inf_str_pow, // 1.0, // final double strength_pow, 1.5, // final double lazyEyeCompDiff, // clt_parameters.fcorr_disp_diff clt_parameters.inf_smpl_side, // final int lazyEyeSmplSide, // = 2; // Sample size (side of a square) clt_parameters.inf_smpl_num, // final int lazyEyeSmplNum, // = 3; // Number after removing worst (should be >1) 0.1, // final double lazyEyeSmplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample 0.2, // final double lazyEyeDispVariation, // 0.2, maximal full disparity difference between tgh tile and 8 neighborxs clt_parameters.inf_smpl_side, // 3, // final int smplSide, // = 2; // Sample size (side of a square) clt_parameters.inf_smpl_num, // 5, // final int smplNum, // = 3; // Number after removing worst (should be >1) clt_parameters.inf_smpl_rms, // 0.1, // 0.05, // final double smplRms, // = 0.1; // Maximal RMS of the remaining tiles in a sample // histogram parameters clt_parameters.ih_smpl_step, // 8, // final int hist_smpl_side, // 8 x8 masked, 16x16 sampled clt_parameters.ih_disp_min, // -1.0, // final double hist_disp_min, clt_parameters.ih_disp_step, // 0.05, // final double hist_disp_step, clt_parameters.ih_num_bins, // 40, // final int hist_num_bins, clt_parameters.ih_sigma, // 0.1, // final double hist_sigma, clt_parameters.ih_max_diff, // 0.1, // final double hist_max_diff, clt_parameters.ih_min_samples, // 10, // final int hist_min_samples, clt_parameters.ih_norm_center, // true, // final boolean hist_norm_center, // if there are more tiles that fit than min_samples, replace with 0.5, // final double inf_fraction, // fraction of the weight for the infinity tiles clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters, scans, // double [][] disp_strength, tilesX, // int tilesX, clt_parameters.corr_magic_scale, // double magic_coeff, // still not understood coefficent that reduces reported disparity value. Seems to be around 8.5 debugLevel + 1); // int debugLevel) if (debugLevel > -100){ apply_fine_corr( new_corr, debugLevel + 2); } } public void process_fine_corr( public void process_fine_corr( boolean dry_run, boolean dry_run, EyesisCorrectionParameters.CLTParameters clt_parameters, EyesisCorrectionParameters.CLTParameters clt_parameters, int debugLevel int debugLevel ) { ) { if (dry_run) { AlignmentCorrection ac = new AlignmentCorrection(this); ac.process_fine_corr( dry_run, // boolean dry_run, clt_parameters, // EyesisCorrectionParameters.CLTParameters clt_parameters, debugLevel); // int debugLevel return; } ImagePlus imp_src = WindowManager.getCurrentImage(); ImagePlus imp_src = WindowManager.getCurrentImage(); if (imp_src==null){ if (imp_src==null){ IJ.showMessage("Error","12*n-layer file clt_mismatches is required"); IJ.showMessage("Error","12*n-layer file clt_mismatches is required"); Loading