//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 files2", false); //if checked "tif" images are deleted further down in the code Dialog.addCheckbox("Generate single JPG Image", false); //if checked "tif" images of every flow chamber are exported 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(); Single_export = 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); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Defining Function for processing image ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function process(filename) { open(filename); 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 //Filename extrahieren///////////////////////////////// Filename=getTitle(); print("Filename:", Filename); Filename_end = indexOf(Filename, ".tif"); //Weleche Position hat ".tif" Filename= substring (Filename, 0, Filename_end); //Titel extrahieren von Position "0" bis ".tif" print("Filename:", Filename); //////////////////////////////////////////////////// //Position extrahieren////////////////////////////// Position_end = indexOf(Filename, "_"); Position = substring (Filename, 0, Position_end); print("Position:", Position); //////////////////////////////////////////////////// //////////////////////////////////////////////////// /*Instrument/////////////////////////////////////// Looks in the Filename for the Instrument Type */ Instrument_start = indexOf(Filename, "_Z"); Instrument_start = Instrument_start + 1; //increase start index to get rid of text in front of value Instrument_end = Instrument_start + 2; Instrument = substring (Filename, Instrument_start, Instrument_end); //Titel extrahieren von Position "0" bis ".tif" print("Instrument:", Instrument); //////////////////////////////////////////////////// //MetaInfo extrahieren///////////////////////////////// MetaInfo = getMetadata("Info"); //MetaInfos auslesen print("MetaInfo:", MetaInfo); //////////////////////////////////////////////////// /*Emission filter/////////////////////////////////// Looks in the MetaInfos for the type of Emmsion filter and colors the image accordingly Looks for [title="Emission filter" value="Red"] if not present value=-1 */ Emission = indexOf(MetaInfo, "title=\"Emission filter\" value=\"Red\""); //wenn der String gefundenwird wird LUT "Red" verwendet print("Emission:", Emission); if (Emission!=-1) { run("Red"); wait(100); //If no wait the LUT is not applied properly } Emission = indexOf(MetaInfo, "title=\"Emission filter\" value=\"Green\""); //wenn der String gefundenwird wird LUT "Gr�n" verwendet //print("MetaTitel:", Emission); //if both is not found it stays as it is if (Emission!=-1) { run("Green"); wait(100); //If no wait the LUT is not applied properly } //////////////////////////////////////////////////// //////////////////////////////////////////////////// /*Coupling value/////////////////////////////////// Looks in the MetaInfos for the coupling value Looks for [title="Coupling value" value="] if not present value=-1 */ Coupling_start = indexOf(MetaInfo, "title=\"Coupling value\" value="); Coupling_start = Coupling_start + 30; //increase start index to get rid of text in front of value print("C_start:", Coupling_start); Coupling_end = indexOf(MetaInfo, "\"/>