From: Xenia H. <sa...@us...> - 2005-05-24 03:27:57
|
Update of /cvsroot/x-batch/x_batch In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4474 Modified Files: x_contrasts.fig x_contrasts.m x_new_contrast.fig x_new_contrast.m Log Message: New interface for defining new contrasts, version 1... Index: x_new_contrast.fig =================================================================== RCS file: /cvsroot/x-batch/x_batch/x_new_contrast.fig,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsa7qdN1 and /tmp/cvsWCUqMq differ Index: x_contrasts.fig =================================================================== RCS file: /cvsroot/x-batch/x_batch/x_contrasts.fig,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsr7gHC4 and /tmp/cvsSusKDt differ Index: x_contrasts.m =================================================================== RCS file: /cvsroot/x-batch/x_batch/x_contrasts.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** x_contrasts.m 9 Apr 2005 06:45:41 -0000 1.2 --- x_contrasts.m 24 May 2005 03:27:47 -0000 1.3 *************** *** 10,14 **** % contrast. See x_new_contrast for what 'contrast' is % ! % Last Modified by GUIDE v2.5 31-Mar-2005 20:39:29 % Begin initialization code - DO NOT EDIT --- 10,14 ---- % contrast. See x_new_contrast for what 'contrast' is % ! % Last Modified by GUIDE v2.5 22-May-2005 18:34:18 % Begin initialization code - DO NOT EDIT *************** *** 47,50 **** --- 47,56 ---- set(handles.radiobuttonT, 'Value', 0); + set(handles.T_new, 'Value', 1); + set(handles.F_new, 'Value', 0); + + set(handles.rows_edit, 'String', 1); + set(handles.cols_edit, 'String', 10); + *************** *** 63,112 **** contrast_struct(1).conmatrix = []; - % note that these should be in the same order as in final SPM.xCon - % these loops are here just to generate future contrast's names - % there is very likely a better way to eliminate duplicate contrasts (i.e., - % trial 2xtrial 1 when we already have trial 1x trial2) rather than those - % dreadful loops, but I cannot think of one now - %if(isfield(SPM, 'Sess')) - % num = 2; %because num 1 is the 'effects of interest - % for s = 1:length(SPM.Sess) - % num_mat = []; - % OK = 1; - % for i = 1:length(SPM.Sess(s).Fc) - % str = SPM.Sess(s).Fc(i).name; - % contrast_struct(num).name = sprintf('Sess(%d):%s',s,SPM.Sess(s).Fc(i).name); - % contrast_struct(num).contrast = []; - % contrast_struct(num).STAT = 'F'; - % contrast_struct(num).include = 0; - % contrast_struct(num).conmatrix = []; - % num = num +1; - % end - % - % for i = 1:length(SPM.Sess(s).Fc) - % for j = 1:length(SPM.Sess(s).Fc); - % num_mat = [num_mat; i j]; - % compare_mat = [j i]; - % OK = 1; - % % for x = 1:size(num_mat,1) - % % if(num_mat(x, :) == compare_mat & i~=j) - % % OK = 0; - % % end - % % end - % if(OK) - % str = sprintf('Sess(%d):%s',s, [SPM.Sess(s).Fc(i).name 'x' SPM.Sess(s).Fc(j).name]); - % - % contrast_struct(num).name = str; - % contrast_struct(num).contrast = []; - % contrast_struct(num).STAT = 'F'; - % contrast_struct(num).include = 0; - % contrast_struct(num).conmatrix = []; - % num = num +1; - - % end - % end - % end - % end - %end - % note that these will be in te same order as in final SPM.xCon %if isfield(SPM,'Sess') --- 69,72 ---- *************** *** 263,268 **** % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) - x_new_contrast; %update the list: --- 223,236 ---- % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) + rows = get(handles.rows_edit, 'String'); rows = str2num(rows); + cols = get(handles.cols_edit, 'String'); cols = str2num(cols); + t = get(handles.T_new, 'Value'); + f = get(handles.F_new, 'Value'); + if(t) + x_new_contrast(1, cols, 'T'); %T-contrast, one ONE ROW + else + x_new_contrast(rows, cols, 'F'); %however many rows you want... + end; %update the list: *************** *** 274,278 **** - % --- Executes on button press in radiobuttonAll. function radiobuttonAll_Callback(hObject, eventdata, handles) --- 242,245 ---- *************** *** 292,293 **** --- 259,333 ---- + % --- Executes during object creation, after setting all properties. + function rows_edit_CreateFcn(hObject, eventdata, handles) + % hObject handle to rows_edit (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')); + end + + + + function rows_edit_Callback(hObject, eventdata, handles) + % hObject handle to rows_edit (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 rows_edit as text + % str2double(get(hObject,'String')) returns contents of rows_edit as a double + + + % --- Executes during object creation, after setting all properties. + function cols_edit_CreateFcn(hObject, eventdata, handles) + % hObject handle to cols_edit (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')); + end + + + + function cols_edit_Callback(hObject, eventdata, handles) + % hObject handle to cols_edit (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 cols_edit as text + % str2double(get(hObject,'String')) returns contents of cols_edit as a double + + + % --- Executes on button press in F_new. + function F_new_Callback(hObject, eventdata, handles) + % hObject handle to F_new (see GCBO) + % eventdata reserved - to be defined in a future version of MATLAB + % handles structure with handles and user data (see GUIDATA) + + % Hint: get(hObject,'Value') returns toggle state of F_new + %first, 'unselect' the T button + set(handles.T_new, 'Value', 0); + + % --- Executes on button press in T_new. + function T_new_Callback(hObject, eventdata, handles) + % hObject handle to T_new (see GCBO) + % eventdata reserved - to be defined in a future version of MATLAB + % handles structure with handles and user data (see GUIDATA) + + % Hint: get(hObject,'Value') returns toggle state of T_new + + %first, 'unselect' the F button + set(handles.F_new, 'Value', 0); + + + Index: x_new_contrast.m =================================================================== RCS file: /cvsroot/x-batch/x_batch/x_new_contrast.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** x_new_contrast.m 9 Apr 2005 06:45:41 -0000 1.2 --- x_new_contrast.m 24 May 2005 03:27:47 -0000 1.3 *************** *** 11,15 **** % Edit the above text to modify the response to help x_new_contrast ! % Last Modified by GUIDE v2.5 27-Mar-2005 12:33:37 % Begin initialization code - DO NOT EDIT --- 11,15 ---- % Edit the above text to modify the response to help x_new_contrast ! % Last Modified by GUIDE v2.5 21-May-2005 16:01:41 % Begin initialization code - DO NOT EDIT *************** *** 37,40 **** --- 37,54 ---- function x_new_contrast_OpeningFcn(hObject, eventdata, handles, varargin) global contrast_struct; + global x_pos; + global y_pos; + global rows; + global cols; + global stat; + global controls; + global controls_index; + + + rows = varargin{1}; + cols = varargin{2}; + stat = varargin{3}; + %rows = rows(1,1) + %cols = cols(1,1) % This function has no output args, see OutputFcn. % hObject handle to figure *************** *** 50,53 **** --- 64,110 ---- guidata(hObject, handles); set(handles.radiobuttonF, 'Value', 1); + col_nums = zeros(300, 1); + controls = zeros(300, 300); + + %PF = spm_platform('fonts'); + + x_pos = 7; + y_pos = 425; + %controls_index = cols; + + % make the little boxes with the columns + for i = 1:33 + col_nums(i) = uicontrol(hObject,'Style', 'Edit', ... + 'String',num2str(i),... + 'FontSize', 8, ... + 'BackgroundColor', 'white',... + 'ForegroundColor', [0 0 0 ], ... + 'FontWeight', 'bold', ... + 'Position',[x_pos y_pos 025 017],... + 'Interruptible','off',... + 'ForegroundColor','b'); + % set(handles.edit_weights, 'String', strcat(get(handles.edit_weights, 'String'), ' difhdfioh ')) + x_pos = x_pos+21; + end; + + % now create the columns with 0's to represent contrasts... + x_pos = 7; + y_pos = 400; + for i = 1:rows + for j = 1:cols + controls(i, j) = uicontrol(hObject,'Style', 'Edit', ... + 'String','0',... + 'FontSize', 8, ... + 'ForegroundColor', [0 0 0], ... + 'Position',[x_pos y_pos 025 017],... + 'Interruptible','off',... + 'ForegroundColor','b'); + % set(handles.edit_weights, 'String', strcat(get(handles.edit_weights, 'String'), ' difhdfioh ')) + x_pos = x_pos+21; + end + y_pos = y_pos - 19; + x_pos = 7; + end; + % UIWAIT makes x_new_contrast wait for user response (see UIRESUME) uiwait(handles.figure1); *************** *** 245,249 **** % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) ! % --- Executes on button press in pushbutton_save. function pushbutton_save_Callback(hObject, eventdata, handles) --- 302,306 ---- % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) ! closereq; % --- Executes on button press in pushbutton_save. function pushbutton_save_Callback(hObject, eventdata, handles) *************** *** 253,295 **** % TODO: error checking. Do not let save if names or contrasts are EMPTY global contrast_struct; name = get(handles.edit_name, 'String'); ! weights = get(handles.edit_weights, 'String'); cnum = []; maxSize = 0; - % this is to avoid counting 'empty chars' in size (since they would all go - % away when converted to numbers - for i = 1:size(weights, 1) - tmp = str2num(weights(i, :)); - if(size(tmp, 2) > maxSize) - maxSize = size(tmp, 2); - end - end - - %length(weights(:,1)); ! contrasts = zeros(length(weights(:, 1)), maxSize); ! % create a square matrix, 'translating' string input from the edit box to ! % a double matrix ! for i = 1:length(weights(:, 1)) ! tmp = str2num(weights(i, :)); ! contrasts(i, 1:size(tmp,2)) = tmp; end ! stat = 'T'; ! if(get(handles.radiobuttonF, 'Value')) ! stat = 'F'; ! end ! %contrast_struct(1).name = name; ! %contrast_struct(1).contrast = contrasts; ! %contrast_struct(1).STAT = stat; if(isempty(contrast_struct)) - % contrast_struct = struct('name', name, 'contrast', contrasts, 'STAT', stat, 'include', 0,'conmatrix', []); contrast_struct = struct('name', name, 'contrast', weights, 'STAT', stat, 'include', 0,'conmatrix', []); else - % temp_contrast = struct('name', name, 'contrast', contrasts, 'STAT', stat, 'include', 0, 'conmatrix', []); temp_contrast = struct('name', name, 'contrast', weights, 'STAT', stat, 'include', 0, 'conmatrix', []); contrast_struct(end + 1) = temp_contrast; end varargout{2} = contrast_struct; delete(handles.output); --- 310,350 ---- % TODO: error checking. Do not let save if names or contrasts are EMPTY global contrast_struct; + global rows; + global cols; + global controls; + global stat; + name = get(handles.edit_name, 'String'); ! ! if(isempty(name)) ! set(handles.edit_name, 'ForegroundColor', 'red', 'String', 'Please enter the name'); ! return; ! end cnum = []; maxSize = 0; ! %stat = 'T'; ! %if(get(handles.radiobuttonF, 'Value')) ! % stat = 'F'; ! %end ! values = ones(rows, cols); ! %get the values: ! for r = 1:rows ! for c = 1:cols ! str2num(get(controls(r,c), 'String')); ! values(r,c) = str2num(get(controls(r,c), 'String')); ! end end ! weights = num2str(values); ! if(isempty(contrast_struct)) contrast_struct = struct('name', name, 'contrast', weights, 'STAT', stat, 'include', 0,'conmatrix', []); else temp_contrast = struct('name', name, 'contrast', weights, 'STAT', stat, 'include', 0, 'conmatrix', []); contrast_struct(end + 1) = temp_contrast; end + varargout{2} = contrast_struct; delete(handles.output); *************** *** 385,386 **** --- 440,501 ---- set(handles.edit_weights, 'String', ' '); + + % --- Executes on button press in pushbutton4. + function pushbutton4_Callback(hObject, eventdata, handles) + % hObject handle to pushbutton4 (see GCBO) + % eventdata reserved - to be defined in a future version of MATLAB + % handles structure with handles and user data (see GUIDATA) + + + % --- Executes during object creation, after setting all properties. + function slider2_CreateFcn(hObject, eventdata, handles) + % hObject handle to slider2 (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, change + % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. + usewhitebg = 1; + if usewhitebg + set(hObject,'BackgroundColor',[.9 .9 .9]); + else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); + end + + + % --- Executes on slider movement. + function slider2_Callback(hObject, eventdata, handles) + % hObject handle to slider2 (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,'Value') returns position of slider + % get(hObject,'Min') and get(hObject,'Max') to determine range of slider + + + % --- Executes during object creation, after setting all properties. + function slider3_CreateFcn(hObject, eventdata, handles) + % hObject handle to slider3 (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, change + % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. + usewhitebg = 1; + if usewhitebg + set(hObject,'BackgroundColor',[.9 .9 .9]); + else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); + end + + + % --- Executes on slider movement. + function slider3_Callback(hObject, eventdata, handles) + % hObject handle to slider3 (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,'Value') returns position of slider + % get(hObject,'Min') and get(hObject,'Max') to determine range of slider + + |