Code covered by the BSD License  

Highlights from
patch_area

4.0

4.0 | 1 rating Rate this file 2 Downloads (last 30 days) File Size: 2.14 KB File ID: #8810

patch_area

by Ted Ballou

 

24 Oct 2005 (Updated 10 Aug 2010)

From a patch representing a thresholded volume, return area and 2D center along the long

| Watch this File

File Information
Description

This function is provided to extract geometric properties of a volume array that has been thresholded and characterized by a patch (of triangular faces) generated by isosurface(). Its purpose is to calculate the area of a nerve cell dendrite, and also locate its center, both described as a function of distance along the long axis.

The user must choose a long direction (axis) for the process; default is 1 (y). The patch is analyzed in terms of 2D pixel layers perpendicular to this axis.

Algorithm: the surface area of each triangle in the patch is calculated and weighted by the two non-axis coordinates of its centroid; these values are summed in the provisional center of mass array, with the long axis coordinate corresponding to the (rounded) long axis coordinate of the centroid. Triangle areas are summed in the area array corresponding to the axis coordinate of each triangle centroid. After all triangles have been analyzed, the center of mass array is normalized by dividing by the total area in each axis layer, resulting in a net center of mass for the 2D layer.

Triangle areas are calculated from a version of Heron’s formula that has been optimized for numerical stability.

% Sample invocation. 3D array ddr represents a dendrite segment.
thr = graythresh(ddr);
p1 = patch(isosurface(ddr, thr));
[area cm] = patch_area(p1,1);

Please reference the following article if this code is used for your published data analysis:
Ballou, E. W., W. B. Smith, et al. (2006). "Measuring dendritic distribution of membrane proteins." Journal of Neuroscience Methods 156(1-2): 257-266.

Required Products Image Processing Toolbox
MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
19 Jan 2009 Martin Tettke

Works great, but has two bugs:

- surface may not cross axis (go through 0)
- small coding bug; replace lines 39f with

area_per_layer = zeros(1,round(m(direction)));
layer_cm = zeros(round(m(direction)),2);

then it works like a charm ;)

Please login to add a comment or rating.
Updates
27 Oct 2005

improved comments & description

10 Oct 2007

Clarify the usage and algorithm

10 Aug 2010

add citation

Tag Activity for this File
Tag Applied By Date/Time
measurements Ted Ballou 22 Oct 2008 08:04:22
patch isosurface projection area axis centroid distance Ted Ballou 22 Oct 2008 08:04:22

Contact us at files@mathworks.com