use of uk.ac.sussex.gdsc.core.utils.ImageExtractor in project GDSC-SMLM by aherbert.
the class PerPixelCameraModelTest method canGetCropData.
private static void canGetCropData(RandomSeed seed, boolean initialise) {
final PerPixelCameraModelTestData data = (PerPixelCameraModelTestData) dataCache.computeIfAbsent(seed, PerPixelCameraModelTest::createData);
final PerPixelCameraModel model = createModel(data, initialise);
final UniformRandomProvider rand = RngUtils.create(seed.getSeed());
final ImageExtractor ie = ImageExtractor.wrap(data.bias, w, h);
for (int i = 0; i < 10; i++) {
final Rectangle bounds = getBounds(rand, ie);
check(data.bias, bounds, model.getBias(bounds));
check(data.gain, bounds, model.getGain(bounds));
check(data.variance, bounds, model.getVariance(bounds));
check(data.varG2, bounds, model.getNormalisedVariance(bounds));
}
}
use of uk.ac.sussex.gdsc.core.utils.ImageExtractor in project GDSC-SMLM by aherbert.
the class PerPixelCameraModelTest method canCropAndGetData.
private static void canCropAndGetData(RandomSeed seed, boolean initialise) {
final PerPixelCameraModelTestData data = (PerPixelCameraModelTestData) dataCache.computeIfAbsent(seed, PerPixelCameraModelTest::createData);
final PerPixelCameraModel model = createModel(data, initialise);
final UniformRandomProvider rand = RngUtils.create(seed.getSeed());
final ImageExtractor ie = ImageExtractor.wrap(data.bias, w, h);
for (int i = 0; i < 10; i++) {
final Rectangle bounds = getBounds(rand, ie);
final CameraModel model2 = model.crop(bounds, false);
Assertions.assertEquals(model2.getBounds(), bounds);
check(data.bias, bounds, model2.getBias(bounds));
check(data.gain, bounds, model2.getGain(bounds));
check(data.variance, bounds, model2.getVariance(bounds));
check(data.varG2, bounds, model2.getNormalisedVariance(bounds));
}
}
use of uk.ac.sussex.gdsc.core.utils.ImageExtractor in project GDSC-SMLM by aherbert.
the class PerPixelCameraModelTest method canConvertDataWithCropBounds.
@SeededTest
void canConvertDataWithCropBounds(RandomSeed seed) {
final PerPixelCameraModelTestData data = (PerPixelCameraModelTestData) dataCache.computeIfAbsent(seed, PerPixelCameraModelTest::createData);
final PerPixelCameraModel model = new PerPixelCameraModel(w, h, data.bias, data.gain, data.variance);
final UniformRandomProvider rand = RngUtils.create(seed.getSeed());
final ImageExtractor ie = ImageExtractor.wrap(data.bias, w, h);
for (int j = 0; j < 10; j++) {
final Rectangle bounds = getBounds(rand, ie);
checkConversion(data, bounds, model);
}
}
Aggregations