// 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/"
//remoteDir="http://www.euhou.net/SalsaJ/Data/imagesFT_WASP-19b/";
homeDir=getDirectory("home");
print("Script to study the transit of WASP_19b");
print("Load the image files, extract a small area and adjust the intensity thresholds");

runMacro("Close_All_Windows.txt");

for (i=72; i<=76; i++) {
    name="Extract_m_e_20121123_"+i+"_1_1_9.fits";
//       openImage(name,macroDir,remoteDir);
	   file=macroDir+name; open(file);
    run("Enhance Contrast", "saturated=0.5");
    run("Enhance Contrast", "saturated=0.5");
}

run("Séparer");
run("Tile");
run("Kachel");
run("Separar");
run("Disponi tutto");
run("Mosaico");
run("Sida vid sida");
run("Kaskada");

// Propagates the display range of the current image
//  to all open images of the same type.

//    if (nImages<=1) exit;
//    getMinAndMax(min, max);
//    depth = bitDepth();
//    if (depth==24) exit;
//    id = getImageID;
//    for (i=1; i<=nImages; i++) {
//         Selectimage(i);
//         if (depth==bitDepth && getImageID!=id)
//             setMinAndMax(min, max);
//run("Enhance Contrast", "saturated=0.5");
//run("Enhance Contrast", "saturated=0.5");
//
//    }
run("Transférer images dans pile");


