Search in sources :

Example 1 with Image3DAligner

use of uk.ac.sussex.gdsc.smlm.ij.utils.Image3DAligner in project GDSC-SMLM by aherbert.

the class PsfCreator method align3D.

/**
 * Align the PSFs with the combined PSF using the Image2DAligner class to align the 2D max
 * intensity projections. The final alignment shift is the average of the shift from two
 * projection alignments for each dimension.
 *
 * @param combined the combined
 * @param psfs the psfs
 * @return The XYZ translations for each PSF
 */
private float[][] align3D(ExtractedPsf combined, final ExtractedPsf[] psfs) {
    // Note: For alignment we extract each PSF around the current z-centre
    // so the middle of the stack is the middle of the PSF.
    final List<Future<?>> futures = new LocalList<>(psfs.length);
    final Image3DAligner align = new Image3DAligner();
    align.setReference(combined.getImageStack(true));
    final float[][] results = new float[psfs.length][3];
    for (int j = 0; j < psfs.length; j++) {
        final int jj = j;
        futures.add(threadPool.submit(() -> {
            final ExtractedPsf psf = psfs[jj];
            final double[] result = align.copy().align(psf.getImageStack(true), 10);
            for (int i = 0; i < 3; i++) {
                results[jj][i] = (float) -result[i];
            }
        }));
    }
    ConcurrencyUtils.waitForCompletionUnchecked(futures);
    return results;
}
Also used : LocalList(uk.ac.sussex.gdsc.core.utils.LocalList) Image3DAligner(uk.ac.sussex.gdsc.smlm.ij.utils.Image3DAligner) Future(java.util.concurrent.Future) Point(java.awt.Point) BasePoint(uk.ac.sussex.gdsc.core.match.BasePoint)

Aggregations

Point (java.awt.Point)1 Future (java.util.concurrent.Future)1 BasePoint (uk.ac.sussex.gdsc.core.match.BasePoint)1 LocalList (uk.ac.sussex.gdsc.core.utils.LocalList)1 Image3DAligner (uk.ac.sussex.gdsc.smlm.ij.utils.Image3DAligner)1