best_pattern,// final int [] best_patt_integ, // best pattern index for integrated each pixel
null);// final int [][] best_patt_frame){ // best pattern index for each frame, each pixel. If !=null calculate strength relative to the best pattern, null - absolute
double[][]patt_strength_rel=getPatternStrengths(
space_conv,// final double [][][][] space_conv,
best_pattern,// final int [] best_patt_integ, // best pattern index for integrated each pixel
best_pattern_frame);// final int [][] best_patt_frame){ // best pattern index for each frame, each pixel. If !=null calculate strength relative to the best pattern, null - absolute
doublestrength_rel_min=0.5;
doublestrength_rel_max=0.9;
double[][]weights_mm=weightsMinMax(
patt_strength_rel,//final double [][] weights_in, // same data convolved with different kernels, may have NaNs
strength_rel_min,// final double min,
strength_rel_max,// final double max)
false);// final boolean invert) { // should be > min
// combine weights_pre (removed fg/bg borders with tempooral filtering) and weights_mm (by same pattern)
double[][]weights_mul=weightsMultiply(
weights_pre,// final double [][] weights0,
weights_mm);// final double [][] weights1)
// blur weights 3d with kernel
double[][]weights_blurred=convolve3d(
weights_mul,// final double [][] data_in, // fill NaN before running, will treat NaN as 0 on input, skip if center is NaN
width,// final int width,
blur_kernel,// final double [][][] kernel, // (odd)x(odd)x(odd}
repeat_border,// final boolean repeat_border)
full_convolves_only);// final boolean full_convolves_only)
d*=pattern_selection[nscale][npatt];// scaling d before squaring
d*=d;
if(use_max){
s2=Math.max(s2,d);
num_valid=1;
}else{
s2+=d;
num_valid++;
}
}
}
}
}
}
}
}
if(best_dir>=0){
if(num_valid>0){
best_val[fimg][ipix]=bestv;
combo_dt[nimg][ipix]=Math.sqrt(s2/num_valid);
if(best_space!=null){
}
if(best_dir<4){
}
best_space[fimg][ipix]=best_dir+best_sgn*4;
}
}else{
}
best_space[fimg][ipix]=10+best_sgn;
};
}
ImageDtt.startAndJoin(threads);
returncombo_dt;
}
publicstaticdouble[][]getPatternStrengths(
finaldouble[][][][]space_conv,
finalint[]best_patt_integ,// best pattern index for integrated each pixel
finalint[][]best_patt_frame){// best pattern index for each frame, each pixel. If !=null calculate strength relative to the best pattern, null - absolute
finalbooleanrelative=(best_patt_frame!=null);// false - just strength, true - relative to the best pattern for each frame/pix
// final int num_scales = space_conv.length; // may be modified, if there will be extra layers
finalintnum_patterns=space_conv[0].length;// may be modified, if there will be extra layers