Skip to content

Commit

Permalink
polyline can be saved and loaded from the lateral profile gui;
Browse files Browse the repository at this point in the history
segmentation fault issue fixed (when executing system(PDF_VIEWER) under linux)
  • Loading branch information
lpolerecky committed Oct 28, 2023
1 parent 7592995 commit e6a5f5b
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 7 deletions.
Binary file modified src/figs/lateral_profile_gui.fig
Binary file not shown.
12 changes: 6 additions & 6 deletions src/fnc/LANS.m
Original file line number Diff line number Diff line change
Expand Up @@ -2081,20 +2081,20 @@ function display_xyz_stacks_Callback(hObject, eventdata, handles)
h = [];
workdir=get(handles.edit2,'String');
workdir=fixdir(workdir);
if(isdir(workdir))
if(isfolder(workdir))
newdir=workdir;
else
newdir='';
end;
end
global MAT_EXT
def_file = [workdir 'prefs' MAT_EXT];
fprintf(1,'Select the Preferences file (default %s)\n',def_file);

[FileName,newdir,newext] = uigetfile('*.mat', 'Select the Preferences file', def_file);
[FileName,newdir,~] = uigetfile('*.mat', 'Select the Preferences file', def_file);
if(FileName~=0)
imfile = [newdir, FileName];
h = load_settings(handles,imfile,0);
end;
end

% --------------------------------------------------------------------
function define_mask_Callback(hObject, eventdata, handles)
Expand Down Expand Up @@ -2403,7 +2403,7 @@ function Save_Display_Preferences_Callback(hObject, eventdata, handles)

workdir=get(handles.edit2,'String');
workdir=fixdir(workdir);
if(isdir(workdir))
if(isfolder(workdir))
newdir=workdir;
else
newdir='';
Expand All @@ -2416,7 +2416,7 @@ function Save_Display_Preferences_Callback(hObject, eventdata, handles)
if(FileName~=0)
imfile = [newdir, FileName];
save_settings(handles,imfile);
end;
end

% --------------------------------------------------------------------
function close_all_figures_Callback(hObject, eventdata, handles)
Expand Down
58 changes: 58 additions & 0 deletions src/fnc/lateral_profile_gui.m
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,64 @@ function pushbutton1_Callback(hObject, eventdata, handles)
end
%guidata(hObject, handles);

function pushbutton5_Callback(hObject, eventdata, handles)
if isfield(handles,'polygon')
%if ishandle(handles.polygon)
xy = handles.polygon.Position;

workdir=handles.fdir;
if(isfolder(workdir))
newdir=workdir;
else
newdir='';
end

def_file = [workdir 'polygon_xy'];
fprintf(1,'Specify a file name for storing the polygon coordinates (default %s.dat)\n',def_file);

[FileName,newdir,~] = uiputfile('*.dat', 'Select *.DAT file', def_file);
if(FileName~=0)
polygonfile = [newdir, FileName];
save(polygonfile,'xy','-ascii');
end

end

function pushbutton6_Callback(hObject, eventdata, handles)
workdir=handles.fdir;
if(isfolder(workdir))
newdir=workdir;
else
newdir='';
end
def_file = [workdir 'polygon_xy.dat'];
fprintf(1,'Select a file with polygon coordinates (default %s)\n',def_file);

[FileName,newdir,~] = uigetfile('*.dat', 'Select *.DAT file', def_file);
if(FileName~=0)
polygonfile = [newdir, FileName];
fid=fopen(polygonfile,'r');
xy = fscanf(fid,'%f %f',[2,inf]);
fclose(fid);
xy = xy';
end
if isfield(handles,'polygon')
if isvalid(handles.polygon)
handles.polygon.Position = xy;
else
ax = handles.axes1;
polygon = images.roi.Polyline(ax, 'Color', 'w', 'Tag', 'lans_polygon');
polygon.Position = xy;
handles.polygon = polygon;
end
else
ax = handles.axes1;
polygon = images.roi.Polyline(ax, 'Color', 'w', 'Tag', 'lans_polygon');
polygon.Position = xy;
handles.polygon = polygon;
end
guidata(hObject, handles);

% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
Expand Down
6 changes: 5 additions & 1 deletion src/lans_paths.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@
ZIP_COMMAND = 'zip -r';

% PDF viewer
PDF_VIEWER = 'xreader';
%PDF_VIEWER = 'xreader';

% if calling system(PDF_VIEWER) without the LD_LIBRARY_PATH set
% gives a segmentation fault, use the following way to define it:
PDF_VIEWER = 'LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu; xreader';

GUI_FONTSIZE = 10;

Expand Down

0 comments on commit e6a5f5b

Please sign in to comment.