kernel_centered,// double [] kernel, // should be (2*dtt_size-1) * (2*dtt_size-1) +2 size (last 2 are not modified)
clt_kernels[chn][tileY][tileX],// double [][] sym_kernels, // set of 4 SS, AS, SA, AA kdernels, each dtt_size * dtt_size (may have 5-th with center shift
if(dct_parameters.normalize){// or should it be normalized after antiperiodic?
doubles=0.0;
for(inti=0;i<pre_target_kernel.length;i++){
s+=pre_target_kernel[i];
}
}
s=1.0/s;
for(inti=0;i<pre_target_kernel.length;i++){
pre_target_kernel[i]*=s;
}
}
if(globalDebugLevel>1){// was already close to 1.0
};
System.out.println(tileX+"/"+tileY+" s="+s);
}
}
ImageDtt.startAndJoin(threads);
if(globalDebugLevel>1)System.out.println("Threads done at "+IJ.d2s(0.000000001*(System.nanoTime()-startTime),3));
System.out.println("1.Threads done at "+IJ.d2s(0.000000001*(System.nanoTime()-startTime),3));
/* prepare result stack to return */
returnclt_kernels;
}
}
// make exactly anitperiodic
makeAntiperiodic(
dct_size,
pre_target_kernel,// 16*dct_zize*dct_zize
anitperiodic_window,// 16*dct_zize*dct_zize
target_kernel);// 4*dct_zize*dct_zize
publicdouble[][]flattenCLTKernels(// per color, save 4 kernelas and displacement as (2*dtt_size+1)*(2*dtt_size) tiles in an image (last row - shift x,y)
finaldouble[][][][][]kernels,// per color/per tileY/ per tileX/per quadrant (plus offset as 5-th)/per pixel
finalintthreadsMax,// maximal number of threads to launch
finalbooleanupdateStatus,
finalintglobalDebugLevel)// update status info
{
if(kernels==null)returnnull;
finalintnChn=kernels.length;
finalintkernelNumVert=kernels[0].length;
finalintkernelNumHor=kernels[0][0].length;
finalintdtt_len=kernels[0][0][0][0].length;
finalintdtt_size=(int)Math.sqrt(dtt_len);
finalinttileWidth=2*dtt_size;
finalinttileHeight=2*dtt_size+1;// last row - shift with 0.5 pix steps
if(globalDebugLevel>1)System.out.println("Threads done at "+IJ.d2s(0.000000001*(System.nanoTime()-startTime),3));
System.out.println("1.Threads done at "+IJ.d2s(0.000000001*(System.nanoTime()-startTime),3));
/* prepare result stack to return */
returnclt_flat;
}
publicvoidshowCLTKernels(
finalintthreadsMax,// maximal number of threads to launch
finalbooleanupdateStatus,
finalintglobalDebugLevel)// update status info
{
for(intchn=0;chn<clt_kernels.length;chn++){
if(clt_kernels[chn]!=null){
// System.out.println("showKernels("+chn+")");
showCLTKernels(
chn,
threadsMax,
updateStatus,
globalDebugLevel);
}
}
}
publicvoidshowCLTKernels(
intchn,
finalintthreadsMax,// maximal number of threads to launch
finalbooleanupdateStatus,
finalintglobalDebugLevel)// update status info
{
double[][]flat_kernels=flattenCLTKernels(// per color, save 4 kernelas and displacement as (2*dtt_size+1)*(2*dtt_size) tiles in an image (last row - shift x,y)
clt_kernels[chn],// per color/per tileY/ per tileX/per quadrant (plus offset as 5-th)/per pixel
publicdouble[][][][][]extractCLTKernels(// per color, save 4 kernelas and displacement as (2*dtt_size+1)*(2*dtt_size) tiles in an image (last row - shift x,y)
finalfloat[][]flat_kernels,// per color/per tileY/ per tileX/per quadrant (plus offset as 5-th)/per pixel
finalintwidth,
finalintdtt_size,
finalintthreadsMax,// maximal number of threads to launch
finalbooleanupdateStatus,
finalintglobalDebugLevel)// update status info
{
if(flat_kernels==null)returnnull;
finalintnChn=flat_kernels.length;
finalintheight=flat_kernels[0].length/width;
finalinttileWidth=2*dtt_size;
finalinttileHeight=2*dtt_size+1;// last row - shift with 0.5 pix steps
double[][][][][]kernels=calculateCLTKernel(// per color/per tileY/ per tileX/per quadrant (plus offset as 5-th)/per pixel
kernel_sharp_stack,// final ImageStack kernelStack, // first stack with 3 colors/slices convolution kernels
srcKernelSize,// final int kernelSize, // 64
clt_parameters,// final EyesisCorrectionParameters.CLTParameters clt_parameters,
threadsMax,// maximal number of threads to launch
updateStatus,
debugLevel);// update status info
double[][]flat_kernels=flattenCLTKernels(// per color, save 4 kernelas and displacement as (2*dtt_size+1)*(2*dtt_size) tiles in an image (last row - shift x,y)
kernels,// per color/per tileY/ per tileX/per quadrant (plus offset as 5-th)/per pixel
clt_kernels[chn]=extractCLTKernels(// per color, save 4 kernelas and displacement as (2*dtt_size+1)*(2*dtt_size) tiles in an image (last row - shift x,y)
flat_kernels,// per color/per tileY/ per tileX/per quadrant (plus offset as 5-th)/per pixel