Dear Application Interest Group members,
We are developing an advanced Aladin PLUGIN mechanism allowing anybody to develop and "plug" their own java classes for extending Aladin.
We plan to deliver this new feature in the next Aladin official release
in January 2007.
In the mean time, we will be very pleased to have feedbacks/remarks
about this new feature.
All related documentation and an Aladin prototype can be downloaded from http://aladin.u-strasbg.fr/java/nph-aladin.pl?frame=plugins and I have joined to this mail a simple example.
Thanks for any remarks
Regards
Pierre Fernique
import cds.aladin.*;
public class Rotation extends AladinPlugin {
public String menu() { return "Image rotation"; }
/*
* Execute an 90° image rotation
* 1) get the pixels and image size
* 2) create a new pixel array width=>height and height=>width
* 3) rotate the image from the previous array to the new one
* 4) send the new pixel array to Aladin
*/
public void exec() {
try {
AladinData sd = aladin.getAladinImage();
double [][] pix = sd.getPixels();
int w = sd.getWidth();
int h = sd.getHeight();
double [][] rotpix = new double[h][w];
for( int y=0; y<h; y++) {
for( int x=0; x<w; x++ ) rotpix[y][w-x-1] = pix[x][y];
}
sd.setPixels(rotpix);
} catch( AladinException e ) { e.printStackTrace(); }
}