// An imageJ macro to be used with exercice 
// Pour avoir les accents, enregistrer en format
// OCCIDENTAL WINDOWS LATIN 1
// sinon ça plante !

setBatchMode(false);

macroDir = getDirectory("SalsaJ")+"Data/imagesFT_WASP-19b/";
print("macroDir=",macroDir);
//macroDir = "/Users/melchior/EUHOU/SalsaJ/Release/Data/imagesFT_Corot-2b/"
remoteDir="http://www.euhou.net/SalsaJ/Data/imagesFT_WASP-19b/";
homeDir=getDirectory("home");
print("Script to extract a small image around WASP-19b");
print("Load the image files, extract a small area and adjust the intensity thresholds");

runMacro("Close_All_Windows.txt");

//for (i=102; i<201; i++) {
for (i=72; i<=76; i++) {
    name="m_e_20121123_"+i+"_1_1_9.fits";
    file=macroDir+name; open(file);
    makeRectangle(300, 260, 400, 400);
    run(		      "Crop");
    run("Rogner");
    saveAs("FITS", macroDir+"Extract_"+name);
//    setMinAndMax(0.000000000, 150.000000000);
    close();
}

