From: Andrew P. <av...@us...> - 2005-12-29 01:57:45
|
Update of /cvsroot/x-batch/x_batch In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26964 Modified Files: x_run_protocol.m Added Files: x_select_subject.fig x_select_subject.m Log Message: Created a custom GUI for selecting subjests. The pop-up menu was used before, but it does not work if there are too many subjects. Index: x_run_protocol.m =================================================================== RCS file: /cvsroot/x-batch/x_batch/x_run_protocol.m,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** x_run_protocol.m 8 Aug 2005 02:08:16 -0000 1.6 --- x_run_protocol.m 29 Dec 2005 01:57:36 -0000 1.7 *************** *** 38,42 **** % identified by his/her subject id, which MUST be unique constants; ! subject_id = spm_input('subject_id', '+1', 's', 'X2003'); ids = x_get_instances_ids('Subject', SUBJECT); % make sure subject ids are unique --- 38,42 ---- % identified by his/her subject id, which MUST be unique constants; ! subject_id = spm_input('subject_id', '+1', 's', 'Subject_ID'); ids = x_get_instances_ids('Subject', SUBJECT); % make sure subject ids are unique *************** *** 47,51 **** if strcmpi(subject_id, ids(i)) spm_input(['Subject with the id ' subject_id ' already exists!'], 1,'bd','OK') ! subject_id = spm_input('subject_id', '+1', 's', 'X2003'); check_again = 1; end; --- 47,51 ---- if strcmpi(subject_id, ids(i)) spm_input(['Subject with the id ' subject_id ' already exists!'], 1,'bd','OK') ! subject_id = spm_input('subject_id', '+1', 's', 'Subject_ID'); check_again = 1; end; *************** *** 99,103 **** subject_ids = sort(x_get_instances_ids('Subject', SUBJECT, ['Please choose a subject #' i])); ! subjects(i).subject_id = spm_input(['Please choose subject # ' num2str(i)], '2','m',subject_ids, subject_ids); subjects(i).subject_num = i; spm_input(['Subject ' num2str(i) ': ' subjects(i).subject_id{1}], 3 ,'d'); --- 99,105 ---- subject_ids = sort(x_get_instances_ids('Subject', SUBJECT, ['Please choose a subject #' i])); ! % subjects(i).subject_id = spm_input(['Please choose subject # ' num2str(i)], '-1','m',subject_ids, subject_ids); %changed to '+1' from '2' ! ! subjects(i).subject_id{1} = x_select_subject('Subject_IDs', subject_ids); subjects(i).subject_num = i; spm_input(['Subject ' num2str(i) ': ' subjects(i).subject_id{1}], 3 ,'d'); --- NEW FILE: x_select_subject.m --- function varargout = x_select_subject(varargin) % X_SELECT_SUBJECT M-file for x_select_subject.fig % X_SELECT_SUBJECT, by itself, creates a new X_SELECT_SUBJECT or raises the existing % singleton*. % % H = X_SELECT_SUBJECT returns the handle to a new X_SELECT_SUBJECT or the handle to % the existing singleton*. % % X_SELECT_SUBJECT('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in X_SELECT_SUBJECT.M with the given input arguments. % % X_SELECT_SUBJECT('Property','Value',...) creates a new X_SELECT_SUBJECT or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before x_select_subject_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to x_select_subject_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 x_select_subject % Last Modified by GUIDE v2.5 28-Dec-2005 12:36:08 % Begin initialization code - DO NOT EDITmfilename gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @x_select_subject_OpeningFcn, ... 'gui_OutputFcn', @x_select_subject_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 x_select_subject is made visible. function x_select_subject_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 x_select_subject (see VARARGIN) %varargin{1}; this is a string that is not being used %varargin{2}; a cell array on subject IDs % Choose default command line output for x_select_subject handles.output = hObject; set(hObject, 'Name', 'Select a Subject'); set(handles.listbox1, 'String', deblank(varargin{2}) ); % Update handles structure guidata(hObject, handles); % UIWAIT makes x_select_subject wait for user response (see UIRESUME) uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = x_select_subject_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; if isequal(get(handles.figure1, 'waitstatus'), 'waiting') % The GUI is still in UIWAIT, us UIRESUME uiresume(handles.figure1); else % The GUI is no longer waiting, just close it delete(handles.figure1); end %uiresume(handles.figure1); %delete(handles.figure1); %closereq; % --- Executes during object creation, after setting all properties. function listbox1_CreateFcn(hObject, eventdata, handles) % hObject handle to listbox1 (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 set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on selection change in listbox1. function listbox1_Callback(hObject, eventdata, handles) % hObject handle to listbox1 (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 listbox1 contents as cell array % contents{get(hObject,'Value')} returns selected item from listbox1 contents = get(handles.listbox1,'String'); val = contents{get(handles.listbox1, 'Value')}; handles.output = val; % Update handles structure guidata(hObject, handles); % --- Executes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) x_select_subject_OutputFcn(hObject, eventdata, handles); --- NEW FILE: x_select_subject.fig --- (This appears to be a binary file; contents omitted.) |