use of mpicbg.trakem2.transform.ExportBestFlatImage in project TrakEM2 by trakem2.
the class BlockMatchPairCallable method makeFlatImage.
/**
* Use different methods depending on the dimensions of the target image and the availability of mipmaps.
* The goal is to obtain the best possible image.
*
* The alpha channel is returned with values between [0..1]
*
* @param layer
* @param patches
* @param box
* @param scale
* @return
*/
private Pair<FloatProcessor, FloatProcessor> makeFlatImage(final Layer layer, final List<Patch> patches, final Rectangle box, final double scale) {
final Pair<FloatProcessor, FloatProcessor> pair = new ExportBestFlatImage(patches, box, 0, scale).makeFlatFloatGrayImageAndAlpha();
// Map alpha from 8-bit to the range [0..1]
final float[] alpha = (float[]) pair.b.getPixels();
for (int i = 0; i < alpha.length; ++i) {
alpha[i] = alpha[i] / 255f;
}
return pair;
}
Aggregations