资源简介
超声波;模拟仿真;Field Ⅱ;matlab程序,源代码,需要使用matlab做声场仿真的可以使用这个,虽然官方网站上有,但是需要使用matlab做声场仿真的可以使用这个,虽然官方网站上有,但是geziqi又针对64位机器生成了做相控阵需要的fast_int.mexw64文件,原网站上只有32位的mex文件,没有64位的。我也是弄了好久生成的。谢谢geziqi的分享!
代码片段和文件信息
function [Xmapout3]=bmpread(filename);
%BMPREAD Read a BMP (Microsoft Windows Bitmap) file from disk.
% [XMAP]=BMPREAD(‘filename‘) reads the file ‘filename‘ and
% returns the indexed image X and associated colormap
% MAP. If no extension is given for the filename the
% extension ‘.bmp‘ is assumed.
% [RGB]=BMPREAD(‘filename‘) reads the 24-bit BMP file
% from the file ‘filename‘.
% BPP=BMPREAD(‘filename‘) returns the number of bits per
% pixel in the BMP file.
%
% BMPREAD does not read 1-bit or compressed BMP files.
%
% See also: BMPWRITE GIFREAD HDFREAD PCXREAD TIFFREAD
% XWDREAD.
% Mounil Patel 3/10/94
% Revised Steve Eddins February 9 1995
% Copyright (c) 1994 by The MathWorks Inc.
% $Revision: 1.13 $ $Date: 1995/02/09 15:17:43 $
if (nargin~=1)
error(‘Requires a filename as an argument.‘);
end;
if (isstr(filename)~=1)
error(‘Requires a string filename as an argument.‘);
end;
if (isempty(findstr(filename‘.‘))==1)
filename=[filename‘.bmp‘];
end;
fid=fopen(filename‘rb‘‘l‘);
if (fid==-1)
error([‘Error opening ‘filename‘ for input.‘]);
end;
bfType=fread(fid2‘uchar‘);
if (bfType~=[66;77])
fclose(fid);
error(‘Not a BMP file.‘);
end;
bfSize=fread(fid1‘uint‘);
bfReserved1=fread(fid1‘ushort‘);
bfReserved2=fread(fid1‘ushort‘);
bfOffBytes=fread(fid1‘uint‘);
biSize=fread(fid1‘uint‘);
if (biSize~=40)
fclose(fid);
error(‘Not a MS Windows Device Independent Bitmap BMP file.‘);
end;
biWidth=fread(fid1‘uint‘);
biHeight=fread(fid1‘uint‘);
biPlanes=fread(fid1‘ushort‘);
biBitCount=fread(fid1‘ushort‘);
if (biBitCount == 1)
error(‘BMPREAD does not read 1-bit BMP files.‘);
end
biCompression=fread(fid1‘uint‘);
if biCompression~=0 then
error(‘Can‘‘t load compressed format bitmaps.‘);
end;
biSizeImage=fread(fid1‘uint‘);
biXPels=fread(fid1‘uint‘);
biYPels=fread(fid1‘uint‘);
biClrUsed=fread(fid1‘uint‘);
biClrImportant=fread(fid1‘uint‘);
if (nargout <= 1)
X = biBitCount;
map = [];
fclose(fid);
return;
end
if ((nargout == 2) & (biBitCount == 24))
error(‘Three output arguments required for 24-bit BMP file.‘);
end
if ((nargout == 3) & (biBitCount < 24))
error(‘Only two arguments needed for 4- and 8-bit BMP files.‘);
end
if (biBitCount == 24)
if (rem(biWidth4)~=0)
XSize=biWidth+(4-rem(biWidth4));
else
XSize=biWidth;
end
YSize=biHeight;
Size=XSize*YSize;
fseek(fid bfOffBytes ‘bof‘);
X=fread(fidSize*3‘uchar‘);
out3 = rot90(reshape(X(1:3:length(X)) XSize YSize)) * (1/255);
map = rot90(reshape(X(2:3:length(X)) XSize YSize)) * (1/255);
X = rot90(reshape(X(3:3:length(X)) XSize YSize)) * (1/255);
if (rem(biWidth4)~=0)
X=X(:1:biWidth);
map = map(:1:biWidth);
out3 = out3(:1:biWidth);
end;
fclose(fid);
return;
end
if (biClrUsed==0)
nColors=2.^biBitCount;
else
nColors=biClrUsed;
end;
% load color map now
if (biClrUsed>256)
map=[]; % 24-bit images have no colormap
else
map=fread(fid4*nColors‘uchar‘);
map=reshape(map
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-09-12 15:01 Field_II_PC7\
文件 3981 1999-04-16 17:41 Field_II_PC7\bmpread.m
文件 792 1997-05-21 11:53 Field_II_PC7\calc_h.m
文件 846 1997-05-21 11:53 Field_II_PC7\calc_hhp.m
文件 764 1998-03-19 13:22 Field_II_PC7\calc_hp.m
文件 1197 1997-05-21 11:53 Field_II_PC7\calc_scat.m
文件 2504 2001-08-17 17:07 Field_II_PC7\calc_scat_all.m
文件 1386 1999-05-21 17:08 Field_II_PC7\calc_scat_multi.m
文件 1152 1998-07-01 08:22 Field_II_PC7\ele_apodization.m
文件 1137 1998-07-01 08:22 Field_II_PC7\ele_delay.m
文件 1143 1998-07-01 08:22 Field_II_PC7\ele_waveform.m
文件 15700 2012-09-06 20:43 Field_II_PC7\fast_int.c
文件 31232 2012-04-17 13:06 Field_II_PC7\fast_int.dll
文件 9826 2002-04-17 21:20 Field_II_PC7\fast_int.mexglx
文件 10332 2012-04-17 13:06 Field_II_PC7\fast_int.mexlx
文件 9284 2012-04-17 13:06 Field_II_PC7\fast_int.mexmac
文件 9308 2012-04-17 13:06 Field_II_PC7\fast_int.mexsol
文件 20480 2012-04-17 13:06 Field_II_PC7\fast_int.mexw32
文件 10240 2012-09-12 09:58 Field_II_PC7\fast_int.mexw64
文件 417 1997-05-21 11:53 Field_II_PC7\field_debug.m
文件 295 1997-05-21 11:53 Field_II_PC7\field_end.m
文件 883 2011-05-06 16:34 Field_II_PC7\field_guide.m
文件 826 1999-01-21 10:08 Field_II_PC7\field_init.m
文件 393 2007-08-10 15:17 Field_II_PC7\field_logo.m
文件 3603 2007-08-13 18:05 Field_II_PC7\fnumna.m
文件 3596 2007-08-13 18:06 Field_II_PC7\fnumwa.m
文件 1700 2000-04-07 19:59 Field_II_PC7\human_kidney_phantom.m
文件 246782 2000-03-30 16:24 Field_II_PC7\kidney_cut.bmp
文件 285392 2001-08-21 13:44 Field_II_PC7\logo_field.mat
文件 589 2001-07-03 20:44 Field_II_PC7\make_interpolation.m
文件 2314 2012-09-10 21:04 Field_II_PC7\make_polar.asv
............此处省略50个文件信息
评论
共有 条评论