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

📄 segymat.m

📁 这是用matlab对segy数据进行处理
💻 M
📖 第 1 页 / 共 3 页
字号:
function varargout = segymat(varargin)
% segymat : Garphical User Interface for SegyMAT
%
%   (C) 2001-2004 Thomas Mejer Hansen, tmh@gfy.ku.dk/thomas@cultpenguin.com
%
 

% SEGYMAT M-file for segymat.fig
%      SEGYMAT, by itself, creates a new SEGYMAT or raises the existing
%      singleton*.
%
%      H = SEGYMAT returns the handle to a new SEGYMAT or the handle to
%      the existing singleton*.
%
%      SEGYMAT('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in SEGYMAT.M with the given input arguments.
%
%      SEGYMAT('Property','Value',...) creates a new SEGYMAT or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before segymat_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to segymat_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

  
% Edit the above text to modify the response to help segymat

% Last Modified by GUIDE v2.5 05-Jan-2009 17:29:20

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @segymat_OpeningFcn, ...
                   'gui_OutputFcn',  @segymat_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);

% Next line is edited               
% ORIGINAL : if nargin & isstr(varargin{1})
if nargin>1 & isstr(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end

if nargin==1 & isstr(varargin{1})
    [path,file,suffix]=fileparts(varargin{1});
    segyfile.pathname=path;
    if length(suffix)>1,
        segyfile.filename=[file,'.',suffix];
    else    
        segyfile.filename=file;
    end
    % FIGURE OUT HOW TO GET THE hObject ??
    % fReadSegy_Callback(hObject, eventdata, handles,segyfile);
end

% End initialization code - DO NOT EDIT


% --- Executes just before segymat is made visible.
function segymat_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to segymat (see VARARGIN)

  SegymatVerbose(['GUI : OPENING GUI'],20)
% Choose default command line output for segymat
handles.output = hObject;

% Initialize PlotPref 
handles.PlotPref.Show=0;

% Update handles structure
guidata(hObject, handles);

% Resize Figure
fMain_ResizeFcn(hObject, eventdata, handles)

%  read in segy file
segyfile.pathname='c:\MaTLAB6p5\work\';
segyfile.filename='test.sgy';
%segyfile.filename='peaksh.segy';
%fReadSegy_Callback(hObject, eventdata, handles,segyfile);

% disable edit menu
UpdateMenus(hObject, eventdata, handles)

% UIWAIT makes segymat wait for user response (see UIRESUME)
% uiwait(handles.fMain);


% --- Outputs from this function are returned to the command line.
function varargout = segymat_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes when fMain window is resized.
function fMain_ResizeFcn(hObject, eventdata, handles)
% hObject    handle to fMain (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

  
if (isfield(handles,'fMain')==0)
    return
end

SegymatVerbose(['GUI : Resizing'],20)

data=guidata(hObject);

% Get Size of Main Window
[mainPos]=get(handles.fMain,'Position');

d=4; % Distance to edges
d_ax=.2; % distance between axes
if isfield(data,'PlotPref')==0,
    data.PlotPref.Show=1;
    guidata(hObject,data);
end    
if isfield(data.PlotPref,'Show')==0,
    data.PlotPref.Show=1;
    guidata(hObject,data);
end

% fHeader Location
if data.PlotPref.Show==0,
    fHeaderW=d;
    set(handles.fHeader,'Visible','Off');
    set(handles.text7,'Visible','Off'); 
    set(handles.txtGain,'Visible','Off'); 
    set(handles.pbGainUp,'Visible','Off'); 
    set(handles.pbGainDown,'Visible','Off'); 
    set(handles.eGainMin,'Visible','Off'); 
    set(handles.eGainMax,'Visible','Off'); 
    set(handles.popTop,'Visible','Off'); 
    set(handles.popBot,'Visible','Off'); 
    set(handles.txtTop,'Visible','Off'); 
    set(handles.txtBot,'Visible','Off'); 
    set(handles.txtColormap,'Visible','Off'); 
    set(handles.popColormap,'Visible','Off'); 
    set(handles.txtStyle,'Visible','Off'); 
    set(handles.popStyle,'Visible','Off'); 
else
    fHeaderW=30; % WIDTH OF INFO PAGE
    x0=d;y0=d;
    w=fHeaderW-d;
    h=mainPos(4)-2*d;
    x1=x0+w;
    y1=y0+h;
    
    Wuic=8; % WIDTH OF UICONTROL
    Huic=1.4; %    HEIGHT OF UICONTROL
    
    set(handles.fHeader,'Position',[x0 y0 w h])
    d_frame=1;
    x0=x0+d_frame;
    wframe=w-2*d_frame;
    % TXT HEADER
    ytop=mainPos(4)-d;
%    set(handles.text7,'Position',[d+d ytop fHeaderW-3*d 2]);
    set(handles.text7,'Position',[x0 ytop wframe 2]);

    % GAIN
    ytop=ytop-d_ax-Huic;
    set(handles.txtGain,'Position',[x0,ytop,wframe,Huic])
    ytop=ytop-d_ax-Huic;
    w_sign=4;
    set(handles.eGainMin,'Position',[x0,ytop,wframe-w_sign,Huic])
    set(handles.pbGainDown,'Position',[x0+wframe-w_sign,ytop,w_sign,Huic])
    ytop=ytop-d_ax-Huic;
    set(handles.eGainMax,'Position',[x0,ytop,Wuic*1.5,Huic])
    set(handles.pbGainUp,'Position',[x0+Wuic*1.5,ytop,Wuic/2,Huic])
    set(handles.eGainMax,'Position',[x0,ytop,wframe-w_sign,Huic])
    set(handles.pbGainUp,'Position',[x0+wframe-w_sign,ytop,w_sign,Huic])

    % TopSub
    ytop=ytop-2*d_ax-Huic;
    set(handles.txtTop,'Position',[x0,ytop,wframe,Huic])
    ytop=ytop-d_ax-Huic;
    set(handles.popTop,'Position',[x0,ytop,wframe,Huic])
    
    % BaseSub
    ytop=ytop-2*d_ax-Huic;
    set(handles.txtBot,'Position',[x0,ytop,wframe,Huic])
    ytop=ytop-d_ax-Huic;
    set(handles.popBot,'Position',[x0,ytop,wframe,Huic])

    % Style
    ytop=ytop-2*d_ax-Huic;
    set(handles.txtStyle,'Position',[x0,ytop,wframe,Huic])
    ytop=ytop-d_ax-Huic;
    set(handles.popStyle ,'Position',[x0,ytop,wframe,Huic])
    
    % Colormap
    ytop=ytop-2*d_ax-Huic;
    set(handles.txtColormap,'Position',[x0,ytop,wframe,Huic])
    ytop=ytop-d_ax-Huic;
    set(handles.popColormap ,'Position',[x0,ytop,wframe,Huic])
    
    %
    
    % MAKE ALL VISIBLE
    set(handles.fHeader,'Visible','On');
    set(handles.text7,'Visible','On');
    set(handles.txtGain,'Visible','On'); 
    set(handles.pbGainUp,'Visible','On'); 
    set(handles.pbGainDown,'Visible','On'); 
    set(handles.eGainMin,'Visible','On'); 
    set(handles.eGainMax,'Visible','On'); 
    set(handles.popTop,'Visible','On'); 
    set(handles.popBot,'Visible','On'); 
    set(handles.txtTop,'Visible','On'); 
    set(handles.txtBot,'Visible','On'); 
    set(handles.txtColormap,'Visible','On'); 
    set(handles.popColormap,'Visible','On'); 
    set(handles.txtStyle,'Visible','On'); 
    set(handles.popStyle,'Visible','On'); 
end

% AXIS
axLeft=fHeaderW+2*d;
Hsmallax=4;

% axBot
axBotX=axLeft;
axBotY=d;
axBotW=mainPos(3)-axLeft-2*d;
axBotH=Hsmallax;
axB=get(handles.axBot,'Position');
set(handles.axBot,'Position',[axBotX axBotY axBotW axBotH])

% axTop
axTopX=axLeft;
axTopY=mainPos(4)-Hsmallax-d;
axTopW=axBotW;
axTopH=Hsmallax;
axT=get(handles.axTop,'Position');
set(handles.axTop,'Position',[axTopX axTopY axTopW axTopH])

% axMain
axMainX=axLeft;
axMainY=axBotY+Hsmallax+d_ax;
axMainW=axBotW;
axMainH=mainPos(4)-axMainY-Hsmallax-d-d_ax;
set(handles.axMain,'Position',[axMainX axMainY axMainW axMainH])


% --------------------------------------------------------------------
function UpdatePrefs(hObject, eventdata, handles)
  SegymatVerbose(['GUI : UpdatePrefs'],20)
  data=guidata(hObject);

if isfield(data,'SegyData')==0,
    set(handles.eGainMin,'Enable','off');
    set(handles.eGainMin,'String','');
    set(handles.eGainMax,'Enable','off');
    set(handles.eGainMax,'String','');
   return
else
    set(handles.eGainMin,'Enable','on');
    set(handles.eGainMax,'Enable','on');
end

if isfield(data.PlotPref,'caxis')==0
    data.PlotPref.caxis=[min(data.SegyData(:)) max(data.SegyData(:))];
end 
set(handles.eGainMin,'String',data.PlotPref.caxis(1));
set(handles.eGainMax,'String',data.PlotPref.caxis(2));

if isfield(data.PlotPref,'TraceHeaders')==0,
    data.PlotPref.TraceHeaders=fieldnames(data.SegyTraceHeaders);
end 
if isfield(data.PlotPref,'TopPlot')==0, data.PlotPref.TopPlot=7; end
if isfield(data.PlotPref,'BotPlot')==0, data.PlotPref.BotPlot=13; end
set(handles.popTop,'String',data.PlotPref.TraceHeaders);
set(handles.popTop,'value',data.PlotPref.TopPlot);
set(handles.popTop,'Enable','On');
set(handles.popBot,'String',data.PlotPref.TraceHeaders);
set(handles.popBot,'value',data.PlotPref.BotPlot);
set(handles.popBot,'Enable','On');
guidata(hObject,data);

% --------------------------------------------------------------------
function UpdatePlots(hObject, eventdata, handles)
  SegymatVerbose(['GUI : Update Plots'],20)
  %data=guidata(hObject);

  UpdateMainPlot(hObject, eventdata, handles)
  
  UpdateTopPlot(hObject, eventdata, handles)
  UpdateBotPlot(hObject, eventdata, handles)
  
axes(handles.axMain);%%%zoom on;

% --------------------------------------------------------------------
function UpdateMainPlot(hObject, eventdata, handles)
  SegymatVerbose(['GUI : Update Main Plot'],20)
  data=guidata(hObject);
  Style=get(handles.popStyle,'Value'); % GET PLOTTING STYLE
  axes(handles.axMain);
  
  if ((Style==1)|(Style==4)|(Style==5))
    imagesc(data.SegyTrace,data.SegyTime,data.SegyData);   
    caxis(data.PlotPref.caxis)
    hold on
  end 

  gain=max(abs(data.PlotPref.caxis));
  if ((Style==2)|(Style==4))
    wiggle(data.SegyTrace,data.SegyTime,data.SegyData,'wiggle',gain);
  end

⌨️ 快捷键说明

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