0.75, // topCenter - consider only points above this fraction of the peak to find the centroid
0.75, // topCenter - consider only points above this fraction of the peak to find the centroid
0.0, // sigmaToRadius - variable-sigma blurring to reduce high frequencies more for the pixels farther from the PSF center
0.0, // sigmaToRadius - variable-sigma blurring to reduce high frequencies more for the pixels farther from the PSF center
@@ -16998,7 +16999,7 @@ if (DEBUG_LEVEL>2)DEBUG_LEVEL=0; //*********************************************
kernels[i]=combinePSF (inverted[i], // Square array of pixels with multiple repeated PSF (alternating sign)
kernels[i]=combinePSF (inverted[i], // Square array of pixels with multiple repeated PSF (alternating sign)
true, // master, force ignoreChromatic
!psfParameters.absoluteCenter, //true, // master, force ignoreChromatic
PSF_shifts[i], // centerXY[] - will be modified inside combinePSF() if PSF_PARS.ignoreChromatic is true
PSF_shifts[i], // centerXY[] - will be modified inside combinePSF() if PSF_PARS.ignoreChromatic is true
PSF_centroids[i], // will return array of XY coordinates of the result centroid
PSF_centroids[i], // will return array of XY coordinates of the result centroid
(i==4)?wVectors4:wVectors, // two wave vectors, lengths in cycles/pixel (pixels match pixel array)
(i==4)?wVectors4:wVectors, // two wave vectors, lengths in cycles/pixel (pixels match pixel array)
@@ -17009,7 +17010,7 @@ if (DEBUG_LEVEL>2)DEBUG_LEVEL=0; //*********************************************
if (DEBUG_LEVEL>2) System.out.println("After-1: color Component "+i+" PSF_shifts["+i+"][0]="+IJ.d2s(PSF_shifts [i][0],3)+" PSF_shifts["+i+"][1]="+IJ.d2s( PSF_shifts[i][1],3));
if (DEBUG_LEVEL>2) System.out.println("After-1: color Component "+i+" PSF_shifts["+i+"][0]="+IJ.d2s(PSF_shifts [i][0],3)+" PSF_shifts["+i+"][1]="+IJ.d2s( PSF_shifts[i][1],3));
if (DEBUG_LEVEL>2) System.out.println("After-1: color Component "+i+" PSF_centroids["+i+"][0]="+IJ.d2s(PSF_centroids[i][0],3)+" PSF_centroids["+i+"][1]="+IJ.d2s(PSF_centroids[i][1],3));
if (DEBUG_LEVEL>2) System.out.println("After-1: color Component "+i+" PSF_centroids["+i+"][0]="+IJ.d2s(PSF_centroids[i][0],3)+" PSF_centroids["+i+"][1]="+IJ.d2s(PSF_centroids[i][1],3));
if (!psfParameters.ignoreChromatic) { /* Recalculate center to pixels from greens (diagonal)) and supply it to other colors (lateral chromatic aberration correction) */
if (!psfParameters.ignoreChromatic && !psfParameters.absoluteCenter) { /* Recalculate center to pixels from greens (diagonal)) and supply it to other colors (lateral chromatic aberration correction) */
for (j=0;j<input_bayer.length;j++) if ((colorComponents.colorsToCorrect[j]) && (j!=referenceComp)) {
for (j=0;j<input_bayer.length;j++) if ((colorComponents.colorsToCorrect[j]) && (j!=referenceComp)) {
if (DEBUG_LEVEL>2) System.out.println("After-2 (recalc): color Component "+j+" PSF_shifts["+j+"][0]="+IJ.d2s(PSF_shifts[j][0],3)+" PSF_shifts["+j+"][1]="+IJ.d2s(PSF_shifts[j][1],3));
if (DEBUG_LEVEL>2) System.out.println("After-2 (recalc): color Component "+j+" PSF_shifts["+j+"][0]="+IJ.d2s(PSF_shifts[j][0],3)+" PSF_shifts["+j+"][1]="+IJ.d2s(PSF_shifts[j][1],3));
@@ -17052,6 +17053,7 @@ if (DEBUG_LEVEL>2)DEBUG_LEVEL=0; //*********************************************
// TODO: Shift +/- 0.5 Pix here {centerXY[0]-Math.round(centerXY[0]),centerXY[1]-Math.round(centerXY[1])}
// TODO: Shift +/- 0.5 Pix here {centerXY[0]-Math.round(centerXY[0]),centerXY[1]-Math.round(centerXY[1])}
@@ -17515,7 +17517,7 @@ if (DEBUG_LEVEL>2)DEBUG_LEVEL=0; //*********************************************
if (DEBUG_LEVEL>2) System.out.println("Centroid after first binPSF: x="+IJ.d2s(centroidXY[0],3)+" y="+IJ.d2s(centroidXY[1],3)+" center was at x="+IJ.d2s(centerXY[0],3)+" y="+IJ.d2s(centerXY[1],3));
if (DEBUG_LEVEL>2) System.out.println("Centroid after first binPSF: x="+IJ.d2s(centroidXY[0],3)+" y="+IJ.d2s(centroidXY[1],3)+" center was at x="+IJ.d2s(centerXY[0],3)+" y="+IJ.d2s(centerXY[1],3));
/* Re-bin results with the new center if ignoreChromatic is true, update centerXY[](shift of the result PSF array) and centroidXY[] (center of the optionally shifted PDF array) */
/* Re-bin results with the new center if ignoreChromatic is true, update centerXY[](shift of the result PSF array) and centroidXY[] (center of the optionally shifted PDF array) */
if (master || psfParameters.ignoreChromatic) {
if (!psfParameters.absoluteCenter && (master || psfParameters.ignoreChromatic)) {
if (centerXY!=null) {
if (centerXY!=null) {
centerXY[0]+=centroidXY[0];
centerXY[0]+=centroidXY[0];
centerXY[1]+=centroidXY[1];
centerXY[1]+=centroidXY[1];
@@ -18936,6 +18938,9 @@ use the result to create a rejectiobn mask - if the energy was high, (multiplica
gd.addCheckbox ("Multiply PSF cell by Hamming window", psfParameters.useWindow); // true;
gd.addCheckbox ("Multiply PSF cell by Hamming window", psfParameters.useWindow); // true;
gd.addCheckbox ("Force PSF center- symmetrical (around centroid)", psfParameters.symm180); // true; // make OTF center-symmetrical (around centroid that is defined by lateral chromatic aberration)
gd.addCheckbox ("Force PSF center- symmetrical (around centroid)", psfParameters.symm180); // true; // make OTF center-symmetrical (around centroid that is defined by lateral chromatic aberration)
gd.addCheckbox ("Ignore lateral chromatic aberrations, center PSF", psfParameters.ignoreChromatic); // true; // ignore lateral chromatic aberration (center OTF to 0,0)
gd.addCheckbox ("Ignore lateral chromatic aberrations, center PSF", psfParameters.ignoreChromatic); // true; // ignore lateral chromatic aberration (center OTF to 0,0)
gd.addCheckbox ("Use absolute PSF center (no adjustment to green center)", psfParameters.absoluteCenter);
gd.addNumericField("PSF separation: threshold to find the PSF maximum", psfParameters.topCenter, 3); // 0.75 consider only points above this fraction of the peak to find the centroid
gd.addNumericField("PSF separation: threshold to find the PSF maximum", psfParameters.topCenter, 3); // 0.75 consider only points above this fraction of the peak to find the centroid
gd.addNumericField("PSF variable Gauss blurring (farther from center, higher the sigma", psfParameters.sigmaToRadius,3); // 0.4 variable-sigma blurring to reduce high frequencies more for the pixels farther from the PSF center
gd.addNumericField("PSF variable Gauss blurring (farther from center, higher the sigma", psfParameters.sigmaToRadius,3); // 0.4 variable-sigma blurring to reduce high frequencies more for the pixels farther from the PSF center
@@ -18958,6 +18963,7 @@ use the result to create a rejectiobn mask - if the energy was high, (multiplica
@@ -19680,6 +19686,7 @@ use the result to create a rejectiobn mask - if the energy was high, (multiplica
gd.addNumericField("PSF wings energy (searching for ellipse approximation)", psfParameters.wingsEnergy, 3); // 0.8 fraction of energy in the pixels to be used
gd.addNumericField("PSF wings energy (searching for ellipse approximation)", psfParameters.wingsEnergy, 3); // 0.8 fraction of energy in the pixels to be used
gd.addNumericField("PSF wings ellipse scale (multiply PSF by elliptical gaussian)",psfParameters.wingsEllipseScale, 3);// 2.0 increase wings cutoff ellipse by this from one defined by the cutoff energy
gd.addNumericField("PSF wings ellipse scale (multiply PSF by elliptical gaussian)",psfParameters.wingsEllipseScale, 3);// 2.0 increase wings cutoff ellipse by this from one defined by the cutoff energy
gd.addCheckbox ("Ignore lateral chromatic aberrations, center PSF", psfParameters.ignoreChromatic); // true; // ignore lateral chromatic aberration (center OTF to 0,0)
gd.addCheckbox ("Ignore lateral chromatic aberrations, center PSF", psfParameters.ignoreChromatic); // true; // ignore lateral chromatic aberration (center OTF to 0,0)
gd.addCheckbox ("Use absolute PSF center (no adjustment to green center)", psfParameters.absoluteCenter);
gd.addNumericField("OTF cutoff energy (used to determine bounding ellipse)", inverseParameters.otfCutoffEnergy, 3); //0.6; use frequency points that have inverseParameters.otfCutoffEnergy of the total to determine ellipse for limiting frequency responce
gd.addNumericField("OTF cutoff energy (used to determine bounding ellipse)", inverseParameters.otfCutoffEnergy, 3); //0.6; use frequency points that have inverseParameters.otfCutoffEnergy of the total to determine ellipse for limiting frequency responce
gd.addNumericField("OTF size of elliptical window relative to cluster size", inverseParameters.otfEllipseScale, 3); //1.5; // size of elliptical window relative to the cluster defined by inverseParameters.otfCutoffEnergy
gd.addNumericField("OTF size of elliptical window relative to cluster size", inverseParameters.otfEllipseScale, 3); //1.5; // size of elliptical window relative to the cluster defined by inverseParameters.otfCutoffEnergy
@@ -19713,6 +19720,7 @@ use the result to create a rejectiobn mask - if the energy was high, (multiplica
@@ -2819,7 +2821,7 @@ if (globalDebugLevel>2)globalDebugLevel=0; //***********************************
kernels[i]=combinePSF(inverted[i],// Square array of pixels with multiple repeated PSF (alternating sign)
kernels[i]=combinePSF(inverted[i],// Square array of pixels with multiple repeated PSF (alternating sign)
true,// master, force ignoreChromatic
!psfParameters.absoluteCenter,//true, // master, force ignoreChromatic
PSF_shifts[i],// centerXY[] - will be modified inside combinePSF() if PSF_PARS.ignoreChromatic is true
PSF_shifts[i],// centerXY[] - will be modified inside combinePSF() if PSF_PARS.ignoreChromatic is true
PSF_centroids[i],// will return array of XY coordinates of the result centroid
PSF_centroids[i],// will return array of XY coordinates of the result centroid
(i==4)?wVectors4:wVectors,// two wave vectors, lengths in cycles/pixel (pixels match pixel array)
(i==4)?wVectors4:wVectors,// two wave vectors, lengths in cycles/pixel (pixels match pixel array)
@@ -2829,13 +2831,13 @@ if (globalDebugLevel>2)globalDebugLevel=0; //***********************************
(globalDebugLevel>4),
(globalDebugLevel>4),
globalDebugLevel
globalDebugLevel
);
);
if(globalDebugLevel>2)System.out.println(x0+":"+y0+"After-1: color Component "+i+" PSF_shifts["+i+"][0]="+IJ.d2s(PSF_shifts[i][0],3)+" PSF_shifts["+i+"][1]="+IJ.d2s(PSF_shifts[i][1],3));
if(globalDebugLevel>debugThreshold)System.out.println(x0+":"+y0+"After-1: color Component "+i+" PSF_shifts["+i+"][0]="+IJ.d2s(PSF_shifts[i][0],3)+" PSF_shifts["+i+"][1]="+IJ.d2s(PSF_shifts[i][1],3));
if(globalDebugLevel>2)System.out.println(x0+":"+y0+"After-1: color Component "+i+" PSF_centroids["+i+"][0]="+IJ.d2s(PSF_centroids[i][0],3)+" PSF_centroids["+i+"][1]="+IJ.d2s(PSF_centroids[i][1],3));
if(globalDebugLevel>debugThreshold)System.out.println(x0+":"+y0+"After-1: color Component "+i+" PSF_centroids["+i+"][0]="+IJ.d2s(PSF_centroids[i][0],3)+" PSF_centroids["+i+"][1]="+IJ.d2s(PSF_centroids[i][1],3));
if(!psfParameters.ignoreChromatic){/* Recalculate center to pixels from greens (diagonal)) and supply it to other colors (lateral chromatic aberration correction) */
if(!psfParameters.ignoreChromatic&&!psfParameters.absoluteCenter){/* Recalculate center to pixels from greens (diagonal)) and supply it to other colors (lateral chromatic aberration correction) */
// TODO: Shift +/- 0.5 Pix here {centerXY[0]-Math.round(centerXY[0]),centerXY[1]-Math.round(centerXY[1])}
// TODO: Shift +/- 0.5 Pix here {centerXY[0]-Math.round(centerXY[0]),centerXY[1]-Math.round(centerXY[1])}
@@ -3397,7 +3400,7 @@ if (globalDebugLevel>2)globalDebugLevel=0; //***********************************
if(debugLevel>2)System.out.println("Centroid after first binPSF: x="+IJ.d2s(centroidXY[0],3)+" y="+IJ.d2s(centroidXY[1],3)+" center was at x="+IJ.d2s(centerXY[0],3)+" y="+IJ.d2s(centerXY[1],3));
if(debugLevel>2)System.out.println("Centroid after first binPSF: x="+IJ.d2s(centroidXY[0],3)+" y="+IJ.d2s(centroidXY[1],3)+" center was at x="+IJ.d2s(centerXY[0],3)+" y="+IJ.d2s(centerXY[1],3));
/* Re-bin results with the new center if ignoreChromatic is true, update centerXY[](shift of the result PSF array) and centroidXY[] (center of the optionally shifted PDF array) */
/* Re-bin results with the new center if ignoreChromatic is true, update centerXY[](shift of the result PSF array) and centroidXY[] (center of the optionally shifted PDF array) */
public static double OTF_deconvInvert = 0.007; // 0.015; // 0.01; // when FFT component is less than this fraction of the maximal value, replace 1/z with Z
public static double OTF_deconvInvert = 0.007; // 0.015; // 0.01; // when FFT component is less than this fraction of the maximal value, replace 1/z with Z
/* TODO: check why combined greens result in center at x=-0.532/2 , y= -.0272/2 */
/* TODO: check why combined greens result in center at x=-0.532/2 , y= -.0272/2 */
public static boolean PSF_ignoreChromatic= false; // ignore lateral chromatic aberration (center OTF to 0,0)
public static boolean PSF_ignoreChromatic= false; // ignore lateral chromatic aberration (center OTF to 0,0)
public static boolean OTF_fold = false; // fold high frequency to lower when downsampling pixels (before inverse FFT)
public static boolean OTF_fold = false; // fold high frequency to lower when downsampling pixels (before inverse FFT)
public static double PSF_cutoff_energy=0.9; // Limit result kernel to proportional of the PSF, calculate initial cluster shape by this cutoff energy
public static double PSF_cutoff_energy=0.9; // Limit result kernel to proportional of the PSF, calculate initial cluster shape by this cutoff energy