load_image.m
来自「matlab处理图像的一些基本方法。其中有一部分mex程序需要安装编译」· M 代码 · 共 88 行
M
88 行
function load_image(filename, type)%LOAD_IMAGE Load an image file with a specified format%% Copyright (c) 1995 by Claudio Rivetti and Mark Young% claudio@alice.uoregon.edu, mark@alice.uoregon.edu%global I H Fname FullFname readpathif nargin==1 type=getparameter(H, 'File Type'); if type == inf type='NANO3'; endendif isempty(filename) if strcmp(upper(type), 'NANO3') | strcmp(upper(type), 'NANO2') ext='*'; elseif strcmp(upper(type), 'SPIDER') ext='*.DAT'; else ext=['*.' lower(type(1:3))]; end [name, path]=uigetfile([readpath ext]); if isempty(name) | name == 0 return; end Fname1= name; FullFname1 = [path name];else if isempty(find(filename=='/')) path=readpath; Fname1=filename; FullFname1=[path Fname1]; else FullFname1=filename; Fname1=FullFname1(1+max(find(FullFname1=='/')):length(FullFname1)); endendif ~closeimage return;endFname=Fname1;FullFname=FullFname1;f=watchon;statusbar(['Loading image from: ' FullFname]);if strcmp(upper(type), 'NANO3') [I,H, errmsg]=nano3read(FullFname);elseif strcmp(upper(type), 'NANO2') [I,H, errmsg]=nano2read(FullFname);elseif strcmp(upper(type), 'MATLAB') [I,H, errmsg]=readMATLAB(FullFname);elseif strcmp(upper(type), 'TIFF') [I,H, errmsg]=readTIFF(FullFname);elseif strcmp(upper(type), 'BMP') [I,H, errmsg]=readBMP(FullFname);elseif strcmp(upper(type), 'GIF') [I,H, errmsg]=readGIF(FullFname);elseif strcmp(upper(type), 'PCX') [I,H, errmsg]=readPCX(FullFname);elseif strcmp(upper(type), 'SPIDER') [I,H, errmsg]=readSPIDER(FullFname);endif isempty(errmsg) & ~isempty(I) createimgax; setimage(ind2height(H,I),[1 1], 0); imagetitle; imagenote; setalexmenu('on'); clearstatusbar; watchoff(f);else clearstatusbar; watchoff(f); alexerror([FullFname '|' errmsg]);endreturn
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?