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

📄 viewslice.m

📁 matlab下看地震切片的程序
💻 M
📖 第 1 页 / 共 2 页
字号:
    set(handles.StepSlider, 'SliderStep', [step/numOfHorizons 0.05], 'Value', currentSlice);
    % Display the base map
    load(horizonFileNameStr(currentSlice, :));
    cd(workdir);
    v1 = unique(horizon(:, 1));   % Obtain inline numbers
    nCol = length(v1);
    for ix = 1:nCol
        ind = find(horizon(:,1) == v1(ix));
        timemap( horizon(ind,2), v1(ix)) = horizon(ind, 3);
    end
    set(0, 'CurrentFigure', handles.figure1)
    figureData = timemap;
    yCor = [nys:nye];
    xCor = [nxs:nxe];
    cmap = colormap;
    mydispslice(timemap, [], [], xCor, yCor);
    colormap(cmap);
    xlabel('Inline');
    ylabel('Crossline');
    set(gca, 'TickDir', 'Out', 'XMinorTick', 'On', 'YMinorTick', 'On')
    set(gcf, 'UserData', figureData);
end
set(handles.EditSliceNum, 'String', num2str(currentSlice));

% --- Executes on selection change in ColorMapPopupmenu.
function ColorMapPopupmenu_Callback(hObject, eventdata, handles)
% hObject    handle to ColorMapPopupmenu (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 ColorMapPopupmenu contents as cell array
%        contents{get(hObject,'Value')} returns selected item from ColorMapPopupmenu
vv = get(hObject);
cmap = lower(vv.String{vv.Value});
switch cmap
    case {'gray', 'hsv', 'hot', 'pink','cool', 'bone', 'jet', 'copper',...
            'spring', 'summer', 'autumn', 'winter', 'flag', 'prism', ...
            'colorcube', 'flag', 'lines', 'white'}
        cmap = cmap;
    case 'seismic'
        load('seismic.cmap.mat');
        cmap = seismic;
    case 'rainbow 1'
        load('rainbow1.cmap.mat');
        cmap = rainbow1;
    case 'rainbow 5'
        load('rainbow5.cmap.mat');
        cmap = rainbow5;
    case 'reverse colormap'
        cmap = colormap;
        cmap = flipud(cmap);
    otherwise
        errordlg('Unrecognized colormap');
        return;
end
colormap(cmap);


% --- Executes during object creation, after setting all properties.
function ColorMapPopupmenu_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ColorMapPopupmenu (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end




% --------------------------------------------------------------------
function OpenMenu_Callback(hObject, eventdata, handles)

[filename, pathname] = uigetfile('*.dat');
fullFileName = fullfile(pathname, filename);
handles.filename = fullFileName;
guidata(hObject, handles);
% Construct parameter filename from the input data file
[pathstr, name] = fileparts(fullFileName);
parafile = fullfile(pathstr, [name 'para.mat']);
load(parafile)
handles.FilePara = FilePara;
guidata(hObject, handles);
set(handles.TimeSliceMenu, 'Enable', 'On');


% --- Executes during object creation, after setting all properties.
function axes1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to axes1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: place code in OpeningFcn to populate axes1



% --------------------------------------------------------------------
function HistMenu_Callback(hObject, eventdata, handles)
% hObject    handle to HistMenu (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global minHistV  maxHistV;
global figureData
if isfield(handles, 'FilePara')
    FilePara = handles.FilePara;
    nxs = FilePara.nxs;
    nxe = FilePara.nxe;
    nys = FilePara.nys;
    nye = FilePara.nye;
    if isfield(FilePara, 'xstep')
        xstep = FilePara.xstep;
    else
        xstep = 1;
    end
    if isfield(FilePara, 'xstep')
        ystep = FilePara.ystep;
    else
        ystep = 1;
    end
    nzts = FilePara.nzts;
    nzte = FilePara.nzte;
    nSampleInterval = FilePara.nSampleInterval;
else
    return;
end
threshTag = '';
thresh = [];
figureData = get(gcf, 'Userdata');
vv = myViewHistogram;
uiwait;
newFigureData = figureData;
if ~isempty(minHistV)
    newFigureData(newFigureData<minHistV) = minHistV;
end
if ~isempty(maxHistV)
    newFigureData(newFigureData>maxHistV) = maxHistV;
end
set(gcf, 'Userdata', newFigureData);
yCor = [nys:ystep:nye];
xCor = [nxs:xstep:nxe];
set(0, 'CurrentFigure', handles.figure1)
cmap = colormap;
mydispslice(newFigureData,threshTag,thresh,xCor, yCor)
colormap(cmap)
xlabel('Inline');
ylabel('Crossline');


% --------------------------------------------------------------------
function OpenWellMenu_Callback(hObject, eventdata, handles)
% hObject    handle to OpenWellMenu (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, 'FilePara')
    FilePara = handles.FilePara;
    nxs = FilePara.nxs;
    nxe = FilePara.nxe;
    nys = FilePara.nys;
    nye = FilePara.nye;
    xstep = FilePara.xstep;
    ystep = FilePara.ystep;
    nline = FilePara.nline;
    ncdp = FilePara.ncdp;
    nSampleInterval = FilePara.nSampleInterval;
else
    return;
end
[filename, pathname] = uigetfile('*.*');
fullFilename = fullfile(pathname, filename);
handles.wellfilename = fullFilename;
guidata(hObject, handles);
[wellname, x1,y1] = textread(fullFilename, '%s %f %f');
nwell = length(x1);
% Read 3-point coordinate of the SEGY file
P0.xcor = 0;
P0.ycor = 0;
P0.lineNum = 1;
P0.cdpNum = 1;
P1.xcor = 0;
P1.ycor = 80;
P1.lineNum = 1;
P1.cdpNum = 81;
P2.xcor = 118;
P2.ycor = 80;
P2.lineNum = 119;
P2.cdpNum = 81;
stepXcor = 1;
stepYcor = 1;

% Calculate azimuth of the work place
angle0 = atan((P1.ycor-P0.ycor)/max(P1.xcor-P0.xcor, eps))-pi/2;
%  Plot well on the slice/basemap according to x-y coordinate
set(0, 'CurrentFigure', handles.figure1)
hold on
textSpaceX = round(3e-2*nline);
textSpaceY = round(3e-2*ncdp);
for jj = 1:nwell
    % Calculate inline and crossline trace number of each well
    dx = x1(jj)-P0.xcor;
    dy = y1(jj)-P0.ycor;
    distA = sqrt(dx^2+dy^2);
    angle1 = atan(dy/dx)+angle0;
    dxx = distA*cos(angle1);
    dyy = distA*sin(angle1);
    inNum = round(dxx/stepXcor)+P0.lineNum;
    crossNum = round(dyy/stepYcor)+P0.cdpNum;
    n1(jj) = inNum;
    n2(jj) = crossNum;
    hwell(jj) = plot(n1(jj), n2(jj), '+');
    set(hwell(jj), 'color', 'black', 'LineWidth',1.5, 'MarkerSize', 8);
    hWellText(jj) = text(n1(jj)+textSpaceX, n2(jj)+textSpaceX, wellname{jj},'Color', 'black');
    set(hWellText(jj), 'FontName', 'Arial', 'FontSize', 10, 'FontWeight', 'Bold')
end
handles.well.wellNum = nwell;
hanldes.well.hwell = hwell;
handles.well.hWellText = hWellText;
guidata(hObject, handles)

function data = mydispslice2(nSliceNum, handles)
%  function data = mydispslice2(nSliceNum, handles)
%  Display the time slice of the given number in the 3D data cube
%  Re-compiled on 01-28-2007
%  Author: Yandong Li, RIPED
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
if isfield(handles, 'FilePara')
    FilePara = handles.FilePara;
    nxs = FilePara.nxs;
    nxe = FilePara.nxe;
    if isfield(FilePara, 'xstep')
        xstep = FilePara.xstep;
    else
        xstep = 1;
    end
    nys = FilePara.nys;
    nye = FilePara.nye;
    nzts = FilePara.nzts;
    nzte = FilePara.nzte;
    nline = FilePara.nline;
    ncdp = FilePara.ncdp;
    nsample = FilePara.nsample;
    nSampleInterval = FilePara.nSampleInterval;
    nByte = FilePara.nByte;
else
    return;
end
data = zeros(ncdp, nline);
fullFilename = handles.filename;
fi0 = fopen(fullFilename,'r', 'b');
if strcmp(lower(handles.SliceType), 'timeslice')
    nr = 0;
   fseek(fi0,nr,-1); 
   for ix = nxs:xstep:nxe
       temp = fread(fi0,[nsample,ncdp], 'float32');
        data(:, ix-nxs+1) =  temp(nSliceNum, :)';
   end
elseif strcmp(lower(handles.SliceType), 'horizon')
     
end

% Set up the display parameters
threshTag = 'none';
thresh = 0.1;
yCor = [nys:nye];
xCor = [nxs:nxe];
mydispslice(data,threshTag,thresh,xCor, yCor)
set(gca, 'XMinorTick', 'On', 'TickDir', 'Out', 'YMinorTick', 'On')
xlabel('Inline');
ylabel('Crossline');























% --- Executes during object creation, after setting all properties.
function LevelSlider_CreateFcn(hObject, eventdata, handles)
% hObject    handle to LevelSlider (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end

% --- Executes during object creation, after setting all properties.
function UprightSlider_CreateFcn(hObject, eventdata, handles)
% hObject    handle to UprightSlider (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end

% --- Executes on selection change in EditTimeSliceNumber.
function EditSliceNum_Callback(hObject, eventdata, handles)
% hObject    handle to EditTimeSliceNumber (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 EditTimeSliceNumber contents as cell array
%        contents{get(hObject,'Value')} returns selected item from EditTimeSliceNumber


% --- Executes during object creation, after setting all properties.
function EditSliceNum_CreateFcn(hObject, eventdata, handles)
% hObject    handle to EditTimeSliceNumber (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: listbox controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end




% --- Executes during object creation, after setting all properties.
function StepSlider_CreateFcn(hObject, eventdata, handles)
% hObject    handle to StepSlider (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end



function EditStep_Callback(hObject, eventdata, handles)
% hObject    handle to EditStep (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 EditStep as text
%        str2double(get(hObject,'String')) returns contents of EditStep as a double


% --- Executes during object creation, after setting all properties.
function EditStep_CreateFcn(hObject, eventdata, handles)
% hObject    handle to EditStep (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end





⌨️ 快捷键说明

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