import java.util.Hashtable; import cds.aladin.*; public class CalibrationPlug extends AladinPlugin { public String menu() { return "Image calibration shift"; } public String description() { return "PLUGIN TUTORIAL:\n" + "This plugin is an example for manipulating the image calibration.\n" + "It will apply a shift on the current astrometrical solution."; } public String author() { return "Pierre Fernique [CDS]"; } public String version() { return "1.1 - January 2007"; } public String url() { return "http://aladin.u-strasbg.fr/java/Plugins/CalibrationPlug.java"; } public String category() { return "Plugin tutorial/Image"; } /** * 1) Retrieve the AladinData object corresponding to the default image * 2) Get the Aladin internal reference to the fits keys associated to this image, * and notably the WCS keys * 3) Modify the WCS CRPIX1 and CRPIX2 values * 4) Notify Aladin that the fits key has been modified */ public void exec() { try { AladinData ad = aladin.getAladinImage(); Hashtable header = ad.seeFitsKeys(); double crpix1 = Double.parseDouble( (String)header.get("CRPIX1") ); double crpix2 = Double.parseDouble( (String)header.get("CRPIX2") ); header.put("CRPIX1",(100+crpix1)+""); header.put("CRPIX2",(100+crpix2)+""); ad.fitsKeysModified(); } catch( Exception e ) { aladin.warning("Plugin error: "+e.getMessage()); } } }