Skip to content

Commit d340f56

Browse files
authored
Merge pull request #55 from DIDSR/registrationInterface
Registration interface 1. Edit code for dynamic start and stop. It is available for all tasks and input files 2. Update all input files for autoreg and WSI scale. 3. Add GetExecutableFolder.m function to solve the short cut problem 4. Solve compiled version random order problem.
2 parents 896b764 + 2acf257 commit d340f56

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2152
-629
lines changed

src/Administrator_Input_Screen.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ function Administrator_Input_Screen_OpeningFcn(hObject, eventdata, handles, vara
3939
% that the window of this GUI is positioned to the exact center of the
4040
% screen regardsless of the screen size of aspect ratio.
4141
%--------------------------------------------------------------------------
42-
42+
ExecutableFolder = GetExecutableFolder();
43+
cd(ExecutableFolder);
4344
handles.output = hObject;
4445
modes=get(handles.ModeSelectionPopUpMenu,'String'); %#ok<NASGU>
4546

@@ -51,7 +52,8 @@ function Administrator_Input_Screen_OpeningFcn(hObject, eventdata, handles, vara
5152
handles.myData.wsi_files = [];
5253
handles.myData.graphics = struct;
5354

54-
addpath('gui_graphics', 'icc_profiles', 'tasks','stages/Prior','stages/Ludl');
55+
%addpath('gui_graphics', 'icc_profiles', 'tasks','stages/Prior','stages/Ludl');
56+
addpath('icc_profiles', 'tasks','stages/Prior','stages/Ludl');
5557

5658
handles.myData.sourcedir = [cd, '\'];
5759

src/Camera_stage_review.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ function Camera_stage_review_OpeningFcn(hObject, eventdata, handles, varargin)
5454
% varargin command line arguments to Camera_stage_review (see VARARGIN)
5555

5656
% Choose default command line output for Camera_stage_review
57+
ExecutableFolder = GetExecutableFolder();
58+
cd(ExecutableFolder);
5759
desc = {'\bfWelcome'...
5860
,'Please choose the camera format'};
5961
welcome_page(handles,desc );

src/GUI.m

Lines changed: 180 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ function GUI_OpeningFcn(hObj, eventdata, handles, varargin)
180180
% The mode_index and the filename for the test are extracted from the
181181
% cell structure varargin. varargin stores the input arguments for the
182182
% whole Matlab application
183-
addpath('gui_graphics', 'icc_profiles', 'tasks','stages/Prior','stages/Ludl');
183+
%addpath('gui_graphics', 'icc_profiles', 'tasks','stages/Prior','stages/Ludl');
184+
addpath('icc_profiles', 'tasks','stages/Prior','stages/Ludl');
184185
handles_old = varargin{1};
185186
handles.Administrator_Input_Screen = handles_old.Administrator_Input_Screen;
186187
myData = handles_old.myData;
@@ -189,10 +190,10 @@ function GUI_OpeningFcn(hObj, eventdata, handles, varargin)
189190
handles.current = struct;
190191
% The images used in the GUI are loaded into the memory and into the
191192
% structure myData
192-
myData.graphics.zooming_allowed=imread('zooming_allowed.bmp');
193-
myData.graphics.zooming_not_allowed=imread('zooming_not_allowed.bmp');
194-
myData.graphics.moving_allowed=imread('moving_allowed.bmp');
195-
myData.graphics.moving_not_allowed=imread('moving_not_allowed.bmp');
193+
% myData.graphics.zooming_allowed=imread('zooming_allowed.bmp');
194+
% myData.graphics.zooming_not_allowed=imread('zooming_not_allowed.bmp');
195+
% myData.graphics.moving_allowed=imread('moving_allowed.bmp');
196+
% myData.graphics.moving_not_allowed=imread('moving_not_allowed.bmp');
196197

197198
% save myData
198199
handles.myData = myData;
@@ -364,21 +365,21 @@ function Initiate_GUI_Elements(handles)
364365

365366
% The image objects for the indicators for panning and zooming are
366367
% created
367-
handles.zooming_indication=...
368-
image(myData.graphics.zooming_not_allowed,'Parent',handles.ZoomingInfoImage);
369-
set(handles.zooming_indication,'visible','off');
370-
handles.moving_indication=...
371-
image(myData.graphics.moving_not_allowed,'Parent',handles.PanningInfoImage);
372-
set(handles.moving_indication,'visible','off');
373-
374-
set(handles.ZoomingInfoImage, ...
375-
'xtick', [], ...
376-
'ytick', [], ...
377-
'Visible','off');
378-
set(handles.PanningInfoImage, ...
379-
'xtick', [], ...
380-
'ytick', [], ...
381-
'Visible','off');
368+
% handles.zooming_indication=...
369+
% image(myData.graphics.zooming_not_allowed,'Parent',handles.ZoomingInfoImage);
370+
% set(handles.zooming_indication,'visible','off');
371+
% handles.moving_indication=...
372+
% image(myData.graphics.moving_not_allowed,'Parent',handles.PanningInfoImage);
373+
% set(handles.moving_indication,'visible','off');
374+
%
375+
% set(handles.ZoomingInfoImage, ...
376+
% 'xtick', [], ...
377+
% 'ytick', [], ...
378+
% 'Visible','off');
379+
% set(handles.PanningInfoImage, ...
380+
% 'xtick', [], ...
381+
% 'ytick', [], ...
382+
% 'Visible','off');
382383

383384
% Foreground color, background color and the background color of the
384385
% axes is adjusted in accordance with the settings acquired from the
@@ -484,14 +485,19 @@ function NextButtonPressed(hObj, eventdata, handles) %#ok<DEFNU>
484485
taskinfo.duration = etime(handles.myData.EndTime, handles.myData.StartTime)+taskinfo.duration;
485486
handles.myData.tasks_out{handles.myData.iter} = taskinfo;
486487
guidata(handles.GUI, handles);
487-
% Close out completed task
488+
488489
st = dbstack;
489-
if ~strcmp(st(2).name,'Backbutton_Callback')
490+
% exort output file
491+
if ~strcmp(st(2).name,'Backbutton_Callback')
492+
490493
taskinfo.calling_function = st(1).name;
491494
handles.myData.taskinfo = taskinfo;
492495
guidata(handles.GUI, handles);
493496
taskinfo.task_handle(handles.GUI);
494497
handles = guidata(handles.GUI);
498+
exportOutput(handles.GUI);
499+
handles = guidata(handles.GUI);
500+
495501
end
496502
% If the completed task was a 'finish' task, then return
497503
switch taskinfo.id
@@ -569,10 +575,12 @@ function NextButtonPressed(hObj, eventdata, handles) %#ok<DEFNU>
569575
moveEndTime = clock;
570576
taskinfo.durationMove = etime(moveEndTime, moveStartTime);
571577
%auto fast register
572-
autoRegStartTime = clock;
573-
Fast_Register_Button_Callback(hObj, eventdata, handles);
574-
autoRegEndTime = clock;
575-
taskinfo.durationAutoReg = etime(autoRegEndTime,autoRegStartTime);
578+
if myData.settings.autoreg == 1
579+
autoRegStartTime = clock;
580+
Fast_Register_Button_Callback(hObj, eventdata, handles);
581+
autoRegEndTime = clock;
582+
taskinfo.durationAutoReg = etime(autoRegEndTime,autoRegStartTime);
583+
end
576584

577585
end
578586
end
@@ -644,7 +652,43 @@ function abortbutton_Callback(hObject, eventdata, handles) %#ok<DEFNU>
644652
% hObject handle to abortbutton (see GCBO)
645653
% eventdata reserved - to be defined in a future version of MATLAB
646654
% handles structure with handles and user data (see GUIDATA)
647-
655+
% Save and export current task information
656+
% myData=handles.myData;
657+
% taskinfo = myData.tasks_out{myData.iter};
658+
% guidata(handles.GUI, handles);
659+
% switch taskinfo.id
660+
% case 'finish'
661+
%
662+
% close all force
663+
% return
664+
%
665+
% end
666+
% st = dbstack;
667+
% taskinfo.calling_function = st(1).name;
668+
% handles.myData.taskinfo = taskinfo;
669+
% guidata(handles.GUI, handles);
670+
% taskinfo.task_handle(handles.GUI);
671+
% handles = guidata(handles.GUI);
672+
%
673+
% % Save and export rest task information
674+
% while(handles.myData.iter<=handles.myData.ntasks)
675+
% handles.myData.iter = handles.myData.iter+1;
676+
% guidata(handles.GUI, handles);
677+
% taskinfo = handles.myData.tasks_out{handles.myData.iter};
678+
% taskinfo.calling_function = st(1).name;
679+
% handles.myData.taskinfo = taskinfo;
680+
% guidata(handles.GUI,handles);
681+
% taskinfo.task_handle(handles.GUI);
682+
% handles = guidata(handles.GUI);
683+
% % If the current task is 'finish' task, then return
684+
% switch taskinfo.id
685+
% case 'finish'
686+
% Update_GUI_Elements(handles);
687+
% return
688+
%
689+
% end
690+
% end
691+
% fclose(handles.myData.fid);
648692
close all force
649693

650694
catch ME
@@ -836,70 +880,70 @@ function GUI_WindowButtonMotionFcn(hObject, eventdata, handles)
836880
% handles structure with handles and user data (see GUIDATA)
837881
end
838882

839-
function winBtnMotionFcn(hObj,eventdata,handles) %#ok<DEFNU>
840-
try
841-
%----------------------------------------------------------------------
842-
% winBtnMotionFcn (nested under winBtnDownFcn)
843-
% This function is called when click-n-drag (panning) is happening
844-
%----------------------------------------------------------------------
845-
pt = get(handles.ImageAxes, 'currentpoint');
846-
847-
% Update axes limits and automatically set ticks
848-
% Set aspect ratios
849-
set(handles.ImageAxes, ...
850-
'xlim', get(handles.ImageAxes, 'xlim') + ...
851-
(handles.panning_Zooming_Tool.xy(1,1)-(pt(1,1)+pt(2,1))/2), ...
852-
'ylim', get(handles.ImageAxes, 'ylim') + ...
853-
(handles.panning_Zooming_Tool.xy(1,2)-(pt(1,2)+pt(2,2))/2), ...
854-
'cameraviewanglemode', 'auto', ...
855-
'plotboxaspectratio', handles.panning_Zooming_Tool.pbar);
856-
857-
guidata(hObj, handles);
858-
catch ME
859-
error_show(ME)
860-
end
861-
end
883+
% function winBtnMotionFcn(hObj,eventdata,handles) %#ok<DEFNU>
884+
% try
885+
% %----------------------------------------------------------------------
886+
% % winBtnMotionFcn (nested under winBtnDownFcn)
887+
% % This function is called when click-n-drag (panning) is happening
888+
% %----------------------------------------------------------------------
889+
% pt = get(handles.ImageAxes, 'currentpoint');
890+
%
891+
% % Update axes limits and automatically set ticks
892+
% % Set aspect ratios
893+
% set(handles.ImageAxes, ...
894+
% 'xlim', get(handles.ImageAxes, 'xlim') + ...
895+
% (handles.panning_Zooming_Tool.xy(1,1)-(pt(1,1)+pt(2,1))/2), ...
896+
% 'ylim', get(handles.ImageAxes, 'ylim') + ...
897+
% (handles.panning_Zooming_Tool.xy(1,2)-(pt(1,2)+pt(2,2))/2), ...
898+
% 'cameraviewanglemode', 'auto', ...
899+
% 'plotboxaspectratio', handles.panning_Zooming_Tool.pbar);
900+
%
901+
% guidata(hObj, handles);
902+
% catch ME
903+
% error_show(ME)
904+
% end
905+
% end
862906

863-
function zoomMotionFcn(hObj,eventdata,handles) %#ok<DEFNU>
864-
try
865-
%----------------------------------------------------------------------
866-
% zoomMotionFcn (nested under winBtnDownFcn)
867-
% This performs the click-n-drag zooming function. The pointer
868-
% location relative to the initial point determines the amount of
869-
% zoom (in or out).
870-
%----------------------------------------------------------------------
871-
C = 50;
872-
pt = get(handles.GUI, 'currentpoint');
873-
r = C ^ (10*(handles.panning_Zooming_Tool.initPt(2) ...
874-
- pt(2)) / handles.panning_Zooming_Tool.figPos(4));
875-
newLimSpan = r * handles.panning_Zooming_Tool.curPt2;
876-
dTemp = diff(newLimSpan); %#ok<NASGU>
877-
pt(1) = handles.panning_Zooming_Tool.initPt(1);
878-
879-
% Determine new limits based on r
880-
lims = handles.panning_Zooming_Tool.curPt + newLimSpan;
881-
882-
% Update axes limits and automatically set ticks
883-
% Set aspect ratios
884-
set(handles.ImageAxes, ...
885-
'xlim', lims(:,1), ...
886-
'ylim', lims(:,2), ...
887-
'cameraviewanglemode', 'auto', ...
888-
'plotboxaspectratio', handles.panning_Zooming_Tool.pbar);
889-
890-
% Update zoom indicator line
891-
set(handles.ZoomLine, ...
892-
'xdata', [handles.panning_Zooming_Tool.initPt(1), ...
893-
pt(1)]/handles.panning_Zooming_Tool.figPos(3), ...
894-
'ydata', [handles.panning_Zooming_Tool.initPt(2), ...
895-
pt(2)]/handles.panning_Zooming_Tool.figPos(4));
896-
897-
guidata(hObj, handles);
898-
899-
catch ME
900-
error_show(ME)
901-
end
902-
end
907+
% function zoomMotionFcn(hObj,eventdata,handles) %#ok<DEFNU>
908+
% try
909+
% %----------------------------------------------------------------------
910+
% % zoomMotionFcn (nested under winBtnDownFcn)
911+
% % This performs the click-n-drag zooming function. The pointer
912+
% % location relative to the initial point determines the amount of
913+
% % zoom (in or out).
914+
% %----------------------------------------------------------------------
915+
% C = 50;
916+
% pt = get(handles.GUI, 'currentpoint');
917+
% r = C ^ (10*(handles.panning_Zooming_Tool.initPt(2) ...
918+
% - pt(2)) / handles.panning_Zooming_Tool.figPos(4));
919+
% newLimSpan = r * handles.panning_Zooming_Tool.curPt2;
920+
% dTemp = diff(newLimSpan); %#ok<NASGU>
921+
% pt(1) = handles.panning_Zooming_Tool.initPt(1);
922+
%
923+
% % Determine new limits based on r
924+
% lims = handles.panning_Zooming_Tool.curPt + newLimSpan;
925+
%
926+
% % Update axes limits and automatically set ticks
927+
% % Set aspect ratios
928+
% set(handles.ImageAxes, ...
929+
% 'xlim', lims(:,1), ...
930+
% 'ylim', lims(:,2), ...
931+
% 'cameraviewanglemode', 'auto', ...
932+
% 'plotboxaspectratio', handles.panning_Zooming_Tool.pbar);
933+
%
934+
% % Update zoom indicator line
935+
% set(handles.ZoomLine, ...
936+
% 'xdata', [handles.panning_Zooming_Tool.initPt(1), ...
937+
% pt(1)]/handles.panning_Zooming_Tool.figPos(3), ...
938+
% 'ydata', [handles.panning_Zooming_Tool.initPt(2), ...
939+
% pt(2)]/handles.panning_Zooming_Tool.figPos(4));
940+
%
941+
% guidata(hObj, handles);
942+
%
943+
% catch ME
944+
% error_show(ME)
945+
% end
946+
% end
903947

904948
function GUI_WindowButtonUpFcn(hObj, eventdata, handles) %#ok<DEFNU>
905949
try
@@ -1178,3 +1222,49 @@ function Reticlebutton_Callback(hObject, eventdata, handles)
11781222
end
11791223

11801224

1225+
function exportOutput(hObj)
1226+
try
1227+
handles = guidata(hObj);
1228+
st = dbstack;
1229+
myData = handles.myData;
1230+
exportIter = 1;
1231+
while exportIter <= myData.finshedTask+1
1232+
1233+
taskinfo = myData.tasks_out{exportIter};
1234+
taskinfo.currentWorking = -1;
1235+
% handles.myData.tasks_out{handles.myData.iter} = taskinfo;
1236+
taskinfo.calling_function = st(1).name;
1237+
handles.myData.taskinfo = taskinfo;
1238+
guidata(handles.GUI, handles);
1239+
taskinfo.task_handle(handles.GUI);
1240+
handles = guidata(handles.GUI);
1241+
exportIter = exportIter +1;
1242+
end
1243+
1244+
1245+
while(exportIter<=handles.myData.ntasks+1)
1246+
1247+
taskinfo = handles.myData.tasks_out{exportIter};
1248+
if exportIter <= handles.myData.iter
1249+
taskinfo.currentWorking = 1;
1250+
else
1251+
taskinfo.currentWorking = 0;
1252+
end
1253+
taskinfo.calling_function = st(1).name;
1254+
handles.myData.taskinfo = taskinfo;
1255+
guidata(handles.GUI,handles);
1256+
taskinfo.task_handle(handles.GUI);
1257+
handles = guidata(handles.GUI);
1258+
exportIter = exportIter+1;
1259+
% If the current task is 'finish' task, then return
1260+
switch taskinfo.id
1261+
case 'finish'
1262+
Update_GUI_Elements(handles);
1263+
return
1264+
end
1265+
end
1266+
fclose(handles.myData.fid);
1267+
catch ME
1268+
error_show(ME)
1269+
end
1270+
end

src/GetExecutableFolder.m

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
function [executableFolder] = GetExecutableFolder()
2+
try
3+
if isdeployed
4+
% User is running an executable in standalone mode.
5+
[status, result] = system('set PATH');
6+
executableFolder = char(regexpi(result, 'Path=(.*?);', 'tokens', 'once'));
7+
% fprintf(1, '\nIn function GetExecutableFolder(), currentWorkingDirectory = %s\n', executableFolder);
8+
else
9+
% User is running an m-file from the MATLAB integrated development environment (regular MATLAB).
10+
executableFolder = pwd;
11+
end
12+
catch ME
13+
errorMessage = sprintf('Error in function %s() at line %d.\n\nError Message:\n%s', ...
14+
ME.stack(1).name, ME.stack(1).line, ME.message);
15+
uiwait(warndlg(errorMessage));
16+
end
17+
return;
18+
end

0 commit comments

Comments
 (0)