From b4aa8c6ed8e9b9b05f4e71c93f5f8a4acc57d810 Mon Sep 17 00:00:00 2001 From: glynnelson Date: Wed, 8 Jul 2020 17:20:56 +0100 Subject: [PATCH] Add files via upload --- ...i_counting_wholedir_20x_moments_thresh.txt | 81 +++++++ Foci_counting_wholedir_Choose_thresh.ijm | 223 ++++++++++++++++++ George_mitophagy_Dmi8_looped.ijm | 130 ++++++++++ ROI_overlay_measure_macro.ijm | 39 +++ Split 2 channels Zstacks_v1.0.ijm | 67 ++++++ Yoana_Shrink_ROIv3.ijm | 166 +++++++++++++ convert_lif_files_3.ijm | 95 ++++++++ convert_to_ome_tiff_with choose_filetype.ijm | 101 ++++++++ convert_to_tiff_with choose_filetype.ijm | 101 ++++++++ extract_qptiff_IMAGES_whole_dir.ijm | 51 ++++ flatten_CZI_IMAGES_whole_dir.txt | 38 +++ flatten_ZVI_IMAGES_whole_dir.txt | 38 +++ ...c_counting_wholedir_20x_moments_thresh.txt | 107 +++++++++ ...ample_counting_WholeDir_manualSampling.ijm | 130 ++++++++++ manual_spot_coutning_WholeDir_example.ijm | 90 +++++++ measure_multiImage_CZI_5chMP.ijm | 135 +++++++++++ per_nuc_FISH_modified_Tengfei.txt | 95 ++++++++ realign_20x_DM5500_Cy5cube.ijm | 82 +++++++ 18 files changed, 1769 insertions(+) create mode 100644 Eva_foci_counting_wholedir_20x_moments_thresh.txt create mode 100644 Foci_counting_wholedir_Choose_thresh.ijm create mode 100644 George_mitophagy_Dmi8_looped.ijm create mode 100644 ROI_overlay_measure_macro.ijm create mode 100644 Split 2 channels Zstacks_v1.0.ijm create mode 100644 Yoana_Shrink_ROIv3.ijm create mode 100644 convert_lif_files_3.ijm create mode 100644 convert_to_ome_tiff_with choose_filetype.ijm create mode 100644 convert_to_tiff_with choose_filetype.ijm create mode 100644 extract_qptiff_IMAGES_whole_dir.ijm create mode 100644 flatten_CZI_IMAGES_whole_dir.txt create mode 100644 flatten_ZVI_IMAGES_whole_dir.txt create mode 100644 foci_and_coloc_counting_wholedir_20x_moments_thresh.txt create mode 100644 manual_randomSample_counting_WholeDir_manualSampling.ijm create mode 100644 manual_spot_coutning_WholeDir_example.ijm create mode 100644 measure_multiImage_CZI_5chMP.ijm create mode 100644 per_nuc_FISH_modified_Tengfei.txt create mode 100644 realign_20x_DM5500_Cy5cube.ijm diff --git a/Eva_foci_counting_wholedir_20x_moments_thresh.txt b/Eva_foci_counting_wholedir_20x_moments_thresh.txt new file mode 100644 index 0000000..3199b1f --- /dev/null +++ b/Eva_foci_counting_wholedir_20x_moments_thresh.txt @@ -0,0 +1,81 @@ +//Assumes the image is a tif with DAPI in channel1, H2AX in channel2 +// It looks for nuclei then counts respective spots for each nucleus. +//All results get stored in a concatenating results file. +//Plus the mask images are stored (all 2 original images converted to masks) +// so you can see what it did. +// altered so find maxima works on raw data,not thresholded. +// var tolerance = 30; removed this and set manually in find maxima. +run("Set Measurements...", "area integrated limit display redirect=None decimal=0"); + +dir1 = getDirectory("Choose folder with tif files "); +list = getFileList(dir1); + +setBatchMode(true); + +// create folders for the tifs + dir1parent = File.getParent(dir1); + dir1name = File.getName(dir1); + dir2 = dir1parent+File.separator+dir1name+"_masks"; + if (File.exists(dir2)==false) { + File.makeDirectory(dir2); // new directory for mask images + } + +for (i=0; i 20) parentDir = substring(parentDir, 0, 20); + +// Defining output directory +outdirs = newArray(nCh); +for (o=0; o0){ + roiManager("Delete"); + } +roiManager("Add"); +roiManager("Select", 0); +roiManager("Rename", "Outside"); +run("Set Measurements...", "area mean min fit shape feret's integrated display redirect=None decimal=3"); +run("Measure"); +Ferets = getResult("Minor"); +//Ferets = getResult("Feret"); +ShrinkFactor = (Ferets*0.1); +//print (ShrinkFactor); +for (i = 1; i < 10; i++){ + Shrink = (Ferets-(i*ShrinkFactor)); +// getResult("Frame", i) + 1; +// Ferets = getResult("Feret", i); +// Min = getResult("Min", i); +// print(frame + ", " + Ferets + ", " + Min); + Scale = (Shrink/Ferets); + run("Scale... ", "x=Scale y=Scale centered"); + roiManager("Add"); + roiManager("Select", i); + roiManager("Rename", i); +// print(Ferets + ", " + ShrinkFactor + ", " + Shrink); +} +roiManager("Deselect"); +// Need to reset scaling back to original image here **UPDATE-NO NEED- IT WORKS FINE REGARDLESS OF IMAGE SCALING +run("Set Measurements...", "area mean integrated display redirect=None decimal=3"); +roiManager("multi-measure measure_all"); +saveAs("Results", dir+File.separator+name+"Decile_Areas100to10pct.csv"); +run("Duplicate...", "title=ForColoc duplicate"); +//rename("ForColoc"); +selectWindow("ForColoc"); +roiManager("Select", 2); +setBackgroundColor(0, 0, 0); +run("Clear"); +//run("Clear", "slice"); +roiManager("Select", 1); +run("Clear Outside"); +saveAs("TIFF", dir +File.separator+name+"MembraneRing10pct.tif"); + +//Now also get ring values +rename("10pctRing"); + +selectWindow(name); +run("Duplicate...", "title=100pctRing duplicate"); +selectWindow("100pctRing"); +roiManager("Select", 9); +roiManager("Rename", "100"); +run ("Clear Outside"); +roiManager("multi-measure measure_all"); +close ("100pctRing"); + +selectWindow("name); +run("Duplicate...", "title=90pctRing duplicate"); +selectWindow("90pctRing"); +roiManager("Select", 100); +run("Clear"); +roiManager("Select", 8); +roiManager("Rename", "90"); +run ("Clear Outside"); +roiManager("multi-measure measure_all append"); +close ("90pctRing"); + +selectWindow("name); +run("Duplicate...", "title=80pctRing duplicate"); +selectWindow("80pctRing"); +roiManager("Select", 90); +run("Clear"); +roiManager("Select", 7); +roiManager("Rename", "80"); +run ("Clear Outside"); +roiManager("multi-measure measure_all append"); +close ("80pctRing"); + +selectWindow("name); +run("Duplicate...", "title=70pctRing duplicate"); +selectWindow("70pctRing"); +roiManager("Select", 80); +run("Clear"); +roiManager("Select", 6); +roiManager("Rename", "70"); +run ("Clear Outside"); +roiManager("multi-measure measure_all append"); +close ("70pctRing"); + +selectWindow("name); +run("Duplicate...", "title=60pctRing duplicate"); +selectWindow("60pctRing"); +roiManager("Select", 70); +run("Clear"); +roiManager("Select", 5); +roiManager("Rename", "60"); +run ("Clear Outside"); +roiManager("multi-measure measure_all append"); +close ("60pctRing"); + +selectWindow("name); +run("Duplicate...", "title=50pctRing duplicate"); +selectWindow("50pctRing"); +roiManager("Select", 60); +run("Clear"); +roiManager("Select", 4); +roiManager("Rename", "50"); +run ("Clear Outside"); +roiManager("multi-measure measure_all append"); +close ("50pctRing"); + +selectWindow("name); +run("Duplicate...", "title=40pctRing duplicate"); +selectWindow("40pctRing"); +roiManager("Select", 50); +run("Clear"); +roiManager("Select", 3); +roiManager("Rename", "40"); +run ("Clear Outside"); +roiManager("multi-measure measure_all append"); +close ("40pctRing"); + +selectWindow("name); +run("Duplicate...", "title=30pctRing duplicate"); +selectWindow("30pctRing"); +roiManager("Select", 40); +run("Clear"); +roiManager("Select", 2); +roiManager("Rename", "30"); +run ("Clear Outside"); +roiManager("multi-measure measure_all append"); +close ("30pctRing"); + +selectWindow("name); +run("Duplicate...", "title=20pctRing duplicate"); +selectWindow("20pctRing"); +roiManager("Select", 30); +run("Clear"); +roiManager("Select", 1); +roiManager("Rename", "20"); +run ("Clear Outside"); +roiManager("multi-measure measure_all append"); +close ("20pctRing"); + +selectWindow("10pctRing"); +roiManager("Select", Outside); +roiManager("Rename", "10"); +roiManager("multi-measure measure_all append"); +close ("10pctRing"); + +showMessage(" Well, I think we gave them a damn good thrashing there, what what??"); diff --git a/convert_lif_files_3.ijm b/convert_lif_files_3.ijm new file mode 100644 index 0000000..051cb36 --- /dev/null +++ b/convert_lif_files_3.ijm @@ -0,0 +1,95 @@ +macro 'convert LIF tiff' { + +/* + * - converts LIF files into TIFF. + * - the macro ask for an input folder that should contain 1 or more lif files. Nothing else. + * - each series is saved as one tiff. The name of the series is appended to the file name. + * - if the series has more than one frame, a Max Intensity projection is also performed + * - before saving. The TIFFs are saved in a folder generated by the macro in the same + * - parent folder as the lifs, with the same prefix for the folder name, with TIFF suffix. + * + * Martin Hoehne, August 2015 + * + * Update October 2015: works for Multichannel images as well + * + * Update Jan2016 (Glyn Nelson). Now also saves z stack as well as mip if it is a z stack. + * This works with SP8 images as long as they aren't in subfolders, such as Mark and Find: these + * images have a '/' in their name, so it throws an error when trying to save. + * Update Jan2016 (Glyn Nelson). Fixed. It will now remove '/' if it exists in the imagename before saving. + * + * Update Feb 2016 (Glyn Nelson). Now ignores other files in the folder with lifs (although it will give multiple finished + * messages for each extra file it finds...) + */ + +run("Bio-Formats Macro Extensions"); + + +dir1 = getDirectory("Choose folder with lif files "); +list = getFileList(dir1); + +setBatchMode(true); + +// create folders for the tifs + dir1parent = File.getParent(dir1); + dir1name = File.getName(dir1); + dir2 = dir1parent+File.separator+dir1name+"_Tiffs"; + if (File.exists(dir2)==false) { + File.makeDirectory(dir2); // new directory for tiff + } + +for (i=0; i1) { + run("Z Project...", "projection=[Max Intensity]"); + if (nSlices>1) Stack.setDisplayMode("composite"); + saveAs("Tiff", dir2+File.separator+name+"_"+seriesname+"_MIP.tif"); + close(); + Stack.setDisplayMode("composite"); + saveAs("TIFF", dir2+File.separator+name+"_"+seriesname+".tif"); + } + else Stack.setDisplayMode("composite"); + saveAs("TIFF", dir2+File.separator+name+"_"+seriesname+".tif"); + run("Close All"); +// run("Collect Garbage"); + + } + +} +//showMessage(" Well, I think we gave them a damn good thrashing there, what what??"); +run("Close All"); +setBatchMode(false); + +} +showMessage(" Well, I think we gave them a damn good thrashing there, what what??"); + // macro diff --git a/convert_to_ome_tiff_with choose_filetype.ijm b/convert_to_ome_tiff_with choose_filetype.ijm new file mode 100644 index 0000000..e961ef7 --- /dev/null +++ b/convert_to_ome_tiff_with choose_filetype.ijm @@ -0,0 +1,101 @@ +//FUNCTION: opens a dialog to set text list for filtering a list +//example: setDialogImageFileFilter(); +//this function set interactively the global variables used by the function getFilteredFileList +//it can be set to ask for other text to filter files on. I didn't get this to work though and have removed them. +//this function needs global variables! (see below) +/* + +var fileExtension = ".tif"; //default definition of extension +var filterStrings = newArray("","",""); //default definition of strings to filter +var availableFilterTerms = newArray("no filtering", "include", "exclude"); //dont change this +var filterTerms = newArray(filterStrings.length); for (i = 0; i < filterStrings.length; i++) {filterTerms[i] = "no filtering";} //default definition of filter types (automatic) +//var filterTerms = newArray("no filtering", "no filtering", "no filtering"); //default definition of filter types (manual) +var displayFileList = false; //shall array window be shown? +*/ +function setDialogImageFileFilter() { +Dialog.create("Image file filter..."); //enable use interactivity +Dialog.addMessage("Define the file types to be processed:"); +Dialog.addString("Files should have this extension:", fileExtension); //add extension +//Dialog.addMessage("Define filter for files:"); +//for (i = 0; i < filterStrings.length; i++) { +// Dialog.addString((i + 1) + ") Filter this text from file list: ", filterStrings[i]); +// Dialog.addChoice((i + 1) + ") Files with text are included/excluded?", availableFilterTerms, filterTerms[i]); +// } +//Dialog.addCheckbox("Show the file list to check?", displayFileList); //if check file lists will be displayed +Dialog.addMessage("This macro will make a new folder with a TIFF suffix where converted files are saved"); +Dialog.show(); +fileExtension = Dialog.getString(); +//for (i = 0; i < filterStrings.length; i++) { +// filterStrings[i] = Dialog.getString(); +// filterTerms[i] = Dialog.getChoice(); +// } +//displayFileList = Dialog.getCheckbox(); +} + + +var fileExtension = ".nd2"; +//var filterStrings = newArray("MAX","Processed"); +//var availableFilterTerms = newArray("no filtering", "include", "exclude"); //dont change this +//var filterTerms = newArray(filterStrings.length); for (i = 0; i < filterStrings.length; i++) {filterTerms[i] = "no filtering";} +//var displayFileList = false; + + + + + +setDialogImageFileFilter(); + + +run("Bio-Formats Macro Extensions"); + + +dir1 = getDirectory("Choose folder with image files "); +list = getFileList(dir1); + +setBatchMode(true); + +// create folders for the tifs + dir1parent = File.getParent(dir1); + dir1name = File.getName(dir1); + dir2 = dir1parent+File.separator+dir1name+"_Tiffs"; + if (File.exists(dir2)==false) { + File.makeDirectory(dir2); // new directory for tiff + } + +for (i=0; i