Code covered by the BSD License  

Highlights from
3D Voronoi diagram

Be the first to rate this file! 22 Downloads (last 30 days) File Size: 1.97 KB File ID: #41729
image thumbnail

3D Voronoi diagram

by

 

13 May 2013 (Updated )

Given a list of centroids (.txt), it computes the 2D/3D voronoi diagram.

| Watch this File

File Information
Description

Given a list of centroids (.txt), it computes the 2D/3D voronoi diagram and extracts each Voronoi cell from the original image.
The voronoi diagram is calculated based on the Euclidean distance in 3D space.

centroid = [x1 y1 z1]
voxel = [x2 y2 z2]
for each voxel
    Euclidean distance = sqrt((x2-x1)^2+(y2-y1)^2+(z2-z1)^2)
end

Required inputs: Centroids (.txt) and Original image (.tif)

%Centroids.txt (tab/comma delimited)
% x y z
%---------------------------
%| 881.18 920.484 14.89 |
%| 729.081 882.986 29.403 |
%| 611.288 322.088 25.509 |
%| 574.717 859.578 14.372 |
%| 64.306 743.749 33.244 |
%| 316.106 346.42 30.635 |
%-------------------------------

Original image to extract each Voronoi region. (You can use a dummy image, i.e. originalImage = zeros(100,100,100);)

Required Products MATLAB
MATLAB release MATLAB 7.11 (R2010b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
22 Jul 2014 Farid

I receive the following error;

Error: File: \MATLAB6p1\work\VoronoiCells.m Line: 59 Column: 19 Expected a variable, function, or constant, found ",".

The line is; [~,index] = min(eucDistance);
Would you help to resolve. Thanks

10 Nov 2013 Gustavo Jaime-Muñoz

Were can I find the .tif file?

Updates
26 Mar 2014

Minor modification to make it easier to use.

Contact us