⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 slicetool.m

📁 基于matlab的反演程序,用于地球物理勘探中射线追踪及偏移成像程序.
💻 M
📖 第 1 页 / 共 5 页
字号:
		hslopetools=h(21); hzoom=actdat(3); hmessage=h(11);		toolid=get(hslopetools,'userdata');		if(toolid==1) %simple slope display			set(gcf,'windowbuttonmotionfcn','');			lineinfo=get(gca,'userdata');			if( length(lineinfo) < 4 )				set(hmessage,'string','invalid slope pick');			else				p1=lineinfo(1:2);				p2=lineinfo(3:4);				hpickslopes=actdat(5);				pinfo=get(hpickslopes,'userdata');				set(hzoom,'userdata',[pinfo(1),p1,p2]);				hmessage = h(11);				slope=(p2(2)-p1(2))/(p2(1)-p1(1));				mess=sprintf(' slope =%g ',slope);				set(hmessage,'string',[mess ' .... MB1: draw slope']);			end		elseif(toolid==2) % peters depth estimate			set(gcf,'windowbuttonmotionfcn','');			slicetool('petersdepth');		end	endreturn;end	% the identify sequenceif( strcmp(action,'identify') )		h=get(gcf,'userdata');	hdoit=h(1);	hmsg=h(11);		% determine the action state	haction = h(6);	actdat=get(haction,'userdata');	state=actdat(1);	%determine which mouse button was pressed	flag=get(gcf,'selectiontype');	if( strcmp(flag,'alt') )		% move an existing text label around		textmove('init');	elseif( strcmp(flag,'extend') )		hobj=gco;		if(strcmp(get(gco,'type'),'text'))			set(hmsg,'string','Type in new string in MATLAB window');			newstr=input('Type in new string: ','s');			if( ~isempty(newstr) )				set(gco,'string',newstr);			end			set(hmsg,'string','MB1: identify curve  MB2: change text  MB3: move text');		end	else		% get the current object's handle		hobj = get(gcf,'currentobject');				% see if it is one of the curves		hident=actdat(7);		% The basic idea here is that hident userdata 		% will provide the handles of the plotted curves and the handles		% of an optional text label naming the curve. If there are 2 subplots,		% then this is repeated in a second row.		% so if ndisp is the number of displayed curves,		% then the size of the user data is [1,2*ndisp+1]for 1 subplot and		% [2,2*ndisp+1] for 2 subplots.		idinfo=get(hident,'userdata');		curvenum=-999;				[l,m]=size(idinfo);		%% NOTE: This id mechanism does not work for a subdivided plot%		for k=2:m			if( hobj==idinfo(k) )				curvenum=k; % we found the curve				break;			end		end		if( strcmp(get(hobj,'type'),'text') )			hmsg=h(11);			set(hmsg,'string','Select curve not text object');			return;		end						%return if the curve was not found		if( curvenum== -999)			hmsg=h(11);			set(hmsg,'string','unable to identify curve');			return;		else			hmsg=h(11);			set(hmsg,'string','');		end				hxaxis=h(7);        hyaxis=h(8);        % get the number of x axis vectors        xinfo = get(hxaxis,'userdata');        xdisp=xinfo(3+xinfo(1):length(xinfo) );		nx=length(xdisp);        % get the number of y axis vectors        yinfo = get(hyaxis,'userdata');        ydisp=yinfo(3+yinfo(1):length(yinfo) );		ny=length(ydisp);				if( nx==1 )			numcurves=ny;			if( curvenum <= numcurves+1 )				curveid=ydisp(curvenum-1);			elseif( curvenum> 2*numcurves+1 & curvenum <= 3*numcurves+1)				curveid=ydisp(curvenum-2*numcurves-1);			end		else			numcurves=nx;			if( curvenum <= numcurves+1 )				curveid=xdisp(curvenum-1);			elseif( curvenum> 2*numcurves+1 & curvenum <= 3*numcurves+1)				curveid=xdisp(curvenum-2*numcurves-1);			end		end				% see if there is already a label to delete		if(idinfo(curvenum+numcurves)>0)			delete(idinfo(curvenum+numcurves));		end				% get the data information        hdoit=h(1);				% get the data object		obj=get(hdoit,'userdata');				% get the dataname				dataname=objget(obj,'dataname',curveid);				% get the current point		pt=get(gca,'currentpoint');		% get the color		kolor=get(hobj,'color');				% write the name on the screen				htext=text(pt(1,1),pt(1,2),dataname,'color',kolor);				% update the idinfo		idinfo(curvenum+numcurves)=htext;		set(hident,'userdata',idinfo);		set(hmsg,'string','MB1: identify curve  MB2: change text  MB3: move text');	end		return;	end% the identify sequenceif( strcmp(action,'autoident') )		h=get(gcf,'userdata');	hdoit=h(1);	hmsg=h(11);		% determine the action state	haction = h(6);	actdat=get(haction,'userdata');	state=actdat(1);	%determine which mouse button was pressed	flag=get(gcf,'selectiontype');	if( strcmp(flag,'alt') )		% move an existing text label around		textmove('init');	elseif( strcmp(flag,'extend') )		hobj=gco;		if(strcmp(get(gco,'type'),'text'))			set(hmsg,'string','Type in new string in MATLAB window');			newstr=input('Type in new string: ','s');			if( ~isempty(newstr) )				set(gco,'string',newstr);			end			set(hmsg,'string','MB1: identify curve  MB2: change text  MB3: move text');		end	else				% get the id info		hident=actdat(7);		% The basic idea here is that hident userdata 		% will provide the handles of the plotted curves and the handles		% of an optional text label naming the curve. If there are 2 subplots,		% then this is repeated in a second row.		% so if ndisp is the number of displayed curves,		% then the size of the user data is [1,2*ndisp+1]for 1 subplot and		% [2,2*ndisp+1] for 2 subplots.		idinfo=get(hident,'userdata');		curvenum=-999;				[l,m]=size(idinfo);				ncurves=(m-1)/2;		hcurves=idinfo(2:ncurves+1);		htexts=idinfo(ncurves+2:m);				hxaxis=h(7);        hyaxis=h(8);		% determin x(y) or y(x)        % get the number of x axis vectors        xinfo = get(hxaxis,'userdata');        xdisp=xinfo(3+xinfo(1):length(xinfo) );		nx=length(xdisp);        % get the number of y axis vectors        yinfo = get(hyaxis,'userdata');        ydisp=yinfo(3+yinfo(1):length(yinfo) );		ny=length(ydisp);				if( nx==1 )			numcurves=ny;			curveids=ydisp;		else			numcurves=nx;			curveids=xdisp;		end				% get the data information        hdoit=h(1);				% get the data object		obj=get(hdoit,'userdata');				% get the datanames				names=objget(obj,'namesmatrix');				%loop over the curves		for k=1:ncurves			% see if there is already a label to delete			if(htexts(k)>0)				delete(htexts(k));				htexts(k)=0;			end					% put the label at the last point on the curve			x=get(hcurves(k),'xdata');			y=get(hcurves(k),'ydata');			ilive=find(~isnan(x));			ilive2=find(~isnan(y(ilive)));			ilive=ilive(ilive2);			x=x(ilive);			y=y(ilive);			xpt=x(length(x));			ypt=y(length(y));			% get the color			kolor=get(hcurves(k),'color');						%get the name			dataname=names(curveids(k),:);			ind=find(abs(dataname)==1);			if( ~isempty(ind) )				dataname=dataname(1:ind(1)-1);			end					% write the name on the screen			htexts(k)=text(xpt,ypt,dataname,'color',kolor);		end			% update the idinfo	idinfo=[idinfo(1) hcurves htexts];	set(hident,'userdata',idinfo);	end		return;	end% a zoomif(strcmp(action,'zoom'))	h=get(gcf,'userdata');	hoptions=h(2);	fcn1=get(gcf,'windowbuttondownfcn');	fcn2=get(gcf,'windowbuttonmotionfcn');	fcn3=get(gcf,'windowbuttonupfcn');	set(hoptions,'userdata',[abs(fcn1) nan abs(fcn2) nan abs(fcn3) ]);	% initial the selectionbox	selboxinit('slicetool(''zoom2'')');    % disable the doit button    set(h(1),'enable','off');    return;endif(strcmp(action,'zoom2'))	h=get(gcf,'userdata');	hdoit=h(1);	hoptions=h(2);	hup=h(29);	hdown=h(30);	hleft=h(31);	hright=h(32);		% get the action data	haction = h(6);	actdat=get(haction,'userdata');		fcndat=get(hoptions,'userdata');	ind=find(isnan(fcndat));	set(gcf,'windowbuttondownfcn',setstr(fcndat(1:ind(1)-1)));	set(gcf,'windowbuttonmotionfcn',setstr(fcndat(ind(1)+1:ind(2)-1)));	set(gcf,'windowbuttonupfcn',setstr(fcndat(ind(2)+1:length(fcndat))));	box=selboxfini;	xmin = min(box(1), box(3));	xmax = max(box(1), box(3));	ymin = min(box(2), box(4));	ymax = max(box(2), box(4));	hzoom=actdat(3);	zinfo=get(hzoom,'userdata');	set(hzoom,'userdata',[zinfo(1),xmin,xmax,ymin,ymax]);	set(hdoit,'enable','on');	if(length(box)==5) delete(box(5)); end	set(gca,'xlim',[xmin xmax],'ylim',[ymin ymax]);		set(hup,'visible','on');	set(hdown,'visible','on');	set(hleft,'visible','on');	set(hright,'visible','on');	return;end% an unzoomif(strcmp(action,'unzoom') )	h=get(gcf,'userdata');	hup=h(29);	hdown=h(30);	hleft=h(31);	hright=h(32);		haction = h(6);	actdat=get(haction,'userdata');	hzoom=actdat(3);	zinfo=get(hzoom,'userdata');	set(hzoom,'userdata',[zinfo(1)]);		axis('auto');	set(hup,'visible','off');	set(hdown,'visible','off');	set(hleft,'visible','off');	set(hright,'visible','off');		return;end% do a transformif( strcmp(action,'transform') )	h=get(gcf,'userdata');        hxaxis=h(7);        hyaxis=h(8);        hmode=h(10);		hmsg=h(11);        htranstore=h(12);        hcmplxstore=h(13);                % get the transform options        info=get(hmode,'userdata');        htransoptions = info(4);        transoptions=get(htransoptions,'userdata');                flag=get(transoptions(1),'checked');        zeromean=0;        if( strcmp(flag,'on') ) zeromean=1; end        flag=get(transoptions(2),'checked');        zeropad=0;        if( strcmp(flag,'on') ) zeropad=1; end        flag=get(transoptions(3),'checked');        doburg=0;        if( strcmp(flag,'on') )        	 doburg=1;        	 burgorder=get(transoptions(4),'userdata');        	 burgorder=burgorder(1);       	end        % get the number of x axis vectors        xinfo = get(hxaxis,'userdata');        xdisp=xinfo(3+xinfo(1):length(xinfo) );	nx=length(xdisp);        % get the number of y axis vectors        yinfo = get(hyaxis,'userdata');        ydisp=yinfo(3+yinfo(1):length(yinfo) );	ny=length(ydisp);	dat=get(htranstore,'userdata');	% determine the transform coordinates. Note that if both nx and ny are 1	% then the transform of y(x) is done and not the transform of x(y)	% This might be a problem for people who plot things sideways	if( nx==1 )		t=dat(:,nx);		s=dat(:,nx+1:nx+ny);	elseif( ny == 1 & nx~= 1)		s=dat(:,1:nx);		t=dat(:,nx+1:nx+ny);	else		error(' improper transform 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -