📄 segymat.m
字号:
zoom(data.zoomfac) UpdateTopPlot(hObject, eventdata, handles) UpdateBotPlot(hObject, eventdata, handles)endif find(double(Key)==zoom_out_keys); zoom(-data.zoomfac) UpdateTopPlot(hObject, eventdata, handles) UpdateBotPlot(hObject, eventdata, handles)end%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MOVEif isfield(data,'movefac')==0 % Movefac=1; move in stepos of size of window % Movefac=0.5; move in steps of half-size of window data.movefac=.02; guidata(hObject,data);end if (double(Key)>=49)&(double(Key)<=117), % NUM PAD go_left_keys=[52,117]; % 2,j go_right_keys=[54,111]; % 2,j go_down_keys=[50,107]; % 2,j go_up_keys=[56]; % 2,j xlim=get(handles.axMain,'Xlim'); ylim=get(handles.axMain,'Ylim'); wx=(xlim(2)-xlim(1)).*data.movefac; wy=(ylim(2)-ylim(1)).*data.movefac; if (find(go_up_keys==double(Key))), set(handles.axMain,'Ylim',ylim-wy); end % 8 if (find(go_down_keys==double(Key))), set(handles.axMain,'Ylim',ylim+wy); end % 2 if (find(go_left_keys==double(Key))), set(handles.axMain,'Xlim',xlim-wx); end % 4 if (find(go_right_keys==double(Key))), set(handles.axMain,'Xlim',xlim+wx); end % 6 if (double(Key)==49), % 1 set(handles.axMain,'Ylim',ylim+wy); set(handles.axMain,'Xlim',xlim-wx); end % 1 if (double(Key)==51), % 3 set(handles.axMain,'Ylim',ylim+wy); set(handles.axMain,'Xlim',xlim+wx); end % 3 if (double(Key)==55), % 7 set(handles.axMain,'Ylim',ylim-wy); set(handles.axMain,'Xlim',xlim-wx); end % 7 if (double(Key)==57), % 9 set(handles.axMain,'Ylim',ylim-wy); set(handles.axMain,'Xlim',xlim+wx); end % 9 if (double(Key)==53), % 5 axes(handles.axMain) zoom out; end % 5 xlim_after=get(handles.axMain,'Xlim'); if (sum(xlim==xlim_after)<2) UpdateTopPlot(hObject, eventdata, handles) UpdateBotPlot(hObject, eventdata, handles) endend %% IO FUNCTIONS%% --------------------------------------------------------------------function mFileOpen_Callback(hObject, eventdata, handles)% hObject handle to mFileOpen (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)try segyfile=DIAOpenSEGY; fReadSegy_Callback(hObject, eventdata, handles,segyfile);catchend% --------------------------------------------------------------------function mOpenFileFast_Callback(hObject, eventdata, handles)% hObject handle to mOpenFileFast (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)try [segyfile.filename,segyfile.pathname]=uigetfile( ... {'*.segy;*.SEGY;*.SEGY;*.sgy','All Segy files'; ... '*.su;*.SU;*.sU;*.Su','All SU files'; ... '*','All Files'},... 'Pick A SEGY file'); fReadSegy_Callback(hObject, eventdata, handles,segyfile);catchend% --------------------------------------------------------------------function fReadSegy_Callback(hObject, eventdata, handles,segyfile);data=guidata(hObject);try% keyboard [dpath,dfile,dsuffix]=fileparts(segyfile.filename); if (strcmp(lower(dsuffix),'.su')) [data.SegyData,data.SegyTraceHeaders,data.SegyHeader]=ReadSu(fullfile(segyfile.pathname,segyfile.filename)); else [data.SegyData,data.SegyTraceHeaders,data.SegyHeader]=ReadSegy(fullfile(segyfile.pathname,segyfile.filename)); end set(handles.fMain,'name',['SegyMAT : ',segyfile.filename]) data.SegyFile=segyfile; data.SegyTime=[1:1:data.SegyHeader.ns].*data.SegyHeader.dt/1e+6; data.SegyTrace=[1:length(data.SegyTraceHeaders)]; data.PlotPref.Show=1; data.PlotPref.caxis=[min(data.SegyData(:)) max(data.SegyData(:))]; guidata(hObject,data); fMain_ResizeFcn(hObject, eventdata, handles); UpdatePrefs(hObject, eventdata, handles); UpdatePlots(hObject, eventdata, handles);catch errordlg('An error occured while reading the SEGY file','Error reading SGY file','modal')end UpdateMenus(hObject, eventdata, handles);% --------------------------------------------------------------------function mFileSave_Callback(hObject, eventdata, handles)% hObject handle to mFileSave (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)try data=guidata(hObject); file=fullfile(data.SegyFile.pathname,data.SegyFile.filename); ButtonName=questdlg(['Are you sure you want to override :',file], ... 'Warning !!!', ... 'Yes','No','No'); if strcmp(ButtonName,'Yes') [dpath,dfile,dsuffix]=fileparts(file); if (strcmp(lower(dsuffix),'.su')) WriteSuStructure(file,data.SegyHeader,data.SegyTraceHeaders,data.SegyData); else WriteSegyStructure(file,data.SegyHeader,data.SegyTraceHeaders,data.SegyData); end endcatch errordlg('An error occured while writing SEGY file','Error writing SGY file','modal')end% --------------------------------------------------------------------function mFileSaveAs_Callback(hObject, eventdata, handles)% hObject handle to mFileSaveAs (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)try data=guidata(hObject); [segyfile.filename,segyfile.pathname]=uiputfile( ... {'*.segy;*.SEGY;*.SEGY;*.sgy','All Segy files'; ... '*.su;*.SU;*.sU;*.Su','All SU files'; ... '*','All Files'},... 'Save as '); file=fullfile(segyfile.pathname,segyfile.filename); [dpath,dfile,dsuffix]=fileparts(file); if (strcmp(lower(dsuffix),'.su')) WriteSuStructure(file,data.SegyHeader,data.SegyTraceHeaders,data.SegyData); else WriteSegyStructure(file,data.SegyHeader,data.SegyTraceHeaders,data.SegyData); endcatch errordlg('An error occured while writing SEGY file','Error writing SGY file','modal')end% --------------------------------------------------------------------function mHelp_Callback(hObject, eventdata, handles)% hObject handle to mHelp (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function mHelpHelp_Callback(hObject, eventdata, handles)% hObject handle to mHelpHelp (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)SegymatHelp('index')% --------------------------------------------------------------------function mHelpAbout_Callback(hObject, eventdata, handles)% hObject handle to mHelpAbout (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)segymat_about;% --- Executes on button press in pbGainUp.function pbGainUp_Callback(hObject, eventdata, handles)% hObject handle to pbGainUp (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) data=guidata(hObject); data.PlotPref.caxis=data.PlotPref.caxis./(1.2); guidata(hObject,data); UpdateGain(hObject, eventdata, handles) ; Style=get(handles.popStyle,'Value'); % GET PLOTTING STYLE if ((Style==2)|(Style==4|(Style==3)|(Style==5))) UpdateMainPlot(hObject, eventdata, handles) end % --- Executes on button press in pbGainDown.function pbGainDown_Callback(hObject, eventdata, handles)% hObject handle to pbGainDown (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) data=guidata(hObject); data.PlotPref.caxis=data.PlotPref.caxis.*(1.2); guidata(hObject,data); UpdateGain(hObject, eventdata, handles) ; Style=get(handles.popStyle,'Value'); % GET PLOTTING STYLE if ((Style==2)|(Style==4|(Style==3)|(Style==5))) UpdateMainPlot(hObject, eventdata, handles) end% --- Executes during object creation, after setting all properties.function eGainMin_CreateFcn(hObject, eventdata, handles)% hObject handle to eGainMin (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction eGainMin_Callback(hObject, eventdata, handles)% hObject handle to eGainMin (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of eGainMin as text% str2double(get(hObject,'String')) returns contents of eGainMin as a doubledata=guidata(hObject);data.PlotPref.caxis(1)=str2double(get(hObject,'String'));guidata(hObject,data);UpdateGain(hObject, eventdata, handles);% --- Executes during object creation, after setting all properties.function eGainMax_CreateFcn(hObject, eventdata, handles)% hObject handle to eGainMax (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction eGainMax_Callback(hObject, eventdata, handles)% hObject handle to eGainMax (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of eGainMax as text% str2double(get(hObject,'String')) returns contents of eGainMax as a doubledata=guidata(hObject);data.PlotPref.caxis(2)=str2double(get(hObject,'String'));guidata(hObject,data);UpdateGain(hObject, eventdata, handles);% --- Executes during object creation, after setting all properties.function popTop_CreateFcn(hObject, eventdata, handles)% hObject handle to popTop (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: popupmenu controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on selection change in popTop.function popTop_Callback(hObject, eventdata, handles)% hObject handle to popTop (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns popTop contents as cell array% contents{get(hObject,'Value')} returns selected item from popTop SegymatVerbose(['GUI : Update popTOP'],20) UpdateTopPlot(hObject, eventdata, handles)% --- Executes during object creation, after setting all properties.function popBot_CreateFcn(hObject, eventdata, handles)% hObject handle to popBot (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: popupmenu controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on selection change in popBot.function popBot_Callback(hObject, eventdata, handles)% hObject handle to popBot (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns popBot contents as cell array% contents{get(hObject,'Value')} returns selected item from popBot SegymatVerbose(['GUI : Update popBOT'],20) UpdateBotPlot(hObject, eventdata, handles)% --- Executes during object creation, after setting all properties.function popColormap_CreateFcn(hObject, eventdata, handles)% hObject handle to popColormap (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: popupmenu controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on selection change in popColormap.function popColormap_Callback(hObject, eventdata, handles)% hObject handle to popColormap (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns popColormap contents as cell array% contents{get(hObject,'Value')} returns selected item from popColormap SegymatVerbose(['GUI : Update popColormap'],20) data=guidata(hObject); cmap=get(hObject,'String'); icmap=get(hObject,'value'); axes(handles.axMain); colormap(cmap{icmap}); %%% zoom on; % --- Executes during object creation, after setting all properties.function popStyle_CreateFcn(hObject, eventdata, handles)% hObject handle to popStyle (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: popupmenu controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on selection change in popStyle.function popStyle_Callback(hObject, eventdata, handles)% hObject handle to popStyle (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns popStyle contents as cell array% contents{get(hObject,'Value')} returns selected item from popStyle SegymatVerbose(['GUI : popStyle'],20) UpdateMainPlot(hObject, eventdata, handles); UpdateTopPlot(hObject, eventdata, handles) UpdateBotPlot(hObject, eventdata, handles)%% MENUS%% --------------------------------------------------------------------function UpdateMenus(hObject, eventdata, handles) SegymatVerbose(['GUI : Update Menus'],20) data=guidata(hObject); if isfield(data,'SegyData')==0 set(handles.mEdit,'Visible','Off') else set(handles.mEdit,'Visible','On') end % --------------------------------------------------------------------function mFile_Callback(hObject, eventdata, handles)% hObject handle to mFile (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function mEdit_Callback(hObject, eventdata, handles)% hObject handle to mEdit (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function mEditSH_Callback(hObject, eventdata, handles)% hObject handle to mEditSH (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)data=guidata(hObject);try data.SegyHeader=GUIEditSegyHeader(data.SegyHeader); guidata(hObject,data)catchend% --------------------------------------------------------------------function mEditSTH_Callback(hObject, eventdata, handles)% hObject handle to mEditSTH (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)data=guidata(hObject);try data.SegyTraceHeaders=GUIEditSegyTraceHeader(data.SegyTraceHeaders); guidata(hObject,data) UpdateTopPlot(hObject, eventdata, handles) UpdateBotPlot(hObject, eventdata, handles)catch SegymatVerbose('Something Went wrong calling GUISegyMat')end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -