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

📄 mri.m

📁 采用网格化GRIDDING算法对螺旋轨迹采集的MRI原始数据进行图像重建。
💻 M
📖 第 1 页 / 共 2 页
字号:

function varargout = MRI(varargin)
% MRI M-file for MRI.fig
%      MRI, by itself, creates a new MRI or raises the existing
%      singleton*.
%
%      H = MRI returns the handle to a new MRI or the handle to
%      the existing singleton*.
%
%      MRI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in MRI.M with the given input arguments.
%
%      MRI('Property','Value',...) creates a new MRI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before MRI_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to MRI_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 MRI

% Last Modified by GUIDE v2.5 05-Jun-2004 15:19:38
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @MRI_OpeningFcn, ...
                   'gui_OutputFcn',  @MRI_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin & 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
% End initialization code - DO NOT EDIT


% --- Executes just before MRI is made visible.
function MRI_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 MRI (see VARARGIN)
global Data_Driven DirectFT Grid_Driven Large_Matrix_2048 Large_Matrix_4096 dcf;
dcf=0;
load MRImages.mat;

% Choose default command line output for MRI
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes MRI wait for user response (see UIRESUME)
% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = MRI_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;
msgbox('Welcome to the MRI reconstruction program!');% --- Executes on button press in display_spiral.function display_spiral_Callback(hObject, eventdata, handles)% hObject    handle to display_spiral (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global fid;
if ~isnumeric(fid);
     plot(fid.kx,fid.ky,'k');
else
    msgbox('Please import the MR raw data!','Nothing to show','warn');
end
 % --- Executes during object creation, after setting all properties.function choose_DCF_CreateFcn(hObject, eventdata, handles)% hObject    handle to choose_DCF (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 choose_DCF.function choose_DCF_Callback(hbject, eventdata, handles)% hObject    handle to choose_DCF (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global dcf_jackson dcf_meyer dcf_pipe dcf_qian dcf;
val=get(hbject,'Value');
str=get(hbject,'String');
switch str{val}
    case 'Jackson DCF'
        dcf=dcf_jackson;
    case 'Pipe DCF'
        dcf=dcf_pipe;
    case 'Qian DCF'
        dcf=dcf_qian;
end% Hints: contents = get(hObject,'String') returns choose_DCF contents as cell array%        contents{get(hObject,'Value')} returns selected item from choose_DCF% --- Executes during object creation, after setting all properties.function choose_method_CreateFcn(hObject, eventdata, handles)% hObject    handle to choose_method (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 choose_method.function choose_method_Callback(hbject, eventdata, handles)% hObject    handle to choose_method (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global method;
val=get(hbject,'Value');
str=get(hbject,'String');
switch str{val}
    case 'Larger Matrix Gridding'
        method=0;
    case 'Larger Matrix Weighted Gridding'
        method=1;
    case 'Data Driven 2N Gridding'
        method=2;
    case 'Grid Driven 2N Gridding'
        method=3;
    case 'Direct Fourier Transform'
        method=4;
end
% Hints: contents = get(hObject,'String') returns choose_method contents as cell array%        contents{get(hObject,'Value')} returns selected item from choose_method% --- Executes on button press in reconstruction_process.function reconstruction_process_Callback(hObject, eventdata, handles)% hObject    handle to reconstruction_process (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global method dcf fid fov;
if isnumeric(fid);
    msgbox('Please import the MR raw data!','Nothing to show','warn');
    return
end
if dcf==0;
    msgbox('Please import the density compensation function!','Not ready to take action','warn');
    return
end  
prompt = {'Please input a FOV value (cm):'};
def = {'25'};
answer = inputdlg(prompt,'Input basic parameter',1,def);
fov = str2double(cell2mat(answer));
switch method
    case 0
        large_matrix_fast;
    case 1
        large_matrix;
    case 2
        jackson_data;
    case 3
        jackson_grid;
    case 4
        direct;
end% --------------------------------------------------------------------function display_mri_Callback(hObject, eventdata, handles)% hObject    handle to display_mri (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function DirectFT_Callback(hObject, eventdata, handles)% hObject    handle to DirectFT (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global DirectFT;
imshow(DirectFT);% --------------------------------------------------------------------function Data_Driven_Callback(hObject, eventdata, handles)% hObject    handle to Data_Driven (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global Data_Driven;
imshow(Data_Driven);% --------------------------------------------------------------------function Grid_Driven_Callback(hObject, eventdata, handles)% hObject    handle to Grid_Driven (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global Grid_Driven;
imshow(Grid_Driven);% --------------------------------------------------------------------function Large_Matrix_2048_Callback(hObject, eventdata, handles)% hObject    handle to Large_Matrix_2048 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global Large_Matrix_2048;
imshow(Large_Matrix_2048);
% --------------------------------------------------------------------function Large_Matrix_4096_Callback(hObject, eventdata, handles)% hObject    handle to Large_Matrix_4096 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global Large_Matrix_4096;
imshow(Large_Matrix_4096);% --------------------------------------------------------------------function open_file_Callback(hObject, eventdata, handles)% hObject    handle to open_file (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function import_raw_data_Callback(hObject, eventdata, handles)% hObject    handle to import_raw_data (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global fid dcf;
[FileName,PathName]=uigetfile('*.dat','Select the raw MR data file');
 FileName=strcat(PathName,FileName);
 [fid.kx,fid.ky,fid.r,fid.i]=textread(FileName,'%f%f%f%f','headerlines',1);

fid.c=complex(fid.r,fid.i);
fid.len=length(fid.kx);
msgbox('MR Raw Data Import Finished');% --------------------------------------------------------------------function import_dcf_Callback(hObject, eventdata, handles)% hObject    handle to import_dcf (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)

⌨️ 快捷键说明

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