基于监督学习的多模态MRI脑肿瘤分割,使用来自超体素的纹理特征(Matlab代码实现)

简介: 基于监督学习的多模态MRI脑肿瘤分割,使用来自超体素的纹理特征(Matlab代码实现)

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

更多Matlab完整代码及仿真定制内容点击👇

智能优化算法       神经网络预测       雷达通信      无线传感器        电力系统

信号处理              图像处理               路径规划       元胞自动机        无人机

🔥 内容介绍

在医学影像领域,MRI(磁共振成像)是一种常见的诊断工具,广泛应用于脑肿瘤的检测和分析。然而,准确地分割脑肿瘤仍然是一项具有挑战性的任务。近年来,基于监督学习的方法在脑肿瘤分割中取得了显著的进展。本文将介绍一种基于监督学习的多模态MRI脑肿瘤分割方法,该方法利用来自超体素的纹理特征,以提高分割的准确性和稳定性。

在传统的MRI脑肿瘤分割方法中,常常使用像素级的特征来进行分割。然而,这种方法容易受到噪声和图像不均匀性的影响,导致分割结果不准确。为了克服这些问题,我们提出了一种基于超体素的纹理特征的方法。超体素是指由相邻像素组成的三维体素块,它能够提供更丰富的局部信息。通过提取超体素的纹理特征,我们可以更好地捕捉到脑肿瘤的形态和纹理特征,从而提高分割的准确性。

在我们的方法中,我们首先从多个MRI模态中提取超体素的纹理特征。这些模态可以包括T1加权、T2加权和增强后的T1加权图像。然后,我们使用这些特征来训练一个监督学习模型,例如支持向量机(SVM)或卷积神经网络(CNN)。通过训练模型,我们可以学习到脑肿瘤的特征表示和分割决策边界。最后,我们将训练好的模型应用于新的MRI图像,进行脑肿瘤的分割。

与传统方法相比,我们的方法具有以下优势。首先,通过使用超体素的纹理特征,我们可以更好地捕捉到脑肿瘤的细微变化,提高分割的准确性。其次,我们的方法可以同时利用多个MRI模态的信息,从而提供更全面的特征表示。此外,我们的方法是基于监督学习的,可以通过大量的训练样本来学习到更准确的模型。最后,我们的方法可以在实时性要求不高的情况下进行脑肿瘤分割,为医生提供更准确的诊断结果。

然而,我们的方法也存在一些挑战和限制。首先,超体素的纹理特征提取需要大量的计算资源和存储空间。其次,我们的方法对MRI图像的质量和分辨率要求较高,对于低质量或低分辨率的图像可能无法达到理想的分割效果。此外,我们的方法还需要大量的训练样本来学习模型,这可能对于一些医疗机构来说是一项挑战。

总之,基于监督学习的多模态MRI脑肿瘤分割方法,利用来自超体素的纹理特征,是一种提高分割准确性和稳定性的有效方法。尽管存在一些挑战和限制,但随着技术的不断发展和数据的积累,我们相信这种方法将在未来的医学诊断中发挥重要作用,为医生提供更准确的脑肿瘤分析结果。

📣 部分代码

function varargout = MP3(varargin)% MP3 MATLAB code for MP3.fig%      MP3, by itself, creates a new MP3 or raises the existing%      singleton*.%%      H = MP3 returns the handle to a new MP3 or the handle to%      the existing singleton*.%%      MP3('CALLBACK',hObject,eventData,handles,...) calls the local%      function named CALLBACK in MP3.M with the given input arguments.%%      MP3('Property','Value',...) creates a new MP3 or raises the%      existing singleton*.  Starting from the left, property value pairs are%      applied to the GUI before MP3_OpeningFcn gets called.  An%      unrecognized property name or invalid value makes property application%      stop.  All inputs are passed to MP3_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 MP3% Last Modified by GUIDE v2.5 17-Jun-2021 14:19:22% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name',       mfilename, ...    'gui_Singleton',  gui_Singleton, ...    'gui_OpeningFcn', @MP3_OpeningFcn, ...    'gui_OutputFcn',  @MP3_OutputFcn, ...    'gui_LayoutFcn',  [] , ...    'gui_Callback',   []);if nargin && ischar(varargin{1})    gui_State.gui_Callback = str2func(varargin{1});endif 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 MP3 is made visible.function MP3_OpeningFcn(hObject, ~, 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 MP3 (see VARARGIN)% Choose default command line output for MP3handles.output = hObject;% Add path to all the files in the MATLAB search pathp = mfilename('fullpath');warning offrmpath(genpath(fileparts(p)))warning on addpath(genpath(fileparts(p)),'-begin');% init stuct/variableshandles.VOIs = {'Other'};handles.histo = {'Other'}; %{'Pimo', 'ColIV', 'Tc+I_cerveau', 'Tc+I_ref'};handles.resolution = [1 64 112 128 192 256 384 512 3000];handles.colors ={'b', 'g', 'm', 'c', 'r', 'k', 'y', 'navy',...    'u1','turquoise','slateblue',  'springgreen',  'maroon',...    'purple',  'u2',  'olive',  'u3','chartreuse',  'u4',  'sky',...    'u5',  'orange',  'u6',  'u7',  'u8',  'gray'}; load(which('rgb_color_table.mat'), 'num');handles.colors_rgb = num;handles.colormap = get(handles.MP3_colormap_popupmenu,'String');handles.markers ={'o','s', 'd', 'p', 'h', '+', '*', 'x'};table_data(1,1) = {'Voxel values'};set(handles.MP3_table_pixel_values, 'Data', table_data);set(handles.MP3_table1, 'Data', {'', '', '', '', ''});handles.table1.cluster = [];handles.table1.cluster_row = [];handles.mode = 1;handles.view_mode = 'Axial';set(handles.MP3_scans_button, 'ForegroundColor', [1 0 0])set(handles.MP3_scans_button, 'Value', 1)handles.display_option.view_pixel_on_map = 0;handles.display_option.view_pixel_on_plot = 0;handles.display_option.view_plot = 1;handles.display_option.manual_contrast = 0;set(handles.MP3_menu_view_plot, 'Check', 'on');for i=1:4    stri = num2str(i);    set(eval(['handles.MP3_data', stri, '_echo_slider']), 'Visible', 'off');    set(eval(['handles.MP3_data', stri, '_expt_slider']), 'Visible', 'off');endset(handles.MP3_PRM_slider_trans, 'Visible', 'off');% add MRIManager.jar to the classpath (dynamic classpath)[filepath,name,ext] = fileparts(which('MRIManager.jar'));javaclasspath(fullfile(filepath,[name,ext]));% save the java skin usedhandles.original_Java_LookAndFeel = javax.swing.UIManager.getLookAndFeel;handles.original_Java_LookAndFeel = sprintf('%s',handles.original_Java_LookAndFeel);handles.original_Java_LookAndFeel = split(handles.original_Java_LookAndFeel,' - ');handles.original_Java_LookAndFeel = extractBefore(handles.original_Java_LookAndFeel{end},']');handles.original_Java_LookAndFeel = ['[LookAndFeel] ',handles.original_Java_LookAndFeel];% A = javax.swing.UIManager.getLookAndFeel;% char(A.getClass) % 'class com.jgoodies.looks.plastic.Plastic3DLookAndFeel' Replace class by [LookAndFeel]% Update handles structureguidata(hObject, handles);% UIWAIT makes MP3 wait for user response (see UIRESUME)% uiwait(handles.MP3_GUI);% --- Outputs from this function are returned to the command line.function varargout = MP3_OutputFcn(~, ~, 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 structurevarargout{1} = handles.output;% --- Executes when user attempts to close MP3_GUI.function MP3_GUI_CloseRequestFcn(hObject, eventdata, handles)% hObject    handle to MP3_GUI (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, 'database')    delete(hObject);    if ~isempty(findobj('type', 'figure', 'name', 'MP3 pipeline Manager'))        close((findobj('type', 'figure', 'name', 'MP3 pipeline Manager')));    end    returnelse    DBFilename = [handles.database.Properties.UserData.MP3_data_path, handles.database.Properties.UserData.db_filename];    SavedDB = load(DBFilename, 'database');    Diff = setdiff(SavedDB.database, handles.database);    if isempty(Diff)        delete(hObject);        if ~isempty(findobj('type', 'figure', 'name', 'MP3 pipeline Manager'))            close((findobj('type', 'figure', 'name', 'MP3 pipeline Manager')));        end        return    endend% Hint: delete(hObject) closes the figureselection = questdlg('Before leaving, do you want to save your database?',...    'Warning',...    'Yes','No','Yes');if isempty(selection)    returnendswitch selection    case 'Yes'        MP3_menu_save_database_Callback(hObject, eventdata, handles)endif ~isempty(findobj('type', 'figure', 'name', 'MP3 pipeline Manager'))    close((findobj('type', 'figure', 'name', 'MP3 pipeline Manager')));enddelete(hObject);% --- If Enable == 'on', executes on mouse press in 5 pixel border.% --- Otherwise, executes on mouse press in 5 pixel border or over MP3_slider_slice.function MP3_slider_slice_ButtonDownFcn(hObject, eventdata, handles)% hObject    handle to MP3_slider_slice (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)handles = guidata(hObject);if ~isfield(handles, 'data_loaded') && ~isfield(handles, 'data_selected_for_PRM')    returnendSlice_min = get(hObject,'Min');Slice_max = get(hObject,'Max');Position = get(hObject,'Position');SliderBarWidth = Position(3)/Slice_max;set(hObject,'UserData',[Slice_min Slice_max SliderBarWidth]);cp = get(handles.MP3_GUI,'CurrentPoint');newValue = round((cp(1,1))/SliderBarWidth);if  newValue ==  get(handles.MP3_slider_slice,'Value')    returnelseif newValue > Slice_max    newValue = Slice_max;elseif newValue < Slice_min    newValue = Slice_min;endset(handles.MP3_slider_slice,'Value',newValue);MP3_update_axes(hObject, eventdata, handles)%% set(handles.MP3_GUI,'WindowButtonMotionFcn',{@MP3_slider_on_move,handles})% set(handles.MP3_GUI,'WindowButtonUpFcn',{@MP3_slider_release_click,handles})% --- Executes during object creation, after setting all properties.function MP3_slider_slice_CreateFcn(hObject, ~, ~)% hObject    handle to MP3_slider_slice (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 MP3_name_list.function MP3_name_list_Callback(hObject,  eventdata, ~)% hObject    handle to MP3_name_list (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: contents = cellstr(get(hObject,'String')) returns MP3_name_list contents as cell array%        contents{get(hObject,'Value')} returns selected item from MP3_name_listhandles = guidata(hObject);if ~isfield(handles, 'database')    returnendset(handles.MP3_time_points_list, 'Value', 1);set(handles.MP3_scans_list, 'Value', 1);set(handles.MP3_file_list, 'Value', 1);MP3_update_database_display(hObject, eventdata, handles);% --- Executes during object creation, after setting all properties.function MP3_name_list_CreateFcn(hObject, ~, ~)% hObject    handle to MP3_name_list (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 on selection change in MP3_scans_list.function MP3_scans_list_Callback(hObject, eventdata, handles)% hObject    handle to MP3_scans_list (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: contents = cellstr(get(hObject,'String')) returns s_list contents as cell array%        contents{get(hObject,'Value')} returns selected item from MP3_scans_listif ~isfield(handles, 'database')    returnendif numel(get(handles.MP3_name_list, 'Value')) >1 || numel(get(handles.MP3_time_points_list, 'Value')) > 1    returnendset(handles.MP3_file_list, 'Value', 1);guidata(hObject, handles);MP3_update_database_display(hObject, eventdata, handles)% --- Executes during object creation, after setting all properties.function MP3_scans_list_CreateFcn(hObject, ~, ~) %#ok<*DEFNU>% hObject    handle to MP3_scans_list (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');endfunction MP3_update_database_display(hObject, eventdata, handles)% handles = guidata(gcf, findobj('Tag', 'MP3_GUI'));handles = guidata(handles.MP3_GUI);if ~isfield(handles, 'database')    returnendif isempty(handles.database)    % if the table is empty, clear all lists    set(handles.MP3_name_list, 'String', '', 'Value', 1);    set(handles.MP3_time_points_list, 'String', '', 'Value', 1);    set(handles.MP3_scans_list, 'String', '', 'Value', 1);    set(handles.MP3_file_list, 'String', '', 'Value', 1);    returnendpatient_id = get(handles.MP3_name_list, 'Value');id_listing = unique(handles.database.Patient,'stable');set(handles.MP3_name_list, 'String', char(id_listing));if numel(patient_id)~= 1    returnendPatient_filter = handles.database.Patient== id_listing(patient_id);tp_listing = unique(handles.database.Tp(Patient_filter),'stable');% check if the new time point listing is not shorter than the old one. If% so update MP3_time_points_list 'Value'if numel(tp_listing) < get(handles.MP3_time_points_list, 'Value')    set(handles.MP3_time_points_list, 'String', char(tp_listing), 'Value', numel(tp_listing));else    set(handles.MP3_time_points_list, 'String', char(tp_listing));endtime_point = get(handles.MP3_time_points_list, 'Value');if get(handles.MP3_scans_button, 'Value') == 1 %display parameters list    is_scan =  handles.database.Type == 'Scan';    tp_filter = handles.database.Tp== tp_listing(time_point);    sequence_listing = handles.database.SequenceName(Patient_filter & tp_filter & is_scan);        % check if the sequence listing is not shorter than the old one. If    % so update MP3_scans_list 'Value'    if numel(sequence_listing) < get(handles.MP3_scans_list, 'Value')        set(handles.MP3_scans_list, 'String', char(sequence_listing), 'Value', numel(sequence_listing));    else        set(handles.MP3_scans_list, 'String', char(sequence_listing));    end    scan = get(handles.MP3_scans_list, 'Value');        file_text= cell(1, numel(sequence_listing(scan)));    for i=1:numel(sequence_listing(scan))        sequence_filter =  handles.database.SequenceName== sequence_listing(scan(i));        file_text(i) = cellstr(handles.database.Filename(Patient_filter & tp_filter & sequence_filter & is_scan));            end    set(handles.MP3_file_list, 'String', file_text);    elseif get(handles.MP3_VOIs_button, 'Value') == 1 %display VOIs list    is_ROI = handles.database.Type == 'ROI' | handles.database.Type == 'Cluster';    tp_filter = handles.database.Tp== tp_listing(time_point);    sequence_listing = handles.database.SequenceName(Patient_filter & tp_filter & is_ROI);    if isempty(sequence_listing)        set(handles.MP3_scans_list, 'String', '');        return    end    scan = get(handles.MP3_scans_list, 'Value');    set(handles.MP3_scans_list, 'String', char(sequence_listing));    file_text= cell(1, numel(sequence_listing(scan)));    for i=1:numel(sequence_listing(scan))        sequence_filter =  handles.database.SequenceName== sequence_listing(scan(i));        if sum(Patient_filter & tp_filter & sequence_filter & is_ROI) == 1            file_text(i) = cellstr(handles.database.Filename(Patient_filter & tp_filter & sequence_filter & is_ROI));        else            % in case there are more than two entries in the database --> delete the extra one(s)            indexes = find(Patient_filter & tp_filter & sequence_filter & is_ROI);            handles.database(indexes(2:end),:)=[];            guidata(hObject, handles)            return        end    end    set(handles.MP3_file_list, 'String', file_text);elseif get(handles.MP3_Others_button, 'Value') == 1 %display the "Other" tag list   % warndlg('not coded yet', 'Warning');    List_of_types = unique(handles.database.Type);    List_of_types =  List_of_types( ~sum(List_of_types == {'Scan', 'ROI', 'Cluster'}, 2));    is_scan =  sum(handles.database.Type == List_of_types',2);    tp_filter = handles.database.Tp== tp_listing(time_point);    sequence_listing = handles.database.SequenceName(Patient_filter & tp_filter & is_scan);    if isempty(sequence_listing)        set(handles.MP3_scans_list, 'String', '');        return    end    % check if the sequence listing is not shorter than the old one. If    % so update MP3_scans_list 'Value'    if numel(sequence_listing) < get(handles.MP3_scans_list, 'Value')        set(handles.MP3_scans_list, 'String', char(sequence_listing), 'Value', numel(sequence_listing));    else        set(handles.MP3_scans_list, 'String', char(sequence_listing));    end    scan = get(handles.MP3_scans_list, 'Value');        file_text= cell(1, numel(sequence_listing(scan)));    for i=1:numel(sequence_listing(scan))        sequence_filter =  handles.database.SequenceName== sequence_listing(scan(i));        file_text(i) = cellstr(handles.database.Filename(Patient_filter & tp_filter & sequence_filter & is_scan));            end    set(handles.MP3_file_list, 'String', file_text);    end% Update the groupnameMP3_show_group_Callback(hObject, eventdata, handles)% if the pipeline Manager is open, update the information : patient selected% update the 'String' of MP3_pipeline_pushMP3Selection and MP3_pipeline_pushMP3TPSelection push buttonif ~isempty(findobj('type', 'figure', 'name', 'MP3 pipeline Manager'))    % Get the hObject of MP3_pipeline    h = findobj('Tag', 'MP3_pipeline_manager_GUI');    % Get the handles of MP3_pipeline    data = guidata(h);    % Update the handles of MP3_pipeline by stocking the latest version of    % MP3 handles.    data.MP3_data = handles;    % Don't touch the original eventdata, just in case.    eventdata2 = eventdata;    %Update the MP3_pipeline tmp_database    [h, ~, data] = MP3_pipeline('UpdateTmpDatabase', h, eventdata2, data);    [~, ~, data] = MP3_pipeline('MP3_pipeline_UpdateTables', h, eventdata2, data);    clear('eventdata2')    guidata(h, data)endif ~isempty(findobj('Tag', 'MP3_pipeline_pushMP3Selection'))    data_selected = finddata_selected(handles);    if size(char(handles.database.Patient(data_selected)),1) > 1        return    else        set(findobj('Tag', 'MP3_pipeline_pushMP3Selection'), 'String', [char(handles.database.Patient(data_selected(1))) '-' char(handles.database.Tp(data_selected(1))) ' only'])        set(findobj('Tag', 'MP3_pipeline_pushMP3TPSelection'), 'String', ['All time point of :' char(handles.database.Patient(data_selected(1)))])    endend% --- Executes on selection change in MP3_time_points_list.function MP3_time_points_list_Callback(hObject, eventdata, handles)% hObject    handle to MP3_time_points_list (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: contents = cellstr(get(hObject,'String')) returns MP3_time_points_list contents as cell array%        contents{get(hObject,'Value')} returns selected item from MP3_time_points_listif ~isfield(handles, 'database')    returnendset(handles.MP3_scans_list, 'Value', 1);set(handles.MP3_file_list, 'Value', 1);guidata(hObject, handles);if numel(get(handles.MP3_time_points_list, 'Value')) >1 ||...        numel(get(handles.MP3_name_list, 'Value')) >1else    MP3_update_database_display(hObject, eventdata, handles)end% --- Executes during object creation, after setting all properties.function MP3_time_points_list_CreateFcn(hObject, ~, ~)% hObject    handle to MP3_time_points_list (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 on selection change in MP3_file_list.function MP3_file_list_Callback(~, ~, ~)% hObject    handle to MP3_file_list (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: contents = cellstr(get(hObject,'String')) returns MP3_file_list contents as cell array%        contents{get(hObject,'Value')} returns selected item from MP3_file_list% --- Executes during object creation, after setting all properties.function MP3_file_list_CreateFcn(hObject, ~, ~)% hObject    handle to MP3_file_list (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% --------------------------------------------------------------------function MP3_rename_name_Callback(hObject, eventdata, handles)% hObject    handle to MP3_rename_name (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, 'database')    returnenddata_selected = finddata_selected(handles);if numel(data_selected) >1    warndlg('Please select only one Patient', 'Warning');    returnendname_option = [cellstr(unique(handles.database.Patient(handles.database.Type == 'Scan')))''Other']';[new_Patient_name, ok1] = listdlg('PromptString','Select the new scan name:',...    'Name', 'Select a Name',...    'SelectionMode','single',...    'ListSize', [400 300],...    'ListString',name_option);if ok1 == 0    returnendif strcmp('Other',name_option(new_Patient_name)) == 1    NewPatient = inputdlg('Name of the new Scan ', 'Question?', 1, {''});    if isempty(NewPatient)        return    endelse    NewPatient =name_option(new_Patient_name);end%% update the database with the new name% but first check if the new scan name does not exist for this patient and% time pointif find(handles.database.Patient == handles.database.Patient(data_selected) &...        handles.database.Tp == handles.database.Tp(data_selected) & ...        handles.database.SequenceName == NewPatient) > 0    msgbox('A Scan with the same name already exist for this patient at this time point') ;    returnendidx_scan_to_rename = find(handles.database.Patient == handles.database.Patient(data_selected));for i=1:numel(idx_scan_to_rename)    new_nii_filename = strrep(cellstr(handles.database.Filename(idx_scan_to_rename(i))), cellstr(handles.database.Patient(idx_scan_to_rename(i))), NewPatient);        % rename the scan file    if  exist(fullfilename(handles, idx_scan_to_rename(i), '.nii'), 'file') == 0        warning_text = sprintf('##$ This file no not exist\n##$ %s',...            fullfilename(handles, idx_scan_to_rename(i), '.nii'));        msgbox(warning_text, 'rename file warning') ;    elseif exist(string(strcat(cellstr(handles.database.Path(idx_scan_to_rename(i))),new_nii_filename{:},'.nii')), 'file') == 2        msgbox('The new .nii file exist already!!') ;            else        movefile(fullfilename(handles, idx_scan_to_rename(i), '.nii'), strcat(char(handles.database.Path(idx_scan_to_rename(i))),new_nii_filename{:},'.nii'), 'f')        if exist(fullfilename(handles, idx_scan_to_rename(i), '.json'), 'file') == 2            movefile(fullfilename(handles, idx_scan_to_rename(i), '.json'), strcat(char(handles.database.Path(idx_scan_to_rename(i))),new_nii_filename{:},'.json'), 'f');        end    end        % update the Filename field in the table    handles.database.Patient(idx_scan_to_rename(i)) = NewPatient;    handles.database.Filename(idx_scan_to_rename(i)) = new_nii_filename;end% save the structureguidata(hObject, handles);set(handles.MP3_name_list, 'Value', 1);% update graph and displayMP3_update_database_display(hObject, eventdata, handles);% Save databaseMP3_menu_save_database_Callback(hObject, eventdata, handles)function MP3_remove_name_Callback(hObject, eventdata, handles)% hObject    handle to MP3_remove_name (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, 'database')    returnend%data_selected = finddata_selected(handles);patient_seleted = get(handles.MP3_name_list, 'String');patient_name = patient_seleted(get(handles.MP3_name_list, 'Value'),:);%patient_name = unique(handles.database.Patient(data_selected));user_response = questdlg(['Do you want to delete every data of ' cellstr(patient_name)']', 'Warning', 'Yes', 'No', 'Cancel', 'Cancel');if strcmp(user_response, 'Cancel') || strcmp(user_response, 'No') || isempty(user_response)    returnendnii_index = [];for i=1:size(patient_name,1)    nii_index = [nii_index' find(handles.database.Patient == categorical(cellstr(patient_name(i,:))))']';endMP3_remove_scan(hObject, eventdata, handles, nii_index)% --------------------------------------------------------------------function MP3_name_right_click_Callback(hObject, eventdata, handles)% hObject    handle to MP3_name_right_click (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, 'database')    returnend% patient_num = get(handles.MP3_name_list, 'Value');% omit_obj = findobj(handles.MP3_name_right_click, 'Label', 'Omit');% set(omit_obj, 'Checked', 'off');% if numel(patient_num) ==1 && ~isempty(handles.database(patient_num).group)%     group_name = handles.database(patient_num).group;%     if handles.database(patient_num).omit == 1%         set(omit_obj, 'Checked', 'on');%     end% end%% show_menu_obj = findobj(handles.MP3_name_right_click, 'Label', 'Show');% delete(get(show_menu_obj, 'Children'))  %remove the 'old' show menu%% group = reshape({handles.database.group},1,[]);% group_list = unique(group);% %group_list = unique(group(1:2:end));%% if ~isfield(handles, 'database_all') || numel(handles.database_all) == numel(handles.database)%     for i = 1:numel(group_list)%         uimenu(show_menu_obj, 'Label', group_list{i},...%             'Callback', @(hObject,eventdata)MP3('MP3_show_group_submenu',hObject,eventdata,guidata(hObject)));%     end% else%     uimenu(show_menu_obj, 'Label', 'all',...%         'Callback', @(hObject,eventdata)MP3('MP3_show_group_submenu',hObject,eventdata,guidata(hObject)));% end% guidata(hObject, handles);%% function MP3_show_group_submenu(hObject, eventdata, handles)%% show = get(hObject, 'Label');% if strcmp('all', show)%     database_tmp = handles.database_all;%     for i = 1:numel(handles.database)%         name_size = numel(handles.database(i).name);%         match_name = find(strncmp(handles.database(i).name, {database_tmp.name}', name_size) ==1);%         if numel(match_name) >1%             for j =1:numel(match_name)%                 if numel(handles.database(match_name(j)).name) == name_size;%                     tmp = match_name(j);%                 end%             end%             match_name = tmp;%         end%         database_tmp(match_name) = handles.database(i);%     end%     handles.database = database_tmp;%     handles= rmfield(handles, 'database_all');% else%     n = 1;%     for i=1:numel(handles.database)%         if strncmp(show, handles.database(i).group, numel(show)) == 1 &&...%                 numel(show) ==  numel(handles.database(i).group)%             database_tmp(n) = handles.database(i);%             n=n+1;%         end%     end%     handles.database_all = handles.database;%     handles.database = database_tmp;% end% set(handles.MP3_name_list, 'Value', 1);% set(handles.MP3_time_points_list, 'Value', 1);% guidata(handles.MP3_GUI, handles);% MP3_update_database_display(hObject, eventdata, handles);% --------------------------------------------------------------------function MP3_open_database_ClickedCallback(hObject, eventdata, handles)% hObject    handle to MP3_open_database (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, 'database')    selection = questdlg('Have you saved the present database?',...        'Warning',...        'Yes','No','Yes');    switch selection        case 'No'            return    endendpath_root=pwd;%[filename, pathname]=uigetfile('*.mat','Open Mat File','MultiSelect','off');selpath = uigetdir(path_root,'Select the project''s folder you want to open');pathname = selpath;%listfiles = what(selpath)filename = 'MP3_database.mat';if pathname == 0    returnelse    if exist(fullfile(pathname, filename)) ~= 2        % The former name of MP3 is MIA. The following lines allow to open        % old projects with the new software.        if exist(fullfile(pathname, 'MIA_database.mat')) ~= 2            errordlg('The folder you selected might be corrupt. Please select a folder containing a MP3_database.mat file.', 'Cannot open project');            return        else            movefile(fullfile(pathname, 'MIA_database.mat'), fullfile(pathname, filename));        end    end    cd(pathname);    if ~strcmp(class(filename),'double') %#ok<STISA>        %reset everything        handles = MP3_clear_data(hObject, eventdata, handles);        set(handles.MP3_name_list, 'Value', 1);        set(handles.MP3_time_points_list, 'Value', 1);        set(handles.MP3_scans_button, 'Value', 1);        set(handles.MP3_scans_list, 'Value', 1);                database = load(filename);        handles.database = database.database;        set(handles.MP3_name_list, 'String', handles.database.Properties.UserData.db_filename)                % update database path (in case the directory has moved)         handles.database.Properties.UserData.db_filename = filename;        new_patient_directory = strcat(pathname, filesep);        handles.database.Properties.UserData.MP3_data_path  = new_patient_directory;        handles.database.Properties.UserData.MP3_Raw_data_path = [new_patient_directory, 'Raw_data', filesep];        handles.database.Properties.UserData.MP3_ROI_path = [new_patient_directory, 'ROI_data', filesep];        handles.database.Properties.UserData.MP3_Derived_data_path = [new_patient_directory, 'Derived_data', filesep];        handles.database.Properties.UserData.PSOM_path = [new_patient_directory, 'PSOM', filesep];        handles.database.Properties.UserData.MP3_Others_data_path = [new_patient_directory, 'Others_data', filesep];        % update the path in the table        %handles.database.Path(handles.database.Type == 'Scan') = handles.database.Properties.UserData.MP3_Raw_data_path;        if ~isempty(handles.database)            handles.database.Path(handles.database.IsRaw == '0' & handles.database.Type == 'Scan',:) = handles.database.Properties.UserData.MP3_Derived_data_path ;            handles.database.Path(handles.database.IsRaw == '1' & handles.database.Type == 'Scan',:) = handles.database.Properties.UserData.MP3_Raw_data_path;            handles.database.Path(handles.database.Type == 'Mfile',:) = handles.database.Properties.UserData.MP3_Others_data_path;            handles.database.Path(handles.database.Type == 'ROI') = handles.database.Properties.UserData.MP3_ROI_path;            handles.database.Path(handles.database.Type == 'Cluster') = handles.database.Properties.UserData.MP3_ROI_path;        end                guidata(hObject, handles);    end    cd(path_root);endMP3_update_figureName(hObject, eventdata, handles)guidata(hObject, handles);MP3_update_database_display(hObject, eventdata, handles);% --------------------------------------------------------------------function MP3_time_points_right_click_Callback(~, ~, ~)% hObject    handle to MP3_time_points_right_click (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function MP3_rename_time_point_Callback(hObject, eventdata,handles)% hObject    handle to MP3_rename_time_point (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, 'database')    returnenddata_selected = finddata_selected(handles);if numel(data_selected) >1    warndlg('Please select only one Time point', 'Warning');    returnendname_option = [cellstr(unique(handles.database.Tp(handles.database.Type == 'Scan')))' 'Other']';[new_TP_name, ok1] = listdlg('PromptString','Select the new scan name:',...    'Name', 'Select a Name',...    'SelectionMode','single',...    'ListSize', [400 300],...    'ListString',name_option);if ok1 == 0    returnendif strcmp('Other',name_option(new_TP_name)) == 1    NewTp = inputdlg('Name of the new Scan ', 'Question?', 1, {''});else    NewTp =name_option(new_TP_name);end%% update the database with the new name% but first check if the new scan name does not exist for this patient and% time point% faire le ROI vs SCANif find(handles.database.Patient == handles.database.Patient(data_selected) &...        handles.database.Tp == handles.database.Tp(data_selected) & ...        handles.database.SequenceName == NewTp) > 0    msgbox('A Scan with the same name already exist for this patient at this time point') ;    returnendidx_scan_to_rename = find(handles.database.Patient == handles.database.Patient(data_selected) & handles.database.Tp == handles.database.Tp(data_selected));for i=1:numel(idx_scan_to_rename)    new_nii_filename = strrep(cellstr(handles.database.Filename(idx_scan_to_rename(i))), cellstr(handles.database.Tp(idx_scan_to_rename(i))), NewTp);        % rename the scan file    if  exist(fullfilename(handles, idx_scan_to_rename(i), '.nii'), 'file') == 0 && exist(fullfilename(handles, idx_scan_to_rename(i), '.nii.gz'), 'file') == 0        warning_text = sprintf('##$ This file no not exist\n##$ %s',...            fullfilename(handles, idx_scan_to_rename(i), '.nii'));        msgbox(warning_text, 'rename file warning') ;    elseif exist(string(strcat(cellstr(handles.database.Path(idx_scan_to_rename(i))),new_nii_filename{:},'.nii')), 'file') == 2        msgbox('The new .nii file exist already!!') ;            else        if exist(fullfilename(handles, idx_scan_to_rename(i), '.nii'), 'file') == 2            movefile(fullfilename(handles, idx_scan_to_rename(i), '.nii'), strcat(char(handles.database.Path(idx_scan_to_rename(i))),new_nii_filename{:},'.nii'), 'f')        end        if exist(fullfilename(handles, idx_scan_to_rename(i), '.nii.gz'), 'file') == 2            movefile(fullfilename(handles, idx_scan_to_rename(i), '.nii.gz'), strcat(char(handles.database.Path(idx_scan_to_rename(i))),new_nii_filename{:},'.nii.gz'), 'f')        end        if exist(fullfilename(handles, idx_scan_to_rename(i), '.json'), 'file') == 2            movefile(fullfilename(handles, idx_scan_to_rename(i), '.json'), strcat(char(handles.database.Path(idx_scan_to_rename(i))),new_nii_filename{:},'.json'), 'f');        end    end        % update the Filename field in the table    handles.database.Tp(idx_scan_to_rename(i)) = NewTp;    handles.database.Filename(idx_scan_to_rename(i)) = new_nii_filename;end% save the structureguidata(hObject, handles);%% update graph and displayMP3_update_database_display(hObject, eventdata, handles);% save databaseMP3_menu_save_database_Callback(hObject, eventdata, handles)% --------------------------------------------------------------------function MP3_rename_scan_Callback(hObject, eventdata, handles)% hObject    handle to MP3_rename_scan (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, 'database') || isempty(get(handles.MP3_scans_list, 'String'))    returnenddata_selected = finddata_selected(handles);if numel(data_selected) >1    warndlg('Please select only one scan', 'Warning');    returnendif get(handles.MP3_scans_button, 'Value')    name_option = [cellstr(unique(handles.database.SequenceName(handles.database.Type == 'Scan')))' 'Other']';  elseif get(handles.MP3_VOIs_button, 'Value')    name_option = [cellstr(unique(handles.database.SequenceName(handles.database.Type == 'ROI')))' 'Other']';elseif get(handles.MP3_Others_button_button, 'Value')    name_option = [cellstr(unique(handles.database.SequenceName(handles.database.Type ~= 'Scan' & handles.database.Type ~= 'ROI')))' 'Other']';end [new_scan_name, ok1] = listdlg('PromptString','Select the new scan name:',...    'Name', 'Select a Name',...    'SelectionMode','single',...    'ListSize', [400 300],...    'ListString',name_option);if ok1 == 0    returnendif strcmp('Other',name_option(new_scan_name)) == 1    newparameter = inputdlg('Name of the new Scan ', 'Question?', 1, {''});else    newparameter =name_option(new_scan_name);end%% update the database with the new name% but first check if the new scan name does not exist for this patient and% time point% faire le ROI vs SCANif find(handles.database.Patient == handles.database.Patient(data_selected) &...        handles.database.Tp == handles.database.Tp(data_selected) & ...        handles.database.SequenceName == newparameter) > 0    msgbox('A Scan with the same name already exist for this patient at this time point') ;    returnendnew_nii_filename = strrep(cellstr(handles.database.Filename(data_selected)), cellstr(handles.database.SequenceName(data_selected)), newparameter);% rename the scan fileif  exist(fullfilename(handles, data_selected, '.nii'), 'file') == 0 && exist(fullfilename(handles, data_selected, '.nii.gz'), 'file') == 0    warning_text = sprintf('##$ This file no not exist\n##$ %s',...        fullfilename(handles, data_selected, '.nii'));    msgbox(warning_text, 'rename file warning') ;elseif exist(string(strcat(cellstr(handles.database.Path(data_selected)),new_nii_filename{:},'.nii')), 'file') == 2    msgbox('The new .nii file exist already!!') ;    else    if exist(fullfilename(handles, data_selected, '.nii'), 'file') == 2        movefile(fullfilename(handles, data_selected, '.nii'), strcat(char(handles.database.Path(data_selected)),new_nii_filename{:},'.nii'), 'f')    end    if exist(fullfilename(handles, data_selected, '.nii.gz'), 'file') == 2        movefile(fullfilename(handles, data_selected, '.nii.gz'), strcat(char(handles.database.Path(data_selected)),new_nii_filename{:},'.nii.gz'), 'f')    end    % rename json file if needed    if exist(fullfilename(handles, data_selected, '.json'), 'file') == 2        movefile(fullfilename(handles, data_selected, '.json'), strcat(char(handles.database.Path(data_selected)),new_nii_filename{:},'.json'), 'f');    end     % rename mat file if needed    if exist(fullfilename(handles, data_selected, '.mat'), 'file') == 2        movefile(fullfilename(handles, data_selected, '.mat'), strcat(char(handles.database.Path(data_selected)),new_nii_filename{:},'.mat'), 'f');    endend% update the Filename field in the tablehandles.database.SequenceName(data_selected) = newparameter;handles.database.Filename(data_selected) = new_nii_filename;% save the structureguidata(hObject, handles);%% update graph and displayMP3_update_database_display(hObject, eventdata, handles);% Save databaseMP3_menu_save_database_Callback(hObject, eventdata, handles)% --------------------------------------------------------------------function MP3_remove_scan_Callback(hObject, eventdata, handles)% hObject    handle to MP3_remove_scan (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, 'database')    returnendnii_index = finddata_selected(handles);user_response = questdlg('Do you want to delete these data ??', 'Warning', 'Yes', 'No', 'Cancel', 'Cancel');if strcmp(user_response, 'Cancel') || strcmp(user_response, 'No') || isempty(user_response)    returnendMP3_remove_scan(hObject, eventdata, handles, nii_index)% --------------------------------------------------------------------function MP3_remove_time_point_Callback(hObject, eventdata, handles)% hObject    handle to MP3_remove_time_point (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, 'database')    returnenddata_selected = finddata_selected(handles);Time_point_selected = unique(handles.database.Tp(data_selected));patient_selected = unique(handles.database.Patient(data_selected));user_response = questdlg(['Do you want to delete every data of ' char(Time_point_selected) '??'], 'Warning', 'Yes', 'No', 'Cancel', 'Cancel');if strcmp(user_response, 'Cancel') || strcmp(user_response, 'No')    returnendnii_index = find(handles.database.Patient == patient_selected & handles.database.Tp == Time_point_selected);MP3_remove_scan(hObject, eventdata, handles, nii_index)% --------------------------------------------------------------------function MP3_ScanVoi_right_click_Callback(~, ~, ~)% hObject    handle to MP3_ScanVoi_right_click (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)function MP3_update_figureName(~, ~, handles)num_timepoint = 0;patient_listing = unique(handles.database.Patient);for i=1:numel(patient_listing)    num_timepoint = num_timepoint+ numel(unique(handles.database.Tp(handles.database.Patient == patient_listing(i))));endName_soft = 'Medical software for Processing multi-Parametric image Pipelines (Grenoble Institute of neurosciences - France)';Spl = strsplit(handles.database.Properties.UserData.MP3_data_path, filesep);Name_Projet = Spl{end-1};%old_title = get(handles.MP3_GUI, 'Name');title = [Name_soft, ' ; Projet : ', Name_Projet, ' ; ', num2str(numel(patient_listing)),...    ' patients and ',  num2str(num_timepoint), ' ','time points'];set(handles.MP3_GUI, 'Name', title);function handles = MP3_update_handles_parameters_VOIs(handles)% parameters_list = [];% Voi_list = [];% for patient=1:numel(handles.database)%     for time_point = 1:numel(handles.database(patient).day)%         parameters_list = [parameters_list handles.database(patient).day(time_point).parameters];%         Voi_list = [Voi_list  handles.database(patient).day(time_point).VOIs];%     end% end% handles.VOIs = [unique(Voi_list) 'Other'];VOIs_list = {};for i=1:numel(handles.database)    for j = 1:numel(handles.database(i).day)        VOIs_list = [VOIs_list handles.database(i).day(j).VOIs];    endendhandles.VOIs = [unique(VOIs_list), 'Other'];guidata(handles.MP3_GUI, handles);function MP3_load_axes_Callback(hObject, eventdata, handles)if get(handles.MP3_Others_button, 'Value') == 1        warndlg('Such files cannot be display in MP3','Warning');        returnend% by default this slider is hiddedset(handles.MP3_PRM_slider_trans, 'Visible', 'off');if ~isfield(handles, 'database') || isempty(handles.database)    returnend% MP3 cannot load scan(s) if multiple patients are selectedif numel(get(handles.MP3_name_list, 'Value')) > 1     warndlg('Please select only 1 patient before loading scan(s)','Warning');    returnendscan = get(handles.MP3_scans_list, 'Value');% Load VOIsif handles.mode == 2 && numel(scan) > 1    if get(handles.MP3_scans_button, 'Value') == 1        warndlg('Please select only 1 Scan when using the longitudinal view mode','Warning');    elseif get(handles.MP3_VOIs_button, 'Value') == 1        warndlg('Please select only 1 VOI when using the longitudinal view mode','Warning');    end    returnendif get(handles.MP3_VOIs_button, 'Value') && isfield(handles, 'data_loaded') || ...        get(handles.MP3_scans_button, 'Value') && isfield(handles, 'data_selected_for_PRM')        handles = MP3_load_VOIs(hObject, eventdata, handles);    MP3_update_axes(hObject, eventdata, handles)    returnelseif get(handles.MP3_VOIs_button, 'Value') && ~isfield(handles, 'data_loaded')    warndlg('Please load a scan first','Warning');    returnendhandles = MP3_clear_data(hObject, eventdata, handles);% display a waiting symbolset(handles.MP3_GUI, 'pointer', 'watch');% Load Scansif handles.mode == 1    handles = MP3_load_axes_single(hObject, eventdata, handles);else    handles = MP3_load_axes_PRM(hObject, eventdata, handles);    % if all conditions are not present --> return    if ~isfield(handles, 'data_loaded')        return    end    list_day = ['-1', string(handles.data_loaded.info_data_loaded.Tp)'];    set(handles.MP3_PRM_ref_popupmenu, 'String', list_day', 'Value', 2);    %set MP3_PRM_slider    set(handles.MP3_PRM_slider_tp, 'Max', handles.data_loaded.number_of_scan);    set(handles.MP3_PRM_slider_tp,'Value',1);    set(handles.MP3_PRM_slider_tp,'Min',1);        set(handles.MP3_PRM_slider_tp,'Visible', 'on');    set(handles.MP3_PRM_slider_tp,'SliderStep',[1/(handles.data_loaded.number_of_scan-1) min(5/(handles.data_loaded.number_of_scan-1),1)]);enddrawnow;MP3_update_axes(hObject, eventdata, handles)set(handles.MP3_GUI, 'pointer', 'arrow');%toc(tstart)function handles = MP3_load_VOIs(hObject, ~, handles)data_selected = finddata_selected(handles);handles.data_loaded.info_data_loaded(handles.data_loaded.info_data_loaded.Type == 'ROI',:) =[];if isfield(handles.data_loaded, 'ROI')    handles.data_loaded= rmfield(handles.data_loaded, 'ROI');    handles.data_loaded= rmfield(handles.data_loaded, 'number_of_ROI');endif isfield(handles.data_displayed, 'ROI')    handles.data_displayed= rmfield(handles.data_displayed, 'ROI');endhandles.data_loaded.info_data_loaded(handles.data_loaded.info_data_loaded.Type == 'Cluster',:) =[];if isfield(handles.data_loaded, 'Cluster')    handles.data_loaded= rmfield(handles.data_loaded, 'Cluster');    handles.data_loaded= rmfield(handles.data_loaded, 'number_of_Cluster');endif isfield(handles.data_displayed, 'Cluster')    handles.data_displayed= rmfield(handles.data_displayed, 'Cluster');endhandles.data_loaded.number_of_ROI = 0;handles.data_loaded.number_of_Cluster = 0;for i = 1:numel(data_selected)    if ~exist(fullfilename(handles, data_selected(i), '.nii'), 'file') && exist(fullfilename(handles, data_selected(i), '.nii.gz'), 'file')        gunzip(fullfilename(handles, data_selected(i), '.nii.gz'));        assert(exist(fullfilename(handles, data_selected(i), '.nii'), 'file')==2)        delete(fullfilename(handles, data_selected(i), '.nii.gz'))            end    fid_nii=fopen(fullfilename(handles, data_selected(i), '.nii'),'r');    if fid_nii>0        fclose(fid_nii);        % scan_of_reference = get(handles.MP3_orientation_space_popupmenu, 'Value');        if strcmp(char(handles.database(data_selected(i),:).Type), 'ROI')            %% read and load the nii file            handles.data_loaded.number_of_ROI = handles.data_loaded.number_of_ROI+1;            handles.data_loaded.ROI(handles.data_loaded.number_of_ROI).V = spm_vol(char(fullfilename(handles, data_selected(i), '.nii')));            %           handles.data_loaded.ROI(i).nii = read_volume(handles.data_loaded.ROI(i).V, handles.data_loaded.Scan(scan_of_reference).V,3, handles.view_mode);            %           handles.data_loaded.ROI(i).nii(handles.data_loaded.ROI(i).nii>0) = 1;                        handles.data_loaded.info_data_loaded = [handles.data_loaded.info_data_loaded; handles.database(data_selected(i),:)];        elseif strcmp(char(handles.database(data_selected(i),:).Type), 'Cluster')            set(handles.MP3_PRM_slider_trans, 'Visible', 'on');            %% read and load the nii file            handles.data_loaded.number_of_Cluster = handles.data_loaded.number_of_Cluster+1;            handles.data_loaded.Cluster(handles.data_loaded.number_of_Cluster).V = spm_vol(char(fullfilename(handles, data_selected(i), '.nii')));            %           handles.data_loaded.ROI(i).nii = read_volume(handles.data_loaded.ROI(i).V, handles.data_loaded.Scan(scan_of_reference).V,3, handles.view_mode);            %           handles.data_loaded.ROI(i).nii(handles.data_loaded.ROI(i).nii>0) = 1;                        handles.data_loaded.info_data_loaded = [handles.data_loaded.info_data_loaded; handles.database(data_selected(i),:)];        end    else        warndlg('something wrong with the data. Nii or json file is missing','Warning');        return    end    guidata(hObject, handles);endfunction handles = MP3_load_axes_single(hObject, ~, handles)data_selected = finddata_selected(handles);if numel(data_selected) > 4  % select only the 4 first scan    data_selected = data_selected(1:4);endfor i = 1:numel(data_selected)    if ~exist(fullfilename(handles, data_selected(i), '.nii'), 'file') && exist(fullfilename(handles, data_selected(i), '.nii.gz'), 'file')        gunzip(fullfilename(handles, data_selected(i), '.nii.gz'));        assert(exist(fullfilename(handles, data_selected(i), '.nii'), 'file')==2)        delete(fullfilename(handles, data_selected(i), '.nii.gz'))    end    fid_nii=fopen(fullfilename(handles, data_selected(i), '.nii'),'r');    fid_json=fopen(fullfilename(handles, data_selected(i), '.json'),'r');    if fid_nii>0 && fid_json>0        fclose(fid_nii);        fclose(fid_json);                %% read and load the json file        handles.data_loaded.Scan(i).json = spm_jsonread(fullfilename(handles, data_selected(i), '.json'));                %% read and load the nii file        handles.data_loaded.Scan(i).V =spm_vol(fullfilename(handles, data_selected(i), '.nii'));    else        warndlg('something wrong with the data. Nii of json file is missing','Warning');        return    end    clear newendset(handles.MP3_patient_information_title, 'String', [char(unique(handles.database.Patient(data_selected))) '_' char(unique(handles.database.Tp(data_selected)))]);set(handles.MP3_orientation_space_popupmenu, 'String',  char(unique(handles.database.SequenceName(data_selected),'stable')), 'Value', 1);if numel(data_selected) > 1    set(handles.MP3_orientation_space_popupmenu, 'Visible', 'on');    set(handles.MP3_orientation_space_text, 'Visible', 'on');else    set(handles.MP3_orientation_space_popupmenu, 'Visible', 'off');    set(handles.MP3_orientation_space_text, 'Visible', 'off');endhandles.data_loaded.number_of_scan = numel(data_selected);handles.data_loaded.info_data_loaded = handles.database(data_selected,:);guidata(hObject, handles);if ~isempty(findobj('type', 'figure', 'name', 'FileHistory')) && length(handles.data_loaded.Scan) == 1       % Get the hObject of MP3_pipeline    h = findobj('type', 'figure', 'name', 'FileHistory');    % Get the handles of MP3_pipeline    data = guidata(h);    % Update the handles of MP3_pipeline by stocking the latest version of    % MP3 handles.    data.MP3_data = handles;    % Don't touch the original eventdata, just in case.    %Update the MP3_pipeline tmp_database    data.FileHistory_JobsListbox.Value = 1;    [h,data] = FileHistory('UpdateJobsList', h, data);    %[~, ~, data] = MP3_pipeline('MP3_pipeline_UpdateTables', h, eventdata2, data);    guidata(h, data)elseif ~isempty(findobj('type', 'figure', 'name', 'FileHistory'))      close(findobj('type', 'figure', 'name', 'FileHistory'))endfunction handles = MP3_load_axes_PRM(hObject, ~, handles)% PRM mode i.e. need to open the one parameter (diffusion% or perfusion or...) for every time pointdata_selected = finddata_selected(handles);if numel(data_selected) ~= 1    warndlg('In longitudinal view mode you can open only on scan!!', 'Warning');    returnend% find indice of the same scan name across each time point to the selected% patientdata_to_load = find(handles.database.Patient == handles.database.Patient(data_selected) &...    handles.database.SequenceName == handles.database.SequenceName(data_selected));[~, idx] =sort(handles.database.Tp(data_to_load));data_to_load = data_to_load(idx);if numel(data_to_load) <2    warndlg(strcat({'Need more than one '},  char(handles.database.SequenceName(data_selected)), ' scan to run the longitudinal view mode') ,'Warning');    returnend

⛳️ 运行结果

🔗 参考文献

[1] 方玲玲,王欣.基于超体素的多模态MRI脑肿瘤分割方法:CN202011276427.6[P].CN112435261A[2023-09-19].

[2] 郭桦.基于深度学习与多模态MRI图像的脑肿瘤分割方法研究[D].电子科技大学,2019.

🎈 部分理论引用网络文献,若有侵权联系博主删除
🎁  关注我领取海量matlab电子书和数学建模资料

👇  私信完整代码和数据获取及论文数模仿真定制

1 各类智能优化算法改进及应用

生产调度、经济调度、装配线调度、充电优化、车间调度、发车优化、水库调度、三维装箱、物流选址、货位优化、公交排班优化、充电桩布局优化、车间布局优化、集装箱船配载优化、水泵组合优化、解医疗资源分配优化、设施布局优化、可视域基站和无人机选址优化

2 机器学习和深度学习方面

卷积神经网络(CNN)、LSTM、支持向量机(SVM)、最小二乘支持向量机(LSSVM)、极限学习机(ELM)、核极限学习机(KELM)、BP、RBF、宽度学习、DBN、RF、RBF、DELM、XGBOOST、TCN实现风电预测、光伏预测、电池寿命预测、辐射源识别、交通流预测、负荷预测、股价预测、PM2.5浓度预测、电池健康状态预测、水体光学参数反演、NLOS信号识别、地铁停车精准预测、变压器故障诊断

2.图像处理方面

图像识别、图像分割、图像检测、图像隐藏、图像配准、图像拼接、图像融合、图像增强、图像压缩感知

3 路径规划方面

旅行商问题(TSP)、车辆路径问题(VRP、MVRP、CVRP、VRPTW等)、无人机三维路径规划、无人机协同、无人机编队、机器人路径规划、栅格地图路径规划、多式联运运输问题、车辆协同无人机路径规划、天线线性阵列分布优化、车间布局优化

4 无人机应用方面

无人机路径规划、无人机控制、无人机编队、无人机协同、无人机任务分配、无人机安全通信轨迹在线优化

5 无线传感器定位及布局方面

传感器部署优化、通信协议优化、路由优化、目标定位优化、Dv-Hop定位优化、Leach协议优化、WSN覆盖优化、组播优化、RSSI定位优化

6 信号处理方面

信号识别、信号加密、信号去噪、信号增强、雷达信号处理、信号水印嵌入提取、肌电信号、脑电信号、信号配时优化

7 电力系统方面

微电网优化、无功优化、配电网重构、储能配置

8 元胞自动机方面

交通流 人群疏散 病毒扩散 晶体生长

9 雷达方面

卡尔曼滤波跟踪、航迹关联、航迹融合





相关文章
|
3天前
|
算法 TensorFlow 算法框架/工具
基于直方图的图像阈值计算和分割算法FPGA实现,包含tb测试文件和MATLAB辅助验证
这是一个关于图像处理的算法实现摘要,主要包括四部分:展示了四张算法运行的效果图;提到了使用的软件版本为VIVADO 2019.2和matlab 2022a;介绍了算法理论,即基于直方图的图像阈值分割,通过灰度直方图分布选取阈值来区分图像区域;并提供了部分Verilog代码,该代码读取图像数据,进行处理,并输出结果到&quot;result.txt&quot;以供MATLAB显示图像分割效果。
|
6天前
|
数据采集 算法 数据可视化
MATLAB、R用改进Fuzzy C-means模糊C均值聚类算法的微博用户特征调研数据聚类研究
MATLAB、R用改进Fuzzy C-means模糊C均值聚类算法的微博用户特征调研数据聚类研究
13 1
|
15天前
|
数据可视化 数据库
matlab中使用VMD(变分模态分解)对信号去噪
matlab中使用VMD(变分模态分解)对信号去噪
15 0
matlab中使用VMD(变分模态分解)对信号去噪
|
17天前
|
数据可视化 数据库
matlab中使用VMD(变分模态分解)
matlab中使用VMD(变分模态分解)
12 0
|
25天前
|
存储 人工智能 机器人
【Matlab】Matlab 汉/英语(A/a)声学特征比较与基音频率分析(源码+音频文件)【独一无二】
【Matlab】Matlab 汉/英语(A/a)声学特征比较与基音频率分析(源码+音频文件)【独一无二】
|
25天前
|
存储 人工智能 机器人
【Matlab】Matlab电话拨号音合成与识别(代码+论文)【独一无二】
【Matlab】Matlab电话拨号音合成与识别(代码+论文)【独一无二】
|
1月前
|
存储
【Matlab】Matlab电话拨号音合成与识别(代码+论文)【独一无二】
【Matlab】Matlab电话拨号音合成与识别(代码+论文)【独一无二】
|
3月前
|
机器学习/深度学习 算法 计算机视觉
霍夫变换车道线识别-车牌字符识别代码(matlab仿真与图像处理系列第5期)
霍夫变换车道线识别-车牌字符识别代码(matlab仿真与图像处理系列第5期)
30 2
|
3月前
|
算法
MATLAB | 插值算法 | 一维interpl插值法 | 附数据和出图代码 | 直接上手
MATLAB | 插值算法 | 一维interpl插值法 | 附数据和出图代码 | 直接上手
45 0
|
4月前
|
Perl
【MFAC】基于全格式动态线性化的无模型自适应控制(Matlab代码)
【MFAC】基于全格式动态线性化的无模型自适应控制(Matlab代码)

热门文章

最新文章