|
fd = mopen(filename,'rb');
bmpftype = mget(1,'usl',fd); //Bmp fileheader Type should be 0x424d
bmpfsize = mget(1,'ll',fd); // Bmp size information
bmpfres = mget(2,'usl',fd); // Reserved information
bmpfoff = mget(1,'ll',fd); // Off bits
bmpisize = mget(1,'ull',fd); // Bmp information header size
bmpwidth = mget(1,'ll',fd); // bmp width
bmpheight = mget(1,'ll',fd); // bmp height
bmpiplane = mget(1,'usl',fd); // Bmp palette information
bmpibits = mget(1,'usl',fd); // bmp bits of perx piexl
bmpicompress = mget(1,'ull',fd); //bmp compress information
bmpisizeimage = mget(1,'ull',fd); //Bmp image size information
bmpixy = mget(2,'ll',fd); // X Y pers meter
bmpicolors = mget(2,'ull',fd); // Color used and zoom
if bmpibits == 8
rgbs = [];
for i = 1:256
row = [];
row = mget(4,'cl',fd);
rgbs = [rgbs;row];
end
end
printf("=========================================/n");
printf("=============Bmp Basic Information=======/n");
printf("*******************************************/n");
printf("BMP file size ==> "+string(bmpfsize)+"/n");
printf("BMP fileoffsize=> "+string(bmpfoff)+"/n");
printf(" BMP Width ==> "+string(bmpwidth)+"/n");
printf(" BMP Height ==> "+string(bmpheight)+"/n");
printf("BMP bits/pixel==> "+string(bmpibits)+"/n");
printf("BMP imagesize ==> "+string(bmpisizeimage)+"/n");
printf("BMP color used => "+string(bmpicolors(1))+"/n");
mclose(fd);
if bmpibits == 8
slicesize = bmpwidth * bmpheight;
printf("Num of pixels =>%d/n",slicesize);
D =[];
D = getdata(filename,bmpfoff,bmpwidth,bmpheight);
//Data = mgeti(slicesize,'ucl',fd);
drawgrayl(D,bmpwidth,bmpheight);
printf("Scan %d pixel data/n",slicesize);
end
endfunction
利用线元绘制三维模型
function volrender1()
clear
xbasc()
//3d reconstruction with the edge table test
printf("Rendering with the 4-elements array sets/n");
printf("==========================================/n");
title = "Enter the dictionary stored with volume data and the number of the files";
Labels = ["Scidat Dir: "; ...
"Num of file:"]
vector = x_mdialog(title,Labels,['';'1']);
num = eval(vector(2));
filename = vector(1);//input("Enter the Dictionary hold the 4-elements array sets:/n");//filename = 'c://edge';
//disp(string(num));
//disp(filename);
for i=1:num
u = file('open',filename+'/'+string(i)+'.dat','old');
//disp(filename+string(i)+'.dat');
table =read(u,-1,4);
[n m] =size(table);
x1=table(:,1);
x2=table(:,2);
x3=table(:,3);
a=ones(x3);
b = (a+i)/2;
plot3d3(x1,x2,x3+b);
file('close',u); //close(u);
end
endfunction
基于线元结构的面绘制效果
基于三角片的面绘制
for i=1:zstep:num-zstep
df1 = df + '/'+string(i)+'.dat';
| |