Commit 5ff96515 authored by Eamon Doyle's avatar Eamon Doyle
Browse files

add debug verbosity

parent 5c89546d
...@@ -2,7 +2,7 @@ function varargout = mergeRoiTool(varargin) ...@@ -2,7 +2,7 @@ function varargout = mergeRoiTool(varargin)
% ROITOOL MATLAB code for mergeRoiTool.fig % ROITOOL MATLAB code for mergeRoiTool.fig
% ROITOOL, by itself, creates a new ROITOOL or raises the existing % ROITOOL, by itself, creates a new ROITOOL or raises the existing
% singleton*. % singleton*.
% %
% H = mergeRoiTool returns the handle to a new mergeRoiTool or the handle to % H = mergeRoiTool returns the handle to a new mergeRoiTool or the handle to
% the existing singleton*. % the existing singleton*.
% %
...@@ -18,6 +18,8 @@ function varargout = mergeRoiTool(varargin) ...@@ -18,6 +18,8 @@ function varargout = mergeRoiTool(varargin)
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)". % instance to run (singleton)".
% %
% set global variable mergeDebugVerbosity to >0 if you want more debug
%
% See also: GUIDE, GUIDATA, GUI % See also: GUIDE, GUIDATA, GUI
% Edit the above text to modify the response to help mergeRoiTool % Edit the above text to modify the response to help mergeRoiTool
...@@ -52,6 +54,12 @@ function mergeRoiTool_OpeningFcn(hObject, eventdata, handles, varargin) ...@@ -52,6 +54,12 @@ function mergeRoiTool_OpeningFcn(hObject, eventdata, handles, varargin)
% varargin command line arguments to mergeRoiTool (see VARARGIN) % varargin command line arguments to mergeRoiTool (see VARARGIN)
% Choose default command line output for mergeRoiTool % Choose default command line output for mergeRoiTool
global mergeDebugVerbosity
if isempty(mergeDebugVerbosity)
handles.debug=0;
else
handles.debug=mergeDebugVerbosity;
end
handles.output = hObject; handles.output = hObject;
handles.needsReload = 1; handles.needsReload = 1;
handles.roi = struct; handles.roi = struct;
...@@ -99,14 +107,14 @@ try ...@@ -99,14 +107,14 @@ try
set(handles.checkbox_saved,'Value',1,'BackgroundColor','g'); set(handles.checkbox_saved,'Value',1,'BackgroundColor','g');
axes(handles.axes1); axes(handles.axes1);
%warn('here') %warn('here')
h = imagesc([0 0; 0 0]) h = imagesc([0 0; 0 0]);
%set(h,'HitTest','off') %set(h,'HitTest','off')
get(h) %get(h);
%set(h,'ButtonDownFcn',@axes1_ButtonDownFcn) %set(h,'ButtonDownFcn',@axes1_ButtonDownFcn)
handles.needsReload = 1; handles.needsReload = 1;
msgbox('ROI Saved Successfully') msgbox('ROI Saved Successfully');
catch catch
h = warndlg('Save failed. Nothing saved'); h = warndlg('Save failed. Nothing saved');
end end
...@@ -197,7 +205,7 @@ handles.path = path; ...@@ -197,7 +205,7 @@ handles.path = path;
handles.needsReload = 1; handles.needsReload = 1;
files = dir(path); files = dir(path);
dcmlist = struct; dcmlist = struct;
setProgress(hObject, eventdata, handles,0,'Loading...') setProgress(hObject, eventdata, handles,0,'Loading...');
for n=3:length(files); for n=3:length(files);
fp = [path '/' files(n).name]; fp = [path '/' files(n).name];
if ~files(n).isdir && isdicom(fp) && (isempty(strfind(files(n).name,'XX')) && isempty(strfind(files(n).name,'PS'))) if ~files(n).isdir && isdicom(fp) && (isempty(strfind(files(n).name,'XX')) && isempty(strfind(files(n).name,'PS')))
...@@ -364,7 +372,7 @@ path = handles.dcmlist(imagenum).path; ...@@ -364,7 +372,7 @@ path = handles.dcmlist(imagenum).path;
axes(handles.axes1); axes(handles.axes1);
images = dicomread(path); images = dicomread(path);
%h = imagesc(images(:,:,1,1),'HitTest','off'); %h = imagesc(images(:,:,1,1),'HitTest','off');
set(handles.imageHandle,'CData',images(:,:,1,1)) set(handles.imageHandle,'CData',images(:,:,1,1));
%h = imagesc(images(:,:,1,1)); %h = imagesc(images(:,:,1,1));
set(handles.sliceCount,'String',sprintf('/ %i',size(images,4))); set(handles.sliceCount,'String',sprintf('/ %i',size(images,4)));
%get(gca,'HitTest') %get(gca,'HitTest')
...@@ -603,25 +611,37 @@ function axes1_ButtonDownFcn(hObject, eventdata, handles) ...@@ -603,25 +611,37 @@ function axes1_ButtonDownFcn(hObject, eventdata, handles)
drawnow drawnow
handles = guidata(hObject); handles = guidata(hObject);
%colormap('gray'); %colormap('gray');
disp('yes it ran') if handles.debug > 3
datetime disp('yes it ran')
currentPoint = get(gca, 'currentpoint') datetime
currentBox = currentPoint(1,1:2) end
handles currentPoint = get(gca, 'currentpoint');
currentBox = currentPoint(1,1:2);
if handles.debug > 3
currentPoint
currentBox
handles
end
%handles2 = guihandles(hObject) %handles2 = guihandles(hObject)
%handles2 %handles2
%size(handles.lungMatrix) %size(handles.lungMatrix)
lungGridSize = handles.lungGridSize; lungGridSize = handles.lungGridSize;
lungGridMatSize = size(handles.lungMatrix) lungGridMatSize = size(handles.lungMatrix);
lungMatLoc = floor(currentBox) lungMatLoc = floor(currentBox);
lmy = floor(lungMatLoc(1)./size(handles.imageMat,2)*lungGridMatSize(2)) lmy = floor(lungMatLoc(1)./size(handles.imageMat,2)*lungGridMatSize(2));
lmx = floor(lungMatLoc(2)./size(handles.imageMat,1)*lungGridMatSize(1)) lmx = floor(lungMatLoc(2)./size(handles.imageMat,1)*lungGridMatSize(1));
currentSlice = get(handles.slider2,'Value'); currentSlice = get(handles.slider2,'Value');
currentSlice if handles.debug > 3
lungGridMatSize
lungMatLoc
lmy
lmx
currentSlice
end
handles.lungMatrix(lmx,lmy,1,currentSlice) = mod(handles.lungMatrix(lmx,lmy,1,currentSlice)+1,5); handles.lungMatrix(lmx,lmy,1,currentSlice) = mod(handles.lungMatrix(lmx,lmy,1,currentSlice)+1,5);
handles.lungMatrix(:,:,1,currentSlice); handles.lungMatrix(:,:,1,currentSlice);
guidata(hObject, handles) guidata(hObject, handles);
redrawImage(hObject, eventdata, handles); redrawImage(hObject, eventdata, handles);
%r = rectangle('Position',[lungMatLoc.*lungGridSize lungMatLoc.*lungGridSize+[lungGridSize,lungGridSize]],'FaceColor',[0.5 0.5 0.5] ) %r = rectangle('Position',[lungMatLoc.*lungGridSize lungMatLoc.*lungGridSize+[lungGridSize,lungGridSize]],'FaceColor',[0.5 0.5 0.5] )
...@@ -631,7 +651,7 @@ redrawImage(hObject, eventdata, handles); ...@@ -631,7 +651,7 @@ redrawImage(hObject, eventdata, handles);
%tableData = {xlist(1),ylist(1),SliderLocation}; %tableData = {xlist(1),ylist(1),SliderLocation};
%set(handles.CoordinateTable,'Data',tableData) %set(handles.CoordinateTable,'Data',tableData)
% Update handles structure % Update handles structure
guidata(hObject, handles) guidata(hObject, handles);
function mouseClick(~,~) function mouseClick(~,~)
disp('yep') disp('yep')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment