Home > SuperSegger > viz > makeConsensusKymo.m

makeConsensusKymo

PURPOSE ^

intMakeConsensusKymo : creates a consensus kymograph

SYNOPSIS ^

function [ kymo,kymoMask ] = makeConsensusKymo(imCellS, maskCellS, disp_flag )

DESCRIPTION ^

  intMakeConsensusKymo : creates a consensus kymograph
  To obtain imCellS and maskCellS you can call
  [dataImArray] = makeConsensusArray( cellDir, CONST, skip, mag, clist )
 and then use  dataImArray.imCellNorm and dataImArray.maskCell

 INPUT :
       imCellS : a cell array of images of towers of cells (need to have the
       same dimensions)
       maskCellS : the masks of each tower
       disp_flag : 1 to display the image

 OUTPUT:
      kymo : Consensus Kymograph
      kymoMask : Consensus Kymograph Cell mask
      kymoMax : maximum value kymograph
      kymoMaskMax : mask of maximum value kymograph

 Copyright (C) 2016 Wiggins Lab
 Written by Stella Stylianidou, Paul Wiggins.
 University of Washington, 2016
 This file is part of SuperSegger.

 SuperSegger is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 SuperSegger is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with SuperSegger.  If not, see <http://www.gnu.org/licenses/>.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ kymo,kymoMask ] = makeConsensusKymo(...
0002     imCellS, maskCellS, disp_flag )
0003 %  intMakeConsensusKymo : creates a consensus kymograph
0004 %  To obtain imCellS and maskCellS you can call
0005 %  [dataImArray] = makeConsensusArray( cellDir, CONST, skip, mag, clist )
0006 % and then use  dataImArray.imCellNorm and dataImArray.maskCell
0007 %
0008 % INPUT :
0009 %       imCellS : a cell array of images of towers of cells (need to have the
0010 %       same dimensions)
0011 %       maskCellS : the masks of each tower
0012 %       disp_flag : 1 to display the image
0013 %
0014 % OUTPUT:
0015 %      kymo : Consensus Kymograph
0016 %      kymoMask : Consensus Kymograph Cell mask
0017 %      kymoMax : maximum value kymograph
0018 %      kymoMaskMax : mask of maximum value kymograph
0019 %
0020 % Copyright (C) 2016 Wiggins Lab
0021 % Written by Stella Stylianidou, Paul Wiggins.
0022 % University of Washington, 2016
0023 % This file is part of SuperSegger.
0024 %
0025 % SuperSegger is free software: you can redistribute it and/or modify
0026 % it under the terms of the GNU General Public License as published by
0027 % the Free Software Foundation, either version 3 of the License, or
0028 % (at your option) any later version.
0029 %
0030 % SuperSegger is distributed in the hope that it will be useful,
0031 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0032 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0033 % GNU General Public License for more details.
0034 %
0035 % You should have received a copy of the GNU General Public License
0036 % along with SuperSegger.  If not, see <http://www.gnu.org/licenses/>.
0037 
0038 
0039 
0040 T0 = numel( imCellS );
0041 mag = 4;
0042 kymo = [];
0043 kymoMask = [];
0044 
0045 if T0 > 0
0046     % initialize
0047     ss    = size( imCellS{T0} );
0048     ssMax = size( imresize(imCellS{T0}, 1/mag) );
0049     kymo    = zeros( [ss(2), T0] );
0050     kymoMax = zeros( [ssMax(2), T0] );
0051     kymoMask    = kymo;
0052     kymoMaskMax = kymoMax;
0053     midpoint = ss(2)/2;
0054     for ii = 1:T0
0055         maskCellS{ii}( isnan( maskCellS{ii} ) ) = 0;
0056         imCellS{ii}( isnan( imCellS{ii} ) )     = 0;
0057         tmpKymo =  sum(maskCellS{ii}.*imCellS{ii},1);
0058         imageSize = size(tmpKymo,2);
0059         md_temp = round(imageSize/2);
0060         start_ind = midpoint-md_temp+1;
0061         end_ind =  imageSize + start_ind-1;
0062         kymo(start_ind:end_ind,ii)= (tmpKymo);
0063         kymoMask(start_ind:end_ind,ii) = (sum(maskCellS{ii},1));
0064         
0065     end
0066     
0067     if disp_flag
0068         figure(2);
0069         clf;
0070         ss = size( kymo );
0071         tt = (0:(ss(2)-1))/(ss(2)-1);
0072         xx = (0:(ss(1)-1))/(ss(1)-1);
0073         imagesc( tt,xx -.5, colorize(kymo,kymoMask,[],[0.33,0.33,0.33]) );
0074         set(gca, 'YDir', 'normal' );
0075         title ('Consensus Kymograph');
0076         xlabel( 'Time (Cell Cycle)');
0077         ylabel( 'Relative Long Axis Position (L_{endCellCycle}))');
0078     end
0079     
0080 end
0081 
0082 end

Generated on Thu 19-Jan-2017 13:55:21 by m2html © 2005