File Exchange

image thumbnail

surface2volume

version 1.0 (9.29 KB) by

Convert a volume defined by a surface to a binary 3D block.

14 Downloads

Updated

No License

First the surface will be rasterized on the grid. Therefore it calculates the position of points which lie in the surface in a finer resolution as defined by the inputgrid. These points were then tranfered to the point it the inputgrid by using a simple indexing technique. One could also use dsearchn, but this takes to much computational time, however, it can avoid the need of an equidistant grid. After rasterizing the patches the background is fill using imfill. The start point is set to the lower left corner. Afterwards the data block will be inverted. The script tests if the datablock is fully filled and tries to repeat the task slice by slice.

Comments and Ratings (15)

Very good!
You need to run the example program in the comments section of the code, using " load mri ". " mri " is a MAT file of image slices that MATLAB already knows about in its example programs set. Also see:
How to create a single .mat file from multiple images?
@ https://uk.mathworks.com/matlabcentral/answers/49954-how-to-create-a-single-mat-file-from-multiple-images

don't work :(
Error using fprintf
Operation is not implemented for requested file identifier.

Error in surface2volume (line 92)
tic; fprintf(outputFID,'Initializing ... ');

Doesn't work!

Error using fprintf
Operation is not implemented for requested file identifier.

Error in surface2volume (line 92)
tic; fprintf(outputFID,'Initializing ... ');

Lukas

Lukas (view profile)

I have a little problem:

Error using fprintf
Operation is not implemented for requested file identifier.

Error in surface2volume (line 92)
tic; fprintf(outputFID,'Initializing ... ');

XiaoGang

SHERRY

SHERRY (view profile)

good!

abdel amazoz

merci M. Daniel

Steve

Steve (view profile)

I would also like to know how to use it with data in (x,y,z) format. Can you please tell me?

Alex Kararg

Given only the x,y,z coordinates of a surface S how does this function work?

nor ki

nor ki (view profile)

nice tool,
but it confuses x with y coordinates in line 172

Sebastian H

Amazing! Fast and reliable. Many, many thanks.

A hint: I had to change the outputFID from 0 to 1, Matlab 7.6 R2008a seems not to accept zero file identifiers for fprintf.

Carlos Platero

I need 3D models

thevan S

Very good and help full

Hyok Jeong

very very good.

MATLAB Release
MATLAB 7.0.1 (R14SP1)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video