post:meanintinellipse.m

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
post:meanintinellipse.m [2019/10/11 14:39] – created pseudomoanerpost:meanintinellipse.m [2019/11/18 16:45] (current) – pseudomoaner
Line 1: Line 1:
 ====== meanIntInEllipse.m ===== ====== meanIntInEllipse.m =====
  
-**Description:** Takes in the [[usage:tracking#outputs|procTracks]] data structure and two manually specified channel indices, and splits tracks based on the ratio of fluorescence in the two channels. Assumes that there are two populations in the dataset, each labelled in a separate channel.+**Class:** Function 
 + 
 +**Description:** Takes in a specified element of the [[usage:tracking#outputs|procTracks]] data structure and an image, and calculates the average intensity of pixels in that image within an ellipse with geometry defined by the selected object.
  
 **Author:** Oliver J. Meacock **Author:** Oliver J. Meacock
Line 29: Line 31:
  
 %Rescale ellipse parameters %Rescale ellipse parameters
-xPx = procTrack.x(ind)/pxSize; +xPx = round(procTrack.x(ind)/pxSize); 
-yPx = procTrack.y(ind)/pxSize; +yPx = round(procTrack.y(ind)/pxSize); 
-minLenPx = procTrack.minorLen(ind)*2/pxSize; +minLenPx = round(procTrack.minorLen(ind)/pxSize); 
-majLenPx = procTrack.majorLen(ind)*2/pxSize;+majLenPx = round(procTrack.majorLen(ind)/pxSize);
 phi = procTrack.phi(ind); phi = procTrack.phi(ind);
  
Line 62: Line 64:
  
 </code> </code>
 +
 +**Example usage**
 +
 +<code matlab>
 +  imgLoc = 'FluoImg.tif';
 +  trackLoc = 'Tracks.mat';
 +  load(trackLoc,'procTracks')
 +  
 +  %Get the pixel size from the input image
 +  imgInfo = imfinfo(imgLoc);
 +  pixelSize = 1/imgInfo.XResolution;
 +  
 +  %Load the image
 +  imPlane = double(imread(startImgLoc,'Index',1));
 +  
 +  %Get the mean and total fluorescence of the object in track 10 at timepoint 1
 +  [meanFluo,totalFluo] = meanIntInEllipse(imPlane,procTracks(10),1,pixelSize);
 +</code>
 + 
 +**Example output:** Histogram of mean object intensities for a set of tracks with an associated fluorescence image at their first timepoint. For more details see [[post:labelstartandendfluocells.m]].
 +
 +{{ :post:fluosplitexample2.png?nolink&400 |}}
  • post/meanintinellipse.m.1570801149.txt.gz
  • Last modified: 2019/10/11 14:39
  • by pseudomoaner