Skip to content

Commit b8f0496

Browse files
committed
create new folder for stage functions.
create 'ludl' and 'prior' subfolder for each system. In main directory, create if statement in stage functions to switch between systems
1 parent 9b3576c commit b8f0496

26 files changed

+403
-408
lines changed

Administrator_Input_Screen.m

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function Administrator_Input_Screen_OpeningFcn(hObject, eventdata, handles, vara
5151
handles.myData.wsi_files = [];
5252
handles.myData.graphics = struct;
5353

54-
addpath('gui_graphics', 'icc_profiles', 'tasks');
54+
addpath('gui_graphics', 'icc_profiles', 'tasks','stages/Prior','stages/Ludl');
5555

5656
handles.myData.sourcedir = [cd, '\'];
5757

@@ -215,7 +215,6 @@ function ExtractROIsButtonPressed(hObject, eventdata, handles) %#ok<DEFNU>
215215
handles.myData.tasks_out{i} = taskinfo;
216216

217217
end
218-
219218
guidata(handles.Administrator_Input_Screen, handles);
220219
close(wtb);
221220

@@ -442,25 +441,15 @@ function align_eye_cam(handles) %#ok<*INUSD>
442441

443442
function position_eye_callback(hObject, eventdata) %#ok<*INUSD>
444443
handles = guidata(findobj('Tag','Administrator_Input_Screen'));
445-
stage_label = handles.myData.stage.label;
446-
if strcmp(stage_label(end-4:end),'Prior')
447-
stage=stage_get_pos_prior(handles.myData.stage);
448-
else
449-
stage=stage_get_pos(handles.myData.stage);
450-
end
444+
stage=stage_get_pos(handles.myData.stage);
451445
Pos=stage.Pos;
452446
set(hObject, 'UserData', Pos);
453447

454448
end
455449

456450
function position_cam_callback(hObject, eventdata)
457451
handles = guidata(findobj('Tag','Administrator_Input_Screen'));
458-
stage_label = handles.myData.stage.label;
459-
if strcmp(stage_label(end-4:end),'Prior')
460-
stage=stage_get_pos_prior(handles.myData.stage);
461-
else
462-
stage=stage_get_pos(handles.myData.stage);
463-
end
452+
stage=stage_get_pos(handles.myData.stage);
464453
Pos=stage.Pos;
465454
set(hObject, 'UserData', Pos);
466455

@@ -538,12 +527,7 @@ function ModeSelectionPopUpMenu_Callback(hObject, eventdata, handles) %#ok<DEFNU
538527
set(hObject_configure_camera, ...
539528
'Enable', 'on', ...
540529
'String', 'Configure Camera');
541-
stage_label = handles.myData.stage.label;
542-
if strcmp(stage_label(end-4:end),'Prior')
543-
handles.myData.stage = stage_get_pos_prior(handles.myData.stage);
544-
else
545-
handles.myData.stage = stage_get_pos(handles.myData.stage); %#ok<NASGU>
546-
end
530+
handles.myData.stage = stage_get_pos(handles.myData.stage); %#ok<NASGU>
547531
if handles.myData.stage.Pos == 0
548532
return
549533
end

Camera_stage_review.m

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,7 @@ function Take_image_Callback(hObject, eventdata, handles)
9595

9696
img=camera_take_image(handles.cam);
9797
if handles.stageflag==1
98-
if strcmp(handles.mode_desc(end-4:end),'Prior')
99-
handles.stage = stage_get_pos_prior(handles.stage);
100-
else
101-
handles.stage = stage_get_pos(handles.stage);
102-
end
103-
98+
handles.stage = stage_get_pos(handles.stage);
10499
x = handles.stage.Pos(1);
105100
y = handles.stage.Pos(2);
106101
set(handles.current_position_x,'String',x);
@@ -142,12 +137,7 @@ function Move_stage_Callback(hObject, eventdata, handles)
142137
% eventdata reserved - to be defined in a future version of MATLAB
143138
% handles structure with handles and user data (see GUIDATA)
144139
stage_new = [str2num(handles.target_position_x),str2num(handles.target_position_y)];
145-
if strcmp(handles.mode_desc(end-4:end),'Prior')
146-
handles.stage = stage_move_prior(handles.stage,stage_new);
147-
else
148-
handles.stage = stage_move(handles.stage,stage_new);
149-
end
150-
%handles.stage = stage_move(handles.stage,stage_new);
140+
handles.stage = stage_move(handles.stage,stage_new);
151141
set(handles.current_position_x,'String',handles.target_position_x);
152142
set(handles.current_position_y,'String',handles.target_position_y);
153143
handles.position_flag_y=0;
@@ -214,12 +204,7 @@ function Get_position_Callback(hObject, eventdata, handles)
214204
% hObject handle to Get_position (see GCBO)
215205
% eventdata reserved - to be defined in a future version of MATLAB
216206
% handles structure with handles and user data (see GUIDATA)
217-
if strcmp(handles.mode_desc(end-4:end),'Prior')
218-
handles.stage = stage_get_pos_prior(handles.stage);
219-
else
220-
handles.stage = stage_get_pos(handles.stage);
221-
end
222-
%handles.stage = stage_get_pos(handles.stage);
207+
handles.stage = stage_get_pos(handles.stage);
223208
x = handles.stage.Pos(1);
224209
y = handles.stage.Pos(2);
225210
set(handles.current_position_x,'String',x);
@@ -276,15 +261,9 @@ function Choose_System_Callback(hObject, eventdata, handles)
276261
mode_desc = deblank(modes{mode_index});
277262
handles.mode_desc = mode_desc;
278263
if mode_index ~= 1
279-
if strcmp(handles.mode_desc(end-4:end),'Prior')
280-
handles.stage=stage_open_prior(mode_desc);
281-
handles.stage = stage_set_origin_prior(handles.stage);
282-
handles.stage=stage_move_prior(handles.stage,[5000,5000]);
283-
else
284-
handles.stage=stage_open(mode_desc);
285-
handles.stage = stage_set_origin(handles.stage);
286-
handles.stage=stage_move(handles.stage,[50000,50000]);
287-
end
264+
addpath('stages/Prior','stages/Ludl');
265+
handles.stage=stage_open(mode_desc);
266+
handles.stage = stage_set_origin(handles.stage);
288267
set(handles.Get_position,'Enable','on');
289268
set(handles.current_position_x,'Enable','on');
290269
set(handles.current_position_y,'Enable','on');
@@ -380,7 +359,7 @@ function Choose_Camera_Callback(hObject, eventdata, handles)
380359
settings.cam_kind = char('USB');
381360
settings.cam_format=char('F7_RGB_1224x1024_Mode1');
382361
else
383-
settings.cam_kind = char('firewire');
362+
settings.cam_kind = char('Firewire');
384363
settings.cam_format=char('RGB24_1024x768');
385364
end
386365
settings.reticleID=char('KR-871');

GUI.m

Lines changed: 9 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ 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');
183+
addpath('gui_graphics', 'icc_profiles', 'tasks','stages/Prior','stages/Ludl');
184184
handles_old = varargin{1};
185185
handles.Administrator_Input_Screen = handles_old.Administrator_Input_Screen;
186186
myData = handles_old.myData;
@@ -198,7 +198,6 @@ function GUI_OpeningFcn(hObj, eventdata, handles, varargin)
198198
handles.reticle = 1;
199199
settings = myData.settings;
200200
guidata(handles.GUI, handles)
201-
202201
% Open communications to camera and begin preview
203202
% Open communications to stage
204203
switch myData.mode_desc
@@ -213,13 +212,7 @@ function GUI_OpeningFcn(hObj, eventdata, handles, varargin)
213212
% close(cam_figure)
214213

215214
% Open communications to stage
216-
stage_label = handles.myData.stage.label;
217-
if strcmp(stage_label(end-4:end),'Prior')
218-
handles.myData.stage = stage_open_prior(handles.myData.stage.label);
219-
else
220215
handles.myData.stage = stage_open(handles.myData.stage.label);
221-
end
222-
%handles.myData.stage = stage_open(handles.myData.stage.label);
223216
% To close:
224217
% delete(handles.stage)
225218
% If communications with the stage cannot be established,
@@ -562,13 +555,7 @@ function NextButtonPressed(hObj, eventdata, handles) %#ok<DEFNU>
562555
end
563556
taskinfo.stage_x = stage_new(1);
564557
taskinfo.stage_y = stage_new(2);
565-
stage_label = handles.myData.stage.label;
566-
if strcmp(stage_label(end-4:end),'Prior')
567-
myData.stage = stage_move_prior(myData.stage,stage_new, myData.stage.handle);
568-
else
569-
myData.stage = stage_move(myData.stage,stage_new, myData.stage.handle);
570-
end
571-
%myData.stage = stage_move(myData.stage,stage_new, myData.stage.handle);
558+
myData.stage = stage_move(myData.stage,stage_new, myData.stage.handle);
572559
taskimage_load(hObj);
573560
handles = guidata(handles.GUI);
574561
set(handles.iH,'visible','off');
@@ -736,13 +723,7 @@ function ResetViewButtonPressed(hObj, eventdata, handles) %#ok<DEFNU>
736723
set(handles.NextButton,'enable','off');
737724
set(handles.Fast_Register_Button,'enable','off');
738725
set(handles.Best_Register_Button,'enable','off');
739-
stage_label = handles.myData.stage.label;
740-
if strcmp(stage_label(end-4:end),'Prior')
741-
handles.myData.stage = stage_move_prior(handles.myData.stage,target_pos,handles.myData.stage.handle);
742-
else
743-
handles.myData.stage = stage_move(handles.myData.stage,target_pos,handles.myData.stage.handle);
744-
end
745-
%handles.myData.stage = stage_move(handles.myData.stage,target_pos,handles.myData.stage.handle);
726+
handles.myData.stage = stage_move(handles.myData.stage,target_pos,handles.myData.stage.handle);
746727
set(handles.NextButton,'enable',currentNextStatus);
747728
set(handles.Fast_Register_Button,'enable','on');
748729
set(handles.Best_Register_Button,'enable','on');
@@ -798,13 +779,7 @@ function Fast_Register_Button_Callback(hObject, eventdata, handles) %#ok<DEFNU>
798779
[roi_h, roi_w] = size(roi_image);
799780

800781
% Get the stage position
801-
stage_label = handles.myData.stage.label;
802-
if strcmp(stage_label(end-4:end),'Prior')
803-
handles.myData.stage = stage_get_pos_prior(handles.myData.stage,myData.stage.handle);
804-
else
805-
handles.myData.stage = stage_get_pos(handles.myData.stage,myData.stage.handle);
806-
end
807-
% handles.myData.stage = stage_get_pos(handles.myData.stage,myData.stage.handle);
782+
handles.myData.stage = stage_get_pos(handles.myData.stage,myData.stage.handle);
808783
stage_current = int64(handles.myData.stage.Pos);
809784

810785
% Cross correlate the stage and wsi images
@@ -833,12 +808,7 @@ function Fast_Register_Button_Callback(hObject, eventdata, handles) %#ok<DEFNU>
833808
stage_new = stage_current + offset_roi;
834809
offset_stage = int64(myData.settings.offset_stage);
835810
stage_new = stage_new - offset_stage;
836-
if strcmp(stage_label(end-4:end),'Prior')
837-
handles.myData.stage = stage_move_prior(handles.myData.stage,stage_new, handles.myData.stage.handle);
838-
else
839-
handles.myData.stage = stage_move(handles.myData.stage,stage_new, handles.myData.stage.handle);
840-
end
841-
%handles.myData.stage = stage_move(handles.myData.stage,stage_new, handles.myData.stage.handle);
811+
handles.myData.stage = stage_move(handles.myData.stage,stage_new, handles.myData.stage.handle);
842812
catch ME
843813
error_show(ME)
844814
end
@@ -1102,25 +1072,12 @@ function Best_Register_Button_Callback(hObject, eventdata, handles)
11021072
[roi_h, roi_w] = size(roi_image);
11031073

11041074
% Get the stage position and snap a picture: cam_image
1105-
stage_label = handles.myData.stage.label;
1106-
if strcmp(stage_label(end-4:end),'Prior')
1107-
handles.myData.stage = stage_get_pos_prior(handles.myData.stage,handles.myData.stage.handle);
1108-
else
1109-
handles.myData.stage = stage_get_pos(handles.myData.stage,handles.myData.stage.handle);
1110-
end
1111-
% handles.myData.stage = stage_get_pos(handles.myData.stage,handles.myData.stage.handle);
1075+
handles.myData.stage = stage_get_pos(handles.myData.stage,handles.myData.stage.handle);
11121076
stage_current = int64(handles.myData.stage.Pos);
11131077
offset_stage = int64(myData.settings.offset_stage);
11141078
stage_new = stage_current + offset_stage;
1115-
if strcmp(stage_label(end-4:end),'Prior')
1116-
handles.myData.stage = stage_move_prior(handles.myData.stage,stage_new,handles.myData.stage.handle);
1117-
handles.myData.stage = stage_get_pos_prior(handles.myData.stage,handles.myData.stage.handle);
1118-
else
1119-
handles.myData.stage = stage_move(handles.myData.stage,stage_new,handles.myData.stage.handle);
1120-
handles.myData.stage = stage_get_pos(handles.myData.stage,handles.myData.stage.handle);
1121-
end
1122-
%handles.myData.stage = stage_move(handles.myData.stage,stage_new,handles.myData.stage.handle);
1123-
%handles.myData.stage = stage_get_pos(handles.myData.stage,handles.myData.stage.handle);
1079+
handles.myData.stage = stage_move(handles.myData.stage,stage_new,handles.myData.stage.handle);
1080+
handles.myData.stage = stage_get_pos(handles.myData.stage,handles.myData.stage.handle);
11241081
stage_current = int64(handles.myData.stage.Pos);
11251082
cam_image = camera_take_image(handles.cam);
11261083

@@ -1174,12 +1131,7 @@ function Best_Register_Button_Callback(hObject, eventdata, handles)
11741131
stage_new = stage_current + offset_roi;
11751132
offset_stage = int64(myData.settings.offset_stage);
11761133
stage_new = stage_new - offset_stage;
1177-
if strcmp(stage_label(end-4:end),'Prior')
1178-
handles.myData.stage = stage_move_prior(handles.myData.stage,stage_new, handles.myData.stage.handle);
1179-
else
1180-
handles.myData.stage = stage_move(handles.myData.stage,stage_new, handles.myData.stage.handle);
1181-
end
1182-
%handles.myData.stage = stage_move(handles.myData.stage,stage_new, handles.myData.stage.handle);
1134+
handles.myData.stage = stage_move(handles.myData.stage,stage_new, handles.myData.stage.handle);
11831135
catch ME
11841136
error_show(ME)
11851137
end

Stage_Allighment.m

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,13 @@ function Stage_Allighment_OpeningFcn(hObject, eventdata, handles, varargin) %#ok
3939
reg_flag = current.reg_flag; %#ok<NASGU>
4040
slot_i = current.slot_i;
4141
wsi_info = myData.wsi_files{slot_i};
42-
42+
addpath('stages/Prior','stages/Ludl');
4343
% Initiate the camera preview window
4444
% handles.cam = camera object
4545
if myData.yesno_micro==1
4646
handles.cam = camera_open(settings.cam_kind,settings.cam_format);
4747
handles.cam_figure = camera_preview(handles.cam, settings);
48-
stage_label = myData.stage.label;
49-
if strcmp(stage_label(end-4:end),'Prior')
50-
myData.stage = stage_set_origin_prior(myData.stage);
51-
myData.stage=stage_move_prior(myData.stage,[5000,5000]);
52-
else
53-
myData.stage = stage_set_origin(myData.stage);
54-
myData.stage=stage_move(myData.stage,[50000,50000]);
55-
end
56-
%myData.stage = stage_set_origin(myData.stage);
57-
%myData.stage=stage_move(myData.stage,[50000,50000]);
58-
48+
myData.stage = stage_set_origin(myData.stage);
5949
end
6050

6151
% Set the default size of the window and the axes
@@ -298,13 +288,7 @@ function take_stage(hObject, eventdata, handles)
298288

299289
% Get stage position_i and camera image
300290
if handles.myData.yesno_micro==1
301-
stage_label = handles.myData.stage.label;
302-
if strcmp(stage_label(end-4:end),'Prior')
303-
myData.stage = stage_get_pos_prior(myData.stage);
304-
else
305-
myData.stage = stage_get_pos(myData.stage);
306-
end
307-
%myData.stage = stage_get_pos(myData.stage);
291+
myData.stage = stage_get_pos(myData.stage);
308292
temp = myData.stage.Pos;
309293
current.cam_x0 = temp(1);
310294
current.cam_y0 = temp(2);
@@ -678,13 +662,7 @@ function take_stage1_Callback(hObject, eventdata, handles) %#ok<DEFNU>
678662

679663
if handles.current.load_stage_data(1) == 1
680664
display('automatically navigate to position 1')
681-
stage_label = handles.myData.stage.label;
682-
if strcmp(stage_label(end-4:end),'Prior')
683-
handles.myData.stage=stage_move_prior(handles.myData.stage,handles.myData.stagedata.stage_positions(1,:));
684-
else
685-
handles.myData.stage=stage_move(handles.myData.stage,handles.myData.stagedata.stage_positions(1,:));
686-
end
687-
%handles.myData.stage=stage_move(handles.myData.stage,handles.myData.stagedata.stage_positions(1,:));
665+
handles.myData.stage=stage_move(handles.myData.stage,handles.myData.stagedata.stage_positions(1,:));
688666
set(handles.take_stage1,'String','Take Stage Position 1');
689667
handles.current.load_stage_data(1) = 2;
690668
guidata(handles.Stage_Allighment,handles);
@@ -724,14 +702,7 @@ function take_stage2_Callback(hObject, eventdata, handles) %#ok<DEFNU>
724702

725703
if handles.current.load_stage_data(2) == 1
726704
display('automatically navigate to position 2')
727-
stage_label = handles.myData.stage.label;
728-
if strcmp(stage_label(end-4:end),'Prior')
729-
handles.myData.stage=stage_move_prior(handles.myData.stage,handles.myData.stagedata.stage_positions(2,:));
730-
else
731-
handles.myData.stage=stage_move(handles.myData.stage,handles.myData.stagedata.stage_positions(2,:));
732-
end
733-
%handles.myData.stage=stage_move(handles.myData.stage,handles.myData.stagedata.stage_positions(2,:));
734-
705+
handles.myData.stage=stage_move(handles.myData.stage,handles.myData.stagedata.stage_positions(2,:));
735706
set(handles.take_stage2,'String','Take Stage Position 2');
736707
handles.current.load_stage_data(2) = 2;
737708
guidata(handles.Stage_Allighment,handles);
@@ -769,14 +740,7 @@ function take_stage3_Callback(hObject, eventdata, handles) %#ok<DEFNU>
769740

770741
if handles.current.load_stage_data(3) == 1
771742
display('automatically navigate to position 3')
772-
stage_label = handles.myData.stage.label;
773-
if strcmp(stage_label(end-4:end),'Prior')
774-
handles.myData.stage=stage_move_prior(handles.myData.stage,handles.myData.stagedata.stage_positions(3,:));
775-
else
776-
handles.myData.stage=stage_move(handles.myData.stage,handles.myData.stagedata.stage_positions(3,:));
777-
end
778-
%handles.myData.stage=stage_move(handles.myData.stage,handles.myData.stagedata.stage_positions(3,:));
779-
743+
handles.myData.stage=stage_move(handles.myData.stage,handles.myData.stagedata.stage_positions(3,:));
780744
set(handles.take_stage3,'String','Take Stage Position 3');
781745
handles.current.load_stage_data(3) = 2;
782746
guidata(handles.Stage_Allighment,handles);

camera_open.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
delete(objects);
2828
if strcmp( cam_kind,'USB')
2929
cam_adaptor = 'pointgrey';
30-
elseif strcmp( cam_kind,'firewire')
30+
elseif strcmp( cam_kind,'Firewire')
3131
cam_adaptor = 'dcam';
3232
end
3333
% Create the video object to communicate with the camera

sample_inputfiles/thorlabs20x-axioplan2i.dapsi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ wsi_slot_1 = C:\000_whole_slides\100113_ThorLabs_20x.ndpi
3838
rgb_lut_slot_1 = icc_profiles\rgb_lut_identity.txt
3939
label_pos = 6
4040
reticleID = KR-32536
41+
cam_kind = Firewire
4142
cam_format = RGB24_1024x768
4243
cam_pixel_size = 6.9
4344
mag_cam = 1.0

sample_inputfiles/thorlabs20x-axioplan2i_RK871.dapsi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ wsi_slot_1 = C:\000_whole_slides\100113_ThorLabs_20x.ndpi
3838
rgb_lut_slot_1 = icc_profiles\rgb_lut_identity.txt
3939
label_pos = 6
4040
reticleID = KR-871
41+
cam_kind = Firewire
4142
cam_format = RGB24_1024x768
4243
cam_pixel_size = 6.9
4344
mag_cam = 1.0

sample_inputfiles/thorlabs20x-olympus.dapsi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ wsi_slot_1 = C:\000_whole_slides\100113_ThorLabs_20x.ndpi
3838
rgb_lut_slot_1 = icc_profiles\rgb_lut_identity.txt
3939
label_pos = 12
4040
reticleID = KR-32536
41+
cam_kind = Firewire
4142
cam_format = RGB24_1024x768
4243
cam_pixel_size = 6.9
4344
mag_cam = 0.5

sample_inputfiles/tissue40x-8B-axioplan2i.dapsi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ wsi_slot_1 = C:\000_whole_slides\tissue40x-8B.ndpi
4444
rgb_lut_slot_1 = icc_profiles\rgb_lut_gamma_inv1p8.txt
4545
label_pos = 6
4646
reticleID = KR-871
47+
cam_kind = Firewire
4748
cam_format = RGB24_1024x768
4849
cam_pixel_size = 6.9
4950
mag_cam = 1.0

sample_inputfiles/tissue40x-8B-olympus.dapsi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ wsi_slot_1 = C:\000_whole_slides\tissue40x-8B.ndpi
3838
rgb_lut_slot_1 = icc_profiles\rgb_lut_gamma_inv1p8.txt
3939
label_pos = 12
4040
reticleID = KR-32536
41+
cam_kind = Firewire
4142
cam_format = RGB24_1024x768
4243
cam_pixel_size = 6.9
4344
mag_cam = 0.5

0 commit comments

Comments
 (0)