Microscopy Image Browser  1.233
All Classes Files Functions Variables Pages
bwdistsc.m File Reference

D=BWDISTSC(BW,ASPECT) BWDISTSC computes Euclidean distance transform of a binary 3D image BW. Distance transform assigns to each pixel in BW a number that is the distance from that pixel to the nearest nonzero pixel in BW. BWDISTSC can accept a regular 2D image, a 3D array, and a cell array of 2D slices. ASPECT is a 3-component vector defining the voxel-aspect-ratio for BW. If ASPECT is not given, [1 1 1] isotropic aspect ratio is assumed. More...

Functions

function D = bwdistsc (bw, aspect)
 D=BWDISTSC(BW,ASPECT) BWDISTSC computes Euclidean distance transform of a binary 3D image BW. Distance transform assigns to each pixel in BW a number that is the distance from that pixel to the nearest nonzero pixel in BW. BWDISTSC can accept a regular 2D image, a 3D array, and a cell array of 2D slices. ASPECT is a 3-component vector defining the voxel-aspect-ratio for BW. If ASPECT is not given, [1 1 1] isotropic aspect ratio is assumed. More...
 

Detailed Description

D=BWDISTSC(BW,ASPECT) BWDISTSC computes Euclidean distance transform of a binary 3D image BW. Distance transform assigns to each pixel in BW a number that is the distance from that pixel to the nearest nonzero pixel in BW. BWDISTSC can accept a regular 2D image, a 3D array, and a cell array of 2D slices. ASPECT is a 3-component vector defining the voxel-aspect-ratio for BW. If ASPECT is not given, [1 1 1] isotropic aspect ratio is assumed.

Function Documentation

function D = bwdistsc (   bw,
  aspect 
)

D=BWDISTSC(BW,ASPECT) BWDISTSC computes Euclidean distance transform of a binary 3D image BW. Distance transform assigns to each pixel in BW a number that is the distance from that pixel to the nearest nonzero pixel in BW. BWDISTSC can accept a regular 2D image, a 3D array, and a cell array of 2D slices. ASPECT is a 3-component vector defining the voxel-aspect-ratio for BW. If ASPECT is not given, [1 1 1] isotropic aspect ratio is assumed.

BWDISTSC uses fast optimized scan algorithm and cell-arrays to represent internal data, and is less demanding to physical memory as well as in many cases up to 10 times faster than MATLAB's native bwdist.

Example
bw=zeros(100,100,100); bw(40:60,40:60,40:60)=1; tic;D=bwdist(bw);toc tic;D=bwdistsc(bw);toc

BWDISTSC tries to use MATLAB bwdist from image processing toolbox for 2D scans if possible, which is faster, otherwise BWDISTSC will use its own algorithm to also perform 2D scans. Own algorithm is also used if x- and y-anisotropy scales are not equal; therefore, if your data has only one axis that is anisotropic, it is always advantageous to feed it to BWDISTSC so that the anisotropic axis is z.

(c) Yuriy Mishchenko HHMI JFRC Chklovskii Lab JUL 2007 Updated Yuriy Mishchenko (Toros University) SEP 2013

Referenced by ibwatershedGui>doObjectSeparation().

Here is the caller graph for this function: