//Define Input Dialog///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
requires("1.45f");
Dialog.create("MoloCutter Setup");
Dialog.addMessage("MoloCutter Requires ImageJ v.1.45f")
Dialog.addMessage("Enter Values for Image Adjustment")
Dialog.addSlider("Brightness Min:", 0, 65000, 100);
Dialog.addSlider("Brightness Max:", 0, 65000, 5000);
Dialog.addChoice("LUT for Straylight images", newArray("Fire", "Grays", "Ice", "Spectrum"), "Fire") //define colorcode of straylight images
Dialog.addCheckbox("Delete Original files", false); //if checked "tif" images are deleted further down in the code
Dialog.show();
///////////////////////////////////////////////////////
//Save variables of Dialog///////////////////////// transfered in order of apperance in the dialoge
Min = Dialog.getNumber();
Max = Dialog.getNumber();
LUT = Dialog.getChoice();
Delete = Dialog.getCheckbox();
//print("Values:", Min);
//print("Values:", Max);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Get Directory ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
path = File.openDialog("Select a File");
//print("Path:", path);
dir = File.getParent(path);
//print("Directory:", dir);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Open and process images //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
run("Image Sequence...", "open="+path+" sort"); //Image Sequence of all Images
makeRectangle(10, 248, 441, 327); //Define Crop area
run("Crop"); //Crop images to Molo area
setMinAndMax(Min, Max); //Set Brightness
run(LUT); //Apply coloring to images
wait(100); //If no wait the LUT is not applied properly
run("Stack to Images"); //Separete Images for unique processing
openImages = nImages(); //Get number of all open Images
//print(openImages);
i = 0; //Loop index
while (i