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 (
......
This diff is collapsed.
......@@ -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;
......
This diff is collapsed.
......@@ -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