//Define Input Dialog/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// requires("1.45f"); Dialog.create("MoloVideo Setup"); Dialog.addMessage("MoloVideo generates a video file containing 3 different data sets") Dialog.addMessage("Therefore 3 seperate folders with Molographic, Straylight and Fluorescence Images are needed") Dialog.addMessage("MoloVideo 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.addCheckbox("Molographic files", true); //if checked "tif" images are deleted further down in the code Dialog.addCheckbox("Straylight files", true); //if checked "tif" images are deleted further down in the code Dialog.addCheckbox("Fluoresence files", true); //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(); //Files_molo = Dialog.getCheckbox(); Files_stray = Dialog.getCheckbox(); Files_fluor = Dialog.getCheckbox(); //print("Values:", Min); //print("Values:", Max); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Load Molostack //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// path_molo = File.openDialog("Select a Molographic File"); //get total file path --> open image Sequence print("Filepath:", path_molo); parent_molo = File.getParent(path_molo); //get folder directory where the selected file is print("Directory:", parent_molo); folder_molo = File.getName(parent_molo); //get folder name --> stack name (needed for stack combination) print("Foldername:", folder_molo); run("Image Sequence...", "open="+path_molo+" sort"); //Image Sequence of all Images makeRectangle(10, 248, 441, 327); //Define Crop area run("Crop"); setMinAndMax(Min, Max); //Set Brightness run(LUT); //Apply coloring to images wait(100); //If no wait the LUT is not applied properly //open(path); /* //Titel extrahieren///////////////////////////////// MetaInfo = getMetadata("Info"); //MetaInfos auslesen //print("MetaInfo:", MetaInfo); //Titel_end = indexOf(MetaInfo, ".tif"); //Weleche Position hat ".tif" //MetaTitel = substring (MetaInfo, 0, Titel_end); //Titel extrahieren von Position "0" bis ".tif" //print("MetaTitel:", MetaTitel); //////////////////////////////////////////////////// //Position extrahieren////////////////////////////// //Position_end = indexOf(MetaInfo, "_"); //Position = substring (MetaInfo, 0, Position_end); //print("MetaTitel:", Position); //////////////////////////////////////////////////// /*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\""); //print("MetaTitel:", 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\""); //print("MetaTitel:", Emission); 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, "\"/> open image Sequence print("Filepath:", path_stray); parent_stray = File.getParent(path_stray); //get folder directory where the selected file is print("Directory:", parent_stray); folder_stray = File.getName(parent_stray); //get folder name --> stack name (needed for stack combination) print("Foldername:", folder_stray); run("Image Sequence...", "open="+path_stray+" sort"); //Image Sequence of all Images makeRectangle(10, 248, 441, 327); //Define Crop area run("Crop"); setMinAndMax(Min, Max); //Set Brightness run(LUT); //Apply coloring to images wait(100); //If no wait the LUT is not applied properly /*Draw Infos into image/////////////////////////////////// */ drawString("Straylight", 10, 40, "white"); wait(100); //waiting for drawing //////////////////////////////////////////////////// } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Load Fluoresence-stack //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (Files_fluor == true) { path_fluor = File.openDialog("Select a Fluoresence File"); //get total file path --> open image Sequence print("Filepath:", path_fluor); parent_fluor = File.getParent(path_fluor); //get folder directory where the selected file is print("Directory:", parent_fluor); folder_fluor = File.getName(parent_fluor); //get folder name --> stack name (needed for stack combination) print("Foldername:", folder_fluor); run("Image Sequence...", "open="+path_fluor+" sort"); //Image Sequence of all Images makeRectangle(10, 248, 441, 327); //Define Crop area run("Crop"); setMinAndMax(Min, Max); //Set Brightness run(LUT); //Apply coloring to images wait(100); //If no wait the LUT is not applied properly /*Draw Infos into image/////////////////////////////////// */ drawString("Fluoresence", 10, 40, "white"); wait(100); //waiting for drawing //////////////////////////////////////////////////// } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /*Generation of Montage///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// All apen Stacks combined in a single Stack */ run("Combine...", "stack1="+folder_molo+" stack2="+folder_stray); run("Combine...", "stack1=[Combined Stacks] stack2="+folder_fluor); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /*Save as Video///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// */ dir_movie = File.getParent(parent_fluor); //get folder directory where the selected file is print("Movie:", dir_movie); print("Movie:", dir_movie+"Video.avi"); run("AVI... ", "compression=PNG frame=13.5 save=["+dir_movie+"/Video.avi]"); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Cleaning up/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //close(); //close Montage //close(); //close Stack //Closing Log Window///////////////////////////// /* if (isOpen("Log")) { selectWindow("Log"); run("Close"); } ////////////////*Generation of Montage//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////