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;
}
Aggregations