use of uk.ac.sussex.gdsc.smlm.data.config.PSFProtos.AstigmatismModelSettings in project GDSC-SMLM by aherbert.
the class AstigmatismModelManager method invertModel.
private void invertModel() {
final GenericDialog gd = new GenericDialog(TITLE);
final String[] models = listAstigmatismModels(false);
gd.addMessage("Invert the z-orientation of a model.\n \n" + TextUtils.wrap("Note that a positive gamma puts the focal plane for the X-dimension " + "above the z-centre (positive Z) and the focal " + "plane for the Y-dimension below the z-centre (negative Z). If gamma " + "is negative then the orientation of the focal planes of X and Y are reversed.", 80));
gd.addChoice("Model", models, pluginSettings.getSelected());
gd.addHelp(HelpUrls.getUrl("astigmatism-model-manager-invert"));
gd.showDialog();
if (gd.wasCanceled()) {
return;
}
final String name = gd.getNextChoice();
pluginSettings.setSelected(name);
final AstigmatismModelSettings settings = AstigmatismModelSettingsHolder.getSettings();
final AstigmatismModel model = settings.getAstigmatismModelResourcesMap().get(name);
if (model == null) {
IJ.error(TITLE, "Failed to find astigmatism model: " + name);
return;
}
final AstigmatismModel.Builder builder = model.toBuilder();
// Invert the gamma
builder.setGamma(-model.getGamma());
// Invert the constants of z^3 as these have an asymmetric effect on the curve
builder.setAx(-model.getAx());
builder.setAy(-model.getAy());
// The constants of z^4 have a symmetric effect on the curve
// builder.setBx(-model.getBx());
// builder.setBy(-model.getBy());
AstigmatismModelSettingsHolder.setSettings(settings.toBuilder().putAstigmatismModelResources(name, builder.build()).build());
ImageJUtils.log("Inverted astigmatism model: %s", name);
}
Aggregations