📄 fc_gui.m
字号:
set(handles.txtTR, ...
'Style', 'text', ...
'Units', 'pixels', ...
'Position', [230 530 40 16], ...
'String', 'TR: (s)');
% --- PUSHBUTTONS -------------------------------------
set(handles.btnSelectOutputDir, ...
'Style', 'pushbutton', ...
'Units', 'pixels', ...
'Position', [396 107 30 25], ...
'FontSize', 18, ...
'String', '...');
set(handles.btnSelectDataDir, ...
'Style', 'pushbutton', ...
'Units', 'pixels', ...
'Position', [396 372 30 25], ...
'FontSize', 18, ...
'String', '...', ...
'CData', zeros(1,0));
set(handles.btnSelectMask, ...
'Style', 'pushbutton', ...
'Units', 'pixels', ...
'Position', [396 275 30 25], ...
'FontSize', 18, ...
'String', '...', ...
'Enable', 'off', ...
'CData', zeros(1,0));
set(handles.btnComputeFC, ...
'Style', 'pushbutton', ...
'Units', 'pixels', ...
'Position', [320 186 107 33], ...
'FontSize', 12, ...
'FontWeight', 'bold', ...
'String', 'Do all');
set(handles.btnDetrend , ...
'Style', 'pushbutton', ...
'Units', 'pixels', ...
'Position', [337 593 90 25], ...
'FontSize', 10, ...
'String', 'Detrend');
set(handles.btnBandPass , ...
'Style', 'pushbutton', ...
'Units', 'pixels', ...
'Position', [337 530 90 25], ...
'FontSize', 10, ...
'String', 'Filter');
set(handles.btnROIVoxelWise , ...
'Style', 'pushbutton', ...
'Units', 'pixels', ...
'Position', [5 315 85 25], ...%'FontSize', 10, ...
'ForegroundColor', 'red', ...
'TooltipString', 'Functional Connectivity with whole brain', ...
'String', 'Voxel wise');
set(handles.btnROIRegionWise , ...
'Style', 'pushbutton', ...
'Units', 'pixels', ...
'Position', [5 275 85 25], ... %'FontSize', 18, ...
'ForegroundColor', 'red', ...
'TooltipString', 'Functional Connectivity between defined regions', ...
'String', 'ROI wise');
set(handles.btnCovariable, ... %'Style', 'pushbutton', ...
'Style', 'text', ... %20071103
'Units', 'pixels', ...
'Position', [5 234 85 25], ...
'FontSize', 10, ... %'FontWeight', 'bold', ...
'ForegroundColor', 'blue', ...
'Visible', 'on', ...
'String', 'Covariables:');
set(handles.btnSelectCovariableFile , ...
'Style', 'pushbutton', ...
'Units', 'pixels', ...
'Position', [396 234 30 25], ...
'FontSize', 18, ...
'ForegroundColor', 'blue', ...
'String', '...');
set(handles.btnHelp, ...
'Style', 'pushbutton', ...
'Units', 'pixels', ...
'Position', [10 10 90 33], ...
'FontSize', 10, ...
'String', 'Help');
set(handles.btnFisherZ, ...
'Style', 'pushbutton', ...
'Units', 'pixels', ...
'Position', [110 10 90 33], ...
'FontSize', 10, ...
'String', 'Fisher Z');
set(handles.btnSliceViewer, ...
'Style', 'pushbutton', ...
'Units', 'pixels', ...
'Position', [210 10 90 33], ...
'FontSize', 10, ...
'String', 'Slice Viewer');
set(handles.btnWaveGraph, ...
'Style', 'pushbutton', ...
'Units', 'pixels', ...
'Position', [314 10 110 33], ...
'FontSize', 10, ...
'String', 'Power Spectrum');
% --- RADIO BUTTONS -------------------------------------
set(handles.rbtnDefaultMask, ...
'Style', 'radiobutton', ...
'Units', 'pixels', ...
'Position', [110 335 158 16], ...
'String', 'Default mask');
set(handles.rbtnUserMask, ...
'Style', 'radiobutton', ...
'Units', 'pixels', ...
'Position', [110 305 148 16], ...
'String', 'User''s defined mask');
set(handles.rbtnNullMask, ...
'Style', 'radiobutton', ...
'Units', 'pixels', ...
'Position', [277 335 82 16], ...
'String', 'No mask');
% --- CHECKBOXES -------------------------------------
set(handles.ckboxFilter, ...
'Style', 'checkbox', ...
'Units', 'pixels', ...
'Position', [14 530 80 22], ...
'String', 'Band (Hz)');
set(handles.ckboxFisherZ, ...
'Style', 'checkbox', ...
'Units', 'pixels', ...
'Position', [12 82 430 19], ...
'String', 'Fisher Z-score transformation within the mask (zPrefix_DirectoryName.{hdr/img})');
set(handles.ckboxRetrend, ...
'Style', 'checkbox', ...
'Units', 'pixels', ...
'Position', [366 530 60 22], ...
'Enable', 'Off', ...
'String', 'Retrend');
set(handles.ckboxRemoveTrendBefore, ...
'Style', 'checkbox', ...
'Units', 'pixels', ...
'Position', [13 595 160 21],...
'String', 'detrend');
set(handles.ckboxRemoveTrendAfter, ...
'Style', 'checkbox', ...
'Units', 'pixels', ...
'Position', [171 595 140 21],...
'Visible', 'off', ...
'String', 'detrend AFTER Filter');
% --- EDIT TEXTS -------------------------------------
set(handles.edtOutputDir, ...
'Style', 'edit', ...
'Units', 'pixels', ...
'Position', [94 109 300 23], ...
'BackgroundColor', [1 1 1], ...
'String', 'Edit Text');
set(handles.edtDataDirectory, ...
'Style', 'edit', ...
'Units', 'pixels', ...
'Position', [94 373 300 22], ...
'BackgroundColor', [1 1 1], ...
'String', '');
set(handles.edtMaskfile, ...
'Style', 'edit', ...
'Units', 'pixels', ...
'Position', [94 275 300 23], ...
'BackgroundColor', [1 1 1], ...
'String', 'Default', ...
'Enable', 'off');
set(handles.edtPrefix, ...
'Style', 'edit', ...
'Units', 'pixels', ...
'Position', [94 142 115 22], ...
'BackgroundColor', [1 1 1], ...
'String', 'FCMap');
set(handles.edtBandLow, ...
'Style', 'edit', ...
'Units', 'pixels', ...
'Position', [94 531 50 22], ...
'BackgroundColor', [1 1 1], ...
'String', '0.01', ...
'Enable', 'off');
set(handles.edtBandHigh, ...
'Style', 'edit', ...
'Units', 'pixels', ...
'Position', [171 531 50 22], ...
'BackgroundColor', [1 1 1], ...
'String', '0.08', ...
'Enable', 'off');
set(handles.edtSamplePeriod, ...
'Style', 'edit', ...
'Units', 'pixels', ...
'Position', [276 531 50 22], ...
'BackgroundColor', [1 1 1], ...
'String', '2', ...
'Enable', 'off');
set(handles.edtCovariableFile, ...
'Style', 'edit', ...
'Units', 'pixels', ...
'Position', [94 235 300 23], ...
'BackgroundColor', [1 1 1], ...
'String', '', ...
'ForegroundColor', 'blue', ...
'Enable', 'on');
% --- LISTBOXES -------------------------------------
set(handles.listDataDirs, ...
'Style', 'listbox', ...
'Units', 'pixels', ...
'Position', [14 400 413 108], ...
'BackgroundColor', [1 1 1], ...
'String', '');
%20071103, Add context menu to Input Data Directories to add、delete、export、import……
handles.hContextMenu =uicontextmenu;
set(handles.listDataDirs, 'UIContextMenu', handles.hContextMenu);
uimenu(handles.hContextMenu, 'Label', 'Add a directory', 'Callback', get(handles.btnSelectDataDir, 'Callback'));
uimenu(handles.hContextMenu, 'Label', 'Remove selected directory', 'Callback', 'fc_gui(''DeleteSelectedDataDir'',gcbo,[], guidata(gcbo))');
uimenu(handles.hContextMenu, 'Label', 'Add recursively all sub-folders of a directory', 'Callback', 'fc_gui(''RecursiveAddDataDir'',gcbo,[], guidata(gcbo))');
uimenu(handles.hContextMenu, 'Label', '=============================');
uimenu(handles.hContextMenu, 'Label', 'Clear all data directories', 'Callback', 'fc_gui(''ClearDataDirectories'',gcbo,[], guidata(gcbo))');
% Save handles structure
guidata(hObject,handles);
%% Log options to a log file for further investigation, 20070507 before Computing
function Log2File(handles)
constLineSep= '-------------------------------------------------------------------------------';
[theVer, theRelease] =rest_misc( 'GetRestVersion');
theMsgVersion = sprintf('REST Version:%s, Release %s\r\n%s\r\n', theVer, theRelease, constLineSep);
theMsgHead = sprintf('Functional Connectivity computation log %s\r\n%s\r\n', rest_misc( 'GetDateTimeStr'), constLineSep);
theMsg =sprintf('%s\r\n%s\r\n\r\n%s', theMsgVersion, theMsgHead, constLineSep);
theMsg =sprintf('%s\r\nRemove Linear Trend options:\r\n%s\r\n\r\n%s',theMsg,...
LogRemoveLinearTrend(handles), constLineSep);
theMsg =sprintf('%s\r\nIdeal Band Pass filter options:\r\n%s\r\n\r\n%s',theMsg,...
LogBandPassFilter(handles), constLineSep);
theMsg =sprintf('%s\r\nFunctional Connectivity input parameters:\r\n%s\r\n\r\n%s', theMsg, ...
LogInputParameters(handles), constLineSep);
theMsg =sprintf('%s\r\nFunctional Connectivity output parameters:\r\n%s\r\n\r\n%s', theMsg, ...
LogOutputParameters(handles), constLineSep);
fid = fopen(handles.Log.Filename,'w');
if fid~=-1
fprintf(fid,'%s',theMsg);
fclose(fid);
else
errordlg(sprintf('Error to open log file:\n\n%s', handles.Log.Filename));
end
%Log the total elapsed time by once "Do all"
function LogPerformance(handles)
theMsg =sprintf('\r\n\r\nTotal elapsed time for Functional Connectivity Computing: %g seconds\r\n',handles.Performance);
fid = fopen(handles.Log.Filename,'r+');
fseek(fid, 0, 'eof');
if fid~=-1
fprintf(fid,'%s',theMsg);
fclose(fid);
else
errordlg(sprintf('Error to open log file:\n\n%s', handles.Log.Filename));
end
function ResultLogString=LogRemoveLinearTrend(handles)
ResultLogString ='';
ResultLogString =sprintf('%s\tremove linear trend BEFORE filter: %s\r\n',ResultLogString, handles.Detrend.BeforeFilter);
%ResultLogString =sprintf('%s\tremove linear trend AFTER filter: %s\r\n',ResultLogString, handles.Detrend.AfterFilter);
function ResultLogString=LogBandPassFilter(handles)
ResultLogString ='';
ResultLogString =sprintf('%s\tUse Filter: %s\r\n',ResultLogString, handles.Filter.UseFilter);
ResultLogString =sprintf('%s\tBand Low: %g\r\n', ResultLogString, handles.Filter.BandLow);
ResultLogString =sprintf('%s\tBand High: %g\r\n',ResultLogString, handles.Filter.BandHigh);
ResultLogString =sprintf('%s\tSample Period(i.e. TR): %g\r\n',ResultLogString, handles.Filter.SamplePeriod);
function ResultLogString=LogInputParameters(handles)
ResultLogString ='';
constLineSep= '-------------------------------------------------------------------------------';
theDataDirString= '';
theDataDirCells =get(handles.listDataDirs, 'string');
for x=1:length(theDataDirCells)
theDataDirString =sprintf('%s\r\n\t%s', theDataDirString, theDataDirCells{x});
end
theDirType ='';
if strcmpi(handles.Detrend.BeforeFilter, 'Yes')
theDirType =sprintf(' %s after Detrend processing', theDirType);
end
if strcmpi(handles.Detrend.BeforeFilter, 'Yes') && ...
strcmpi(handles.Filter.UseFilter, 'Yes'),
theDirType =sprintf(' %s and ', theDirType);
end
if strcmpi(handles.Filter.UseFilter, 'Yes')
theDirType =sprintf(' %s after Filter processing', theDirType);
end
ResultLogString =sprintf('%s\tInput Data Directories( %s): \r\n\t%s%s\r\n\t%s\r\n',ResultLogString,...
theDirType, ...
constLineSep, ...
theDataDirString, ...
constLineSep);
ResultLogString =sprintf('%s\tMask file: %s\r\n', ResultLogString, handles.Cfg.MaskFile);
%Functional Connectivity
ResultLogString =sprintf('%s\n\n\tFunctional Connectivity Parameters\r\n', ResultLogString);
%ROI Definition log
if iscell(handles.Cfg.ROIList),
for x=1:size(handles.Cfg.ROIList, 1),
ResultLogString =sprintf('%s\tROI Definition: \n\t\t%s\r\n', ResultLogString, handles.Cfg.ROIList{x});
end
else
ResultLogString =sprintf('%s\tROI Definition: \n\t\t%s\r\n', ResultLogString, handles.Cfg.ROIList);
end
%Covariable log
ResultLogString =sprintf('%s\tCovariables Definition File: \n\t\t%s\r\n', ResultLogString, handles.Covariables.ort_file);
ResultLogString =sprintf('%s\tCovariables Polort (Polynomial Orthogonal Degree): \n\t\t%d\r\n', ResultLogString, handles.Covariables.polort);
function ResultLogString=LogOutputParameters(handles)
ResultLogString ='';
ResultLogString =sprintf('%s\tPrefix to the Data directories: %s\r\n',ResultLogString, get(handles.edtPrefix, 'String'));
ResultLogString =sprintf('%s\tOutput Data Directories: %s\r\n',ResultLogString, handles.Cfg.OutputDir);
ResultLogString =sprintf('%s\tWant Fisher Z-score map transformation: %s \r\n',ResultLogString, handles.Cfg.WantFisherZMap);
%compose the log filename
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -