Re: multichannel kymographs

Posted by Krs5 on
URL: http://imagej.273.s1.nabble.com/multichannel-kymographs-tp5007878p5007883.html

Dear Jeff,

I have made some changes to one of the macros I have written for kymographs so that it might work for your files. It is written for a Hyperstack with 2 channels.

Install the macro and you will get an icon in the tool bar. Open your image, draw a line, select the icon and click in your image and hopefully your kymograph will be created. The line width can be changed by double clicking on the icon. Default = 5 but can easily be changed in the code below by changing the value of x.

The output is a merged image with kymograph for channel 1 in  red and for channel 2 in green.


// This macro will take a line selection (Straight line, Segmented line or Freehand line) and
// create a kymograph. It is written for a Hyperstack composed of 2 channels.
// The user can change the width of the line by double clicking the icon. The default is 5. Once changed
// this keeps the new value till the macro is restarted. This value can be changed in the code
// below by changing the value of x.
// Kees Straatman, University of Leicester, 23 May 2014

var x = 5;

macro "kymograph Tool - C000C333C222Dd3C222C333D5bC333Db5C333D78C333dC4C444D2cD69C444D4bC444D97C444Da6C444C555D1cC555De1C555C666D87C666D0dC666D3bC666De2C666C777Df0C777Dd2C777Dd4C777C888Dc5C888C999Db6C999D4aC999D3cC999D88C999CaaaD6aCaaaD68CaaaD0cD96CaaaD59CbbbD5bCbbbDe0CbbbDc3CbbbD1dCbbbD2bCbbbD79CbbbCcccDf1CcccDa5CcccDa7CcccD77CcccCdddDb4CdddDe3CdddCeeeD4cCeeeD98CeeeDd1CeeeD2dDd5CeeeCfffD1bCfffD86CfffDc6CfffDc2CfffD3aCfffD0eCfffD89Df2CfffDe4CfffD0fD58D5cD6bCfffD3dD67D95Db7CfffD0aD0bD1eD1fD49D7aDa4Db3CfffD00D01D02D03D04D05D06D07D08D09D10D11D12D13D14D15D16D17D18D19D1aD20D21D22D23D24D25D26D27D28D29D2aD2eD2fD30D31D32D33D34D35D36D37D38D39D3eD3fD40D41D42D43D44D45D46D47D48D4dD4eD4fD50D51D52D53D54D55D56D57D5dD5eD5fD60D61D62D63D64D65D66D6cD6dD6eD6fD70D71D72D73D74D75D76D7bD7cD7dD7eD7fD80D81D82D83D84D85D8aD8bD8cD8dD8eD8fD90D91D92D93D94D99D9aD9bD9cD9dD9eD9fDa0Da1Da2Da3Da8Da9DaaDabDacDadDaeDafDb0Db1Db2Db8Db9DbaDbbDbcDbdDbeDbfDc0Dc1Dc7Dc8Dc9DcaDcbDccDcdDceDcfDd0Dd6Dd7Dd8Dd9DdaDdbDdcDddDdeDdfDe5De6De7De8De9DeaDebDecDedDeeDefDf3Df4Df5Df6Df7Df8Df9DfaDfbDfcDfdDfeDff"{
        //setBatchMode(true);
        title = getTitle();
        getDimensions(width, height, channels, slices, frames);
        frames = channels*slices*frames;
        frames2 = frames/2;
        run("Straighten...", "line="+x+" process");
        title2=getTitle();
        run("Rotate 90 Degrees Left");
        //run("16 Colors");
        title = getTitle();
        Stack.setChannel(1);
        run("Make Montage...", "columns="+frames2+" rows=1 scale=1 first=1 last="+frames+" increment=1 border=0 font=12");
        rename("Montage-"+title+" channel 1");
        resetMinAndMax();
        selectWindow(title);
        Stack.setChannel(2);
        run("Make Montage...", "columns="+frames2+" rows=1 scale=1 first=2 last="+frames+" increment=2 border=0 font=12");
        rename("Montage-"+title+" channel 2");
        resetMinAndMax();
        run("Merge Channels...", "c1=[Montage-"+title+" channel 1] c2=[Montage-"+title+" channel 2]");
        rename("kymograph-"+title);
        selectWindow(title);
        close();
        setBatchMode("exit and display");

}

macro "MicroTubBleach Tool Options"{
        x = getNumber("line width = ", x);
}


As always not extensively tested.

Best wishes

Kees


Dr Ir K.R. Straatman
Senior Experimental Officer
Advanced Imaging Facility
Centre for Core Biotechnology Services
University of Leicester
http://www2.le.ac.uk/colleges/medbiopsych/facilities-and-services/cbs/lite/aif


-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Jeff Spector
Sent: 23 May 2014 16:00
To: [hidden email]
Subject: multichannel kymographs

Greetings,
I have a stack that is 1800 frames and composed of 2 channels. I would like to draw a line and get the kymographs for each channel individually. Is there a way to do this without having to split the channels and generate the kymograph for each channel by hand?  If I try to make a kymograph of the original 1800 frame, 2 channel stack, I end up getting a 3600 line long kymograph where the channels are intersperesed, i.e. it goes ch1 ch2 ch1
ch2 etc..
I would like them to be separated ( and overlayed on each other if possible). Does this tool exist ?
thanks..
Jeff

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html