//Macro to generate Kymos from MT snaps and GFP streams. //Chris Gell 24-05-2018 //Version 3beta1 //Macro is run from SLIMcg>Friel>Kymos from Snaps and Streams. //Tested only with 512x512, 16bit, .czi and .dv Tiffs. //Macro to make kymographss for SM TIRF data sets - specifically GFP's on fluorecentlabelled microtubules. //Requires 2 images are loaded and that these are a stream (stack) and a single-slice mt image. //Microtubules can be selected by either an algorithm (how well this works is largely dependant on the contrast and SNR of the MT image. //Some images //There is then an option to manually edit these selections, or delete all of them, and use your own. Microtubule slections must be added to the ROI manager. //To analyse the next image clear the ROI manager, close all open images and re-rum the macro. //and close all open windows. //load the next strem and snap. // to add // reduce thickness or transparency of the lines in the mt map //add in auto MT detection. //DONE - name directory in an intelegent way - not wanted, not flexible. //DONE, not wanted - cope with multiple streams (of the same MT FOV)? //2018-10-18 updated a stream and MTs were still sometimes misidentified //2018-10-18 updated to allow some chromatic shift correction, this is base dont he Fiji 'Align image by lin ROI' tools. //2018-10-24 started tidying up and adding more functioanlity to prepare for a write-up //environment variables envAskForPNGs=0; // TRUE if PNGs should be saved. envDoChromaticCorr=0; // TRUE if chromatic shift should be done. //tidy up print("\\Clear"); //Clear the log. if (roiManager("count") !=0) { roiManager("Deselect"); roiManager("Delete"); } //set some behavious of various parts. roiManager("show all with labels"); //see if any images are open, must only have two images open. if (nImages!=2) { exit("Too many or too few images open, open 2 images, the MTs and SM stream.") } //ask for an identifier for this analysis expName=getString("Enter an indetifier for this experiment", "SM TIRF "); //going to get the names of the MT and stream image now. var gfpImageName=""; var mtImageName=""; getImageNames(); //do a quick contrast strtch selectWindow(gfpImageName); run("Enhance Contrast", "saturated=0.35"); run("Set... ", "zoom=150"); selectWindow(mtImageName); run("Enhance Contrast", "saturated=0.35"); run("Set... ", "zoom=150"); run("Tile"); //WIll ask if we need to do a chromatic aberration correction and run it. doCromaticAbCorr(); //Ask if the user want to attempt auto MT detection doMTDetection(); //make the snap have the same number of frames as in the stream convSnapToStream(); //the user needs to add the ROI waitForUser("Please make sure you have selected ROI's as required."); //loop throught the ROI manager to create each of the kymos n = roiManager("count"); for (i=0; i1) { gfpImageName=list[0]; mtImageName=list[1]; } } function convSnapToStream() { selectWindow(gfpImageName); getDimensions(width, height, channels, slices, frames); gfpImageID=getImageID(); n = frames; //make the MT image the same length selectWindow(mtImageName); mtImageID=getImageID(); //make a blurred mt image, a little better look for the kymos run("Gaussian Blur...", "sigma=1"); run("Copy"); for (i=0; i