Skip to content

Instantly share code, notes, and snippets.

Created December 11, 2014 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/bdbc1c262a9aee934f60 to your computer and use it in GitHub Desktop.
Save anonymous/bdbc1c262a9aee934f60 to your computer and use it in GitHub Desktop.
function varargout = prototypeVolView(varargin)
% PROTOTYPEVOLVIEW MATLAB code for prototypeVolView.fig
% PROTOTYPEVOLVIEW, by itself, creates a new PROTOTYPEVOLVIEW or raises the existing
% singleton*.
%
% H = PROTOTYPEVOLVIEW returns the handle to a new PROTOTYPEVOLVIEW or the handle to
% the existing singleton*.
%
% PROTOTYPEVOLVIEW('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in PROTOTYPEVOLVIEW.M with the given input arguments.
%
% PROTOTYPEVOLVIEW('Property','Value',...) creates a new PROTOTYPEVOLVIEW or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before prototypeVolView_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to prototypeVolView_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 prototypeVolView
% Last Modified by GUIDE v2.5 10-Dec-2014 15:02:17
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @prototypeVolView_OpeningFcn, ...
'gui_OutputFcn', @prototypeVolView_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(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 prototypeVolView is made visible.
function prototypeVolView_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 prototypeVolView (see VARARGIN)
% Choose default command line output for prototypeVolView
handles.output = hObject;
% set relevant image data to appdata
setappdata(0, 'mainfig', gcf);
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes prototypeVolView wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = prototypeVolView_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;
% --- Executes on button press in maximizeButton.
function maximizeButton_Callback(hObject, eventdata, handles)
% hObject handle to maximizeButton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in functionStartButton.
function functionStartButton_Callback(hObject, eventdata, handles)
% hObject handle to functionStartButton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get current appdata
mainfig = getappdata(0, 'mainfig');
% Data loaded, populate all three graphs
addpath([pwd '\Functions']);
addpath([pwd '\Data']);
%% All aforementioned code should be removed from maincode eventually
% Load preset data and visualize
command = sprintf('load(''%s'')', 'wiener2_outputted.mat');
v = evalin('base', command);
% Set default currentslice to midpoint of each axes
currentSlice = ceil(size(v.cq_wiener2)/2);
T = [1 0 0 0; ...
0 range(v.cq_wiener2(currentSlice(1),:,currentSlice(3)))/range(v.cq_wiener2(:,currentSlice(2), currentSlice(3))) 0 0; ...
0 0 range(v.cq_wiener2(currentSlice(1),currentSlice(2),:))/range(v.cq_wiener2(:,currentSlice(2), currentSlice(3))) 0];
%Set current appdata
% v.cq_wiener2=flipdim(v.cq_wiener2,1);
% v.cq_wiener2=flipdim(v.cq_wiener2,3);
setappdata(mainfig, 'cq', v.cq_wiener2)
setappdata(mainfig, 'currentSlice', currentSlice)
setappdata(mainfig, 'T', T)
displayAll(handles)
% --- Executes on button press in zoomButton.
function zoomButton_Callback(hObject, eventdata, handles)
% hObject handle to zoomButton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in measureButton.
function measureButton_Callback(hObject, eventdata, handles)
% hObject handle to measureButton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on scroll wheel click while the figure is in focus.
function figure1_WindowScrollWheelFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata structure with the following fields (see FIGURE)
% VerticalScrollCount: signed integer indicating direction and number of clicks
% VerticalScrollAmount: number of lines scrolled for each click
% handles structure with handles and user data (see GUIDATA)
% Do in separate function
addpath([pwd '\Functions']);
sliceScrollFunction(handles, eventdata.VerticalScrollCount);
% --- Executes on mouse press over figure background, over a disabled or
% --- inactive control, or over an axes background.
function figure1_WindowButtonDownFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% SET CURRENTAXES TAG HERE!!!
current_gca = get(gca, 'Tag');
%% All aforementioned code should be removed from maincode eventually
% Set gca appdata
mainfig = getappdata(0, 'mainfig');
setappdata(mainfig, 'current_gca', current_gca);
% If mouseclick_type == alt, redraw
mouseclick_type = get(gcf, 'SelectionType');
if strcmp(mouseclick_type, 'alt')
addpath([pwd '\Functions']);
pt_coord = get(gca, 'CurrentPoint');
redrawAllAxesonClick(handles, pt_coord(1,:))
end
% Debug Test
set(handles.debug_Axes_Text, 'String', current_gca);
% --- Executes on button press in inclCrosshairsChxbox.
function inclCrosshairsChxbox_Callback(hObject, eventdata, handles)
% hObject handle to inclCrosshairsChxbox (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if get(hObject, 'Value') == 1
% Don't redraw, but instead add crosshairs to current gca's
drawCrosshairs(handles);
else
% Delete crosshairs
displayAll(handles)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment