Commit d9d0da06 authored by Mohammed Musaab's avatar Mohammed Musaab
Browse files

adding CellTracker folder

parent 6d177cd4
No related merge requests found
Showing with 5988 additions and 0 deletions
+5988 -0
File added
File added
This diff is collapsed.
File added
function varargout = CellTrackerFigureShow(varargin)
% CELLTRACKERFIGURESHOW MATLAB code for CellTrackerFigureShow.fig
% CELLTRACKERFIGURESHOW, by itself, creates a new CELLTRACKERFIGURESHOW or raises the existing
% singleton*.
%
% H = CELLTRACKERFIGURESHOW returns the handle to a new CELLTRACKERFIGURESHOW or the handle to
% the existing singleton*.
%
% CELLTRACKERFIGURESHOW('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in CELLTRACKERFIGURESHOW.M with the given input arguments.
%
% CELLTRACKERFIGURESHOW('Property','Value',...) creates a new CELLTRACKERFIGURESHOW or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before CellTrackerFigureShow_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to CellTrackerFigureShow_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 CellTrackerFigureShow
% Last Modified by GUIDE v2.5 16-Sep-2015 12:37:56
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @CellTrackerFigureShow_OpeningFcn, ...
'gui_OutputFcn', @CellTrackerFigureShow_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 CellTrackerFigureShow is made visible.
function CellTrackerFigureShow_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 CellTrackerFigureShow (see VARARGIN)
% Choose default command line output for CellTrackerFigureShow
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% Added by Filippo
global f_handles;
f_handles.h_text1 = handles.text1;
f_handles.h_FigureShow = handles.figure1;
f_handles.h_axes1 = handles.axes1;
f_handles.h_slider1 = handles.slider1;
% Check monitor screen size to set the initial figure
set(0,'units','characters')
Pix_SS = get(0,'screensize');
gap = 20;
if min([Pix_SS(3), Pix_SS(4)])>2*gap
set(f_handles.h_FigureShow,'Position',[10, 10, floor(Pix_SS(3)-gap), floor(Pix_SS(4)-gap)])
end
% UIWAIT makes CellTrackerFigureShow wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = CellTrackerFigureShow_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 slider movement.
function slider1_Callback(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
%% Shows seletced image
global f_handles;
v = floor(get(hObject,'Value'));
% I don't know why but sometimes if you manually move the slider up to one
% image and then you click on the button next of the slider it does not
% work. With these next few line of code I solved the problem.
if v == f_handles.lastIndexShown
if f_handles.lastIndexShown ~= f_handles.lastImage
v = v+1;
end
end
f_handles.lastIndexShown = v;
guidata(hObject,handles);
set(f_handles.h_text1, 'String', ['Slide ' num2str(v)]);
f_handles.imageIndex = v;
guidata(hObject, handles);
updateSliceWindows(v, f_handles.PathImgCurrent, handles);
% --- Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
% --- Executes during object deletion, before destroying properties.
function figure1_DeleteFcn(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)
global f_handles;
if ishandle(f_handles.h_GUIsetT); close(f_handles.h_GUIsetT); end;
if ishandle(f_handles.h_GUIsetG); close(f_handles.h_GUIsetG); end;
if ishandle(f_handles.h_GUIstatistics); close(f_handles.h_GUIstatistics); end;
set(f_handles.h_FCpb01, 'BackgroundColor', 'yellow');
set(f_handles.h_FCpb02, 'BackgroundColor', 'red');
set(f_handles.h_FCpb03, 'BackgroundColor', 'red');
set(f_handles.h_FCpb04, 'BackgroundColor', 'red');
set(f_handles.h_FCpb05, 'BackgroundColor', 'red');
set(f_handles.h_FCpb06, 'BackgroundColor', 'red');
set(f_handles.h_FCpb07, 'BackgroundColor', 'red');
% create tmp folder
if isequal(exist([pwd filesep 'tmpct'], 'dir'),7); rmdir([pwd filesep 'tmpct'],'s'); mkdir([pwd filesep 'tmpct']); else mkdir([pwd filesep 'tmpct']); end;
% Save output
path = [pwd filesep 'tmpct' filesep];
fileNameMat = 'TracksCoordinates.mat';
fileNameExcel = 'TracksCoordinates.xls';
pathFileNameMat = [path fileNameMat];
pathFileNameExcel = [path fileNameExcel];
if ~isempty(f_handles.pos)
pos = f_handles.pos;
if isequal(exist(pathFileNameMat, 'file'),2); delete(pathFileNameMat); save(pathFileNameMat, 'pos'); else save(pathFileNameMat, 'pos'); end;
if isequal(exist(pathFileNameExcel, 'file'),2); delete(pathFileNameExcel); xlswrite(pathFileNameExcel, pos); else xlswrite(pathFileNameExcel, pos); end;
f_handles.pos = [];
else
if isequal(exist(pathFileNameMat, 'file'),2); delete(pathFileNameMat); end;
if isequal(exist(pathFileNameExcel, 'file'),2); delete(pathFileNameExcel); end;
end
% --- Executes when figure1 is resized.
function figure1_ResizeFcn(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)
global f_handles;
try
left_bottom_width_height = get(hObject, 'Position');
f1_left = left_bottom_width_height(1);
f1_bottom = left_bottom_width_height(2);
f1_width = left_bottom_width_height(3);
f1_height = left_bottom_width_height(4);
set(f_handles.h_text1,'Position',[5,1,20,2]) %Values read from GUIDE
set(f_handles.h_axes1,'Position',[5,5,f1_width-5-5,f1_height-5-1]) %Values read from GUIDE
set(f_handles.h_slider1,'Position',[27,1,f1_width-27-5,2]) %Values read from GUIDE
catch ME1
end
File added
function varargout = CellTrackerSettingsGeneral(varargin)
% CELLTRACKERSETTINGSGENERAL M-file for CellTrackerSettingsGeneral.fig
% CELLTRACKERSETTINGSGENERAL, by itself, creates a new CELLTRACKERSETTINGSGENERAL or raises the existing
% singleton*.
%
% H = CELLTRACKERSETTINGSGENERAL returns the handle to a new CELLTRACKERSETTINGSGENERAL or the handle to
% the existing singleton*.
%
% CELLTRACKERSETTINGSGENERAL('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in CELLTRACKERSETTINGSGENERAL.M with the given input arguments.
%
% CELLTRACKERSETTINGSGENERAL('Property','Value',...) creates a new CELLTRACKERSETTINGSGENERAL or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before CellTrackerSettingsGeneral_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to CellTrackerSettingsGeneral_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 CellTrackerSettingsGeneral
% Last Modified by GUIDE v2.5 26-Jun-2015 16:36:13
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @CellTrackerSettingsGeneral_OpeningFcn, ...
'gui_OutputFcn', @CellTrackerSettingsGeneral_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 CellTrackerSettingsGeneral is made visible.
function CellTrackerSettingsGeneral_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 CellTrackerSettingsGeneral (see VARARGIN)
global f_handles
% Choose default command line output for CellTrackerSettingsGeneral
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes CellTrackerSettingsGeneral wait for user response (see UIRESUME)
% uiwait(handles.figure1);
%% set parameters to show
try
% Close the other windows
%if ishandle(f_handles.h_GUIsetG); close(f_handles.h_GUIsetG); end;
if ishandle(f_handles.h_GUIsetT); close(f_handles.h_GUIsetT); end;
if ishandle(f_handles.h_GUIsetS); close(f_handles.h_GUIsetS); end;
if ishandle(f_handles.h_GUIsetM); close(f_handles.h_GUIsetM); end;
if ishandle(f_handles.h_GUIstatistics); close(f_handles.h_GUIstatistics); end;
inpImage = imread(f_handles.PathImgOriginal, 1);
[rowI, colI, chI] = size(inpImage);
numImages = length(imfinfo(f_handles.PathImgOriginal));
% background correction
if f_handles.backCorrMethod == 1
set(handles.radiobutton1, 'Value', 1);
elseif f_handles.backCorrMethod == 2
set(handles.radiobutton2, 'Value', 1);
end;
% Check parameters
if f_handles.backCorrSize<1 || f_handles.backCorrSize>=min([rowI, colI])
f_handles.backCorrSize = 1;
end
if f_handles.maxAlignDistance<0 || f_handles.maxAlignDistance>=min([rowI, colI])
f_handles.maxAlignDistance = ceil(min([rowI, colI])/10);
end
% Set parameters
set(handles.edit1, 'String', num2str(f_handles.backCorrSize));
% auto aligner
set(handles.edit3, 'String', num2str(f_handles.maxAlignDistance));
catch ME1
Message = {'Wrong parameter set.', ...
' '};
msgbox(Message,'Message')
end
% --- Outputs from this function are returned to the command line.
function varargout = CellTrackerSettingsGeneral_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 during object deletion, before destroying properties.
function figure1_DeleteFcn(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)
% --- Executes when user attempts to close figure1.
function figure1_CloseRequestFcn(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)
% Hint: delete(hObject) closes the figure
delete(hObject);
% --- Executes on button press in pb_saveSettings.
function pb_saveSettings_Callback(hObject, eventdata, handles)
% hObject handle to pb_saveSettings (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%% OK button to save settings
global f_handles;
try
%Reset input
f_handles.PathImgCurrent = f_handles.PathImgOriginal;
f_handles.startIm = 1;
f_handles.lastImage = length(imfinfo(f_handles.PathImgOriginal));
% Errors check
inpImage = imread(f_handles.PathImgCurrent, 1);
[rowI, colI, chI] = size(inpImage);
numImages = length(imfinfo(f_handles.PathImgCurrent));
testBackCorrSize = str2num(get(handles.edit1, 'String'));
testMaxAlignDistance = str2num(get(handles.edit3, 'String'));
flag_ComputationOn = 1;
if testBackCorrSize<1 || testBackCorrSize>=min([rowI, colI])
flag_ComputationOn = 0;
end
if testMaxAlignDistance<0 || testMaxAlignDistance>=min([rowI, colI])
flag_ComputationOn = 0;
end
if flag_ComputationOn == 1
if get(handles.radiobutton1, 'Value')== 1
f_handles.backCorrMethod = 1;
elseif get(handles.radiobutton2, 'Value') == 1
f_handles.backCorrMethod = 2;
end;
f_handles.backCorrSize = str2num(get(handles.edit1, 'String'));
% auto aligner
f_handles.maxAlignDistance = str2num(get(handles.edit3, 'String'));
% Reset GUI
set(f_handles.h_FCpb02, 'BackgroundColor', 'yellow');
set(f_handles.h_FCpb03, 'BackgroundColor', 'yellow');
set(f_handles.h_FCpb04, 'BackgroundColor', 'yellow');
set(f_handles.h_FCpb05, 'BackgroundColor', 'yellow');
set(f_handles.h_FCpb06, 'BackgroundColor', 'yellow');
set(f_handles.h_FCpb07, 'BackgroundColor', 'red');
% Update visualization
% Save output
path = [pwd filesep 'tmpct' filesep];
fileNameMat = 'TracksCoordinates.mat';
fileNameExcel = 'TracksCoordinates.xls';
pathFileNameMat = [path fileNameMat];
pathFileNameExcel = [path fileNameExcel];
if ~isempty(f_handles.pos)
pos = f_handles.pos;
if isequal(exist(pathFileNameMat, 'file'),2); delete(pathFileNameMat); save(pathFileNameMat, 'pos'); else save(pathFileNameMat, 'pos'); end;
if isequal(exist(pathFileNameExcel, 'file'),2); delete(pathFileNameExcel); xlswrite(pathFileNameExcel, pos); else xlswrite(pathFileNameExcel, pos); end;
f_handles.pos = [];
else
if isequal(exist(pathFileNameMat, 'file'),2); delete(pathFileNameMat); end;
if isequal(exist(pathFileNameExcel, 'file'),2); delete(pathFileNameExcel); end;
end
f_handles.PathImgCurrent = f_handles.PathImgOriginal;
guidata(hObject, handles);
updateSliceWindows(f_handles.startIm, f_handles.PathImgCurrent, handles);
if ishandle(f_handles.h_GUIsetG); close(f_handles.h_GUIsetG); end;
else
Message = {'Wrong parameter set.', ...
' '};
msgbox(Message,'Message')
end
catch ME1
Message = {'Wrong parameter set.', ...
' '};
msgbox(Message,'Message')
end
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit3_Callback(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit3 as text
% str2double(get(hObject,'String')) returns contents of edit3 as a double
% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit4_Callback(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit4 as text
% str2double(get(hObject,'String')) returns contents of edit4 as a double
% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit5_Callback(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit5 as text
% str2double(get(hObject,'String')) returns contents of edit5 as a double
% --- Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit6_Callback(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit6 as text
% str2double(get(hObject,'String')) returns contents of edit6 as a double
% --- Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit7_Callback(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit7 as text
% str2double(get(hObject,'String')) returns contents of edit7 as a double
% --- Executes during object creation, after setting all properties.
function edit7_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
\ No newline at end of file
File added
function varargout = CellTrackerSettingsManual(varargin)
% CELLTRACKERSETTINGSMANUAL M-file for CellTrackerSettingsManual.fig
% CELLTRACKERSETTINGSMANUAL, by itself, creates a new CELLTRACKERSETTINGSMANUAL or raises the existing
% singleton*.
%
% H = CELLTRACKERSETTINGSMANUAL returns the handle to a new CELLTRACKERSETTINGSMANUAL or the handle to
% the existing singleton*.
%
% CELLTRACKERSETTINGSMANUAL('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in CELLTRACKERSETTINGSMANUAL.M with the given input arguments.
%
% CELLTRACKERSETTINGSMANUAL('Property','Value',...) creates a new CELLTRACKERSETTINGSMANUAL or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before CellTrackerSettingsManual_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to CellTrackerSettingsManual_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 CellTrackerSettingsManual
% Last Modified by GUIDE v2.5 30-Jun-2015 10:18:11
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @CellTrackerSettingsManual_OpeningFcn, ...
'gui_OutputFcn', @CellTrackerSettingsManual_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 CellTrackerSettingsManual is made visible.
function CellTrackerSettingsManual_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 CellTrackerSettingsManual (see VARARGIN)
global f_handles
f_handles.flagGUIclosedWithXrun = 1;
% Choose default command line output for CellTrackerSettingsManual
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes CellTrackerSettingsManual wait for user response (see UIRESUME)
% uiwait(handles.figure1);
%% set parameters to show
try
% Close the other windows
if ishandle(f_handles.h_GUIsetG); close(f_handles.h_GUIsetG); end;
if ishandle(f_handles.h_GUIsetT); close(f_handles.h_GUIsetT); end;
if ishandle(f_handles.h_GUIsetS); close(f_handles.h_GUIsetS); end;
%if ishandle(f_handles.h_GUIsetM); close(f_handles.h_GUIsetM); end;
if ishandle(f_handles.h_GUIstatistics); close(f_handles.h_GUIstatistics); end;
% Interpolation selection
if f_handles.DynamicInterpolation == 1
set(handles.radiobutton1, 'Value', 1);
set(handles.radiobutton2, 'Value', 0);
else
set(handles.radiobutton1, 'Value', 0);
set(handles.radiobutton2, 'Value', 1);
end
% Method selection
if f_handles.CellMatchingModality == 0
set(handles.radiobutton3, 'Value', 1);
set(handles.radiobutton4, 'Value', 0);
else
set(handles.radiobutton3, 'Value', 0);
set(handles.radiobutton4, 'Value', 1);
end
inpImage = imread(f_handles.PathImgCurrent, 1);
[rowI, colI, chI] = size(inpImage);
numImages = length(imfinfo(f_handles.PathImgCurrent));
% Setting show
v = floor(get(f_handles.h_slider1, 'Value'));
set(handles.edit01, 'String', num2str(v));
f_handles.TrackFirstPoint = v;
set(handles.edit02, 'String', num2str(numImages));
f_handles.TrackLastPoint = numImages;
set(handles.edit03, 'String', num2str(f_handles.TrackStepPoint));
%f_handles.TrackStepPoint = 1;
% Check parameters
if f_handles.CellMaxDisp<1 || f_handles.CellMaxDisp>ceil(min([rowI, colI]))
f_handles.CellMaxDisp = ceil(min([rowI, colI])/10);
end
if f_handles.CellTempSize<1 || f_handles.CellTempSize>ceil(min([rowI, colI]))
f_handles.CellTempSize = ceil(min([rowI, colI])/10);
end
% Set parameters
set(handles.edit04, 'String', num2str(f_handles.CellMaxDisp));
set(handles.edit05, 'String', num2str(f_handles.CellTempSize));
catch ME1
Message = {'Wrong parameter set.', ...
' '};
msgbox(Message,'Message')
end
% --- Outputs from this function are returned to the command line.
function varargout = CellTrackerSettingsManual_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 during object deletion, before destroying properties.
function figure1_DeleteFcn(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)
% --- Executes when user attempts to close figure1.
function figure1_CloseRequestFcn(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)
% Hint: delete(hObject) closes the figure
global f_handles
if f_handles.flagGUIclosedWithXrun ~= 0;
f_handles.flagGUIclosedWithX = 1;
end
delete(hObject);
% --- Executes on button press in pb_saveSettings.
function pb_saveSettings_Callback(hObject, eventdata, handles)
% hObject handle to pb_saveSettings (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%% OK button to save settings
global f_handles
f_handles.flagGUIclosedWithXrun = 0;
try
if get(handles.radiobutton1, 'Value')== 1
% Check parameters
inpImage = imread(f_handles.PathImgCurrent, 1);
[rowI, colI, chI] = size(inpImage);
numImages = length(imfinfo(f_handles.PathImgCurrent));
MaxDisp = str2num(get(handles.edit04, 'String'));
TempSize = str2num(get(handles.edit05, 'String'));
flag_ComputationOn = 1;
if MaxDisp<1 || MaxDisp>ceil(min([rowI, colI]))
flag_ComputationOn = 0;
end
if TempSize<1 || TempSize>ceil(min([rowI, colI]))
flag_ComputationOn = 0;
end
if flag_ComputationOn == 1
f_handles.DynamicInterpolation = 1;
f_handles.CellMaxDisp = str2num(get(handles.edit04, 'String'));
f_handles.CellTempSize = str2num(get(handles.edit05, 'String'));
% Update visualization
if ishandle(f_handles.h_GUIsetM); close(f_handles.h_GUIsetM); end;
else
Message = {'Wrong parameter set.', ...
' '};
msgbox(Message,'Message')
end
else
f_handles.DynamicInterpolation = 0;
% Update visualization
if ishandle(f_handles.h_GUIsetM); close(f_handles.h_GUIsetM); end;
end
catch ME1
Message = {'Wrong parameter set.', ...
' '};
msgbox(Message,'Message')
end
% --- Executes during object creation, after setting all properties.
function radiobutton1_CreateFcn(hObject, eventdata, handles)
% hObject handle to radiobutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes on button press in radiobutton1.
function radiobutton1_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton1
global f_handles
if get(hObject,'Value') == 1
set(handles.radiobutton2, 'Value', 0);
f_handles.DynamicInterpolation = 1;
else
set(handles.radiobutton2, 'Value', 1);
f_handles.DynamicInterpolation = 0;
end
% --- Executes during object creation, after setting all properties.
function radiobutton2_CreateFcn(hObject, eventdata, handles)
% hObject handle to radiobutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes on button press in radiobutton2.
function radiobutton2_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton2
global f_handles
if get(hObject,'Value') == 1
set(handles.radiobutton1, 'Value', 0);
f_handles.DynamicInterpolation = 0;
else
set(handles.radiobutton1, 'Value', 1);
f_handles.DynamicInterpolation = 1;
end
% --- Executes during object creation, after setting all properties.
function edit01_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit01 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit01_Callback(hObject, eventdata, handles)
% hObject handle to edit01 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit01 as text
% str2double(get(hObject,'String')) returns contents of edit01 as a double
global f_handles;
f_handles.TrackFirstPoint = str2double(get(hObject,'String'));
% --- Executes during object creation, after setting all properties.
function edit02_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit02 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit02_Callback(hObject, eventdata, handles)
% hObject handle to edit02 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit02 as text
% str2double(get(hObject,'String')) returns contents of edit02 as a double
global f_handles;
f_handles.TrackLastPoint = str2double(get(hObject,'String'));
% --- Executes during object creation, after setting all properties.
function edit03_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit03 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit03_Callback(hObject, eventdata, handles)
% hObject handle to edit03 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit03 as text
% str2double(get(hObject,'String')) returns contents of edit03 as a double
global f_handles;
f_handles.TrackStepPoint = str2double(get(hObject,'String'));
% --- Executes during object creation, after setting all properties.
function edit04_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit04 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit04_Callback(hObject, eventdata, handles)
% hObject handle to edit04 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit04 as text
% str2double(get(hObject,'String')) returns contents of edit04 as a double
global f_handles;
f_handles.CellMaxDisp = str2double(get(hObject,'String'));
% --- Executes during object creation, after setting all properties.
function edit05_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit05 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit05_Callback(hObject, eventdata, handles)
% hObject handle to edit05 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit05 as text
% str2double(get(hObject,'String')) returns contents of edit05 as a double
global f_handles;
f_handles.CellTempSize = str2double(get(hObject,'String'));
% --- Executes on button press in radiobutton3.
function radiobutton3_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton3
global f_handles
if get(hObject,'Value') == 1
set(handles.radiobutton4, 'Value', 0);
f_handles.CellMatchingModality = 0;
else
set(handles.radiobutton4, 'Value', 1);
f_handles.CellMatchingModality = 1;
end
% --- Executes on button press in radiobutton4.
function radiobutton4_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton4
global f_handles
if get(hObject,'Value') == 1
set(handles.radiobutton3, 'Value', 0);
f_handles.CellMatchingModality = 1;
else
set(handles.radiobutton3, 'Value', 1);
f_handles.CellMatchingModality = 0;
end
File added
function varargout = CellTrackerSettingsSemi(varargin)
% CELLTRACKERSETTINGSSEMI M-file for CellTrackerSettingsSemi.fig
% CELLTRACKERSETTINGSSEMI, by itself, creates a new CELLTRACKERSETTINGSSEMI or raises the existing
% singleton*.
%
% H = CELLTRACKERSETTINGSSEMI returns the handle to a new CELLTRACKERSETTINGSSEMI or the handle to
% the existing singleton*.
%
% CELLTRACKERSETTINGSSEMI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in CELLTRACKERSETTINGSSEMI.M with the given input arguments.
%
% CELLTRACKERSETTINGSSEMI('Property','Value',...) creates a new CELLTRACKERSETTINGSSEMI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before CellTrackerSettingsSemi_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to CellTrackerSettingsSemi_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 CellTrackerSettingsSemi
% Last Modified by GUIDE v2.5 26-Jun-2015 16:29:40
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @CellTrackerSettingsSemi_OpeningFcn, ...
'gui_OutputFcn', @CellTrackerSettingsSemi_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 CellTrackerSettingsSemi is made visible.
function CellTrackerSettingsSemi_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 CellTrackerSettingsSemi (see VARARGIN)
global f_handles
f_handles.flagGUIclosedWithXrun = 1;
% Choose default command line output for CellTrackerSettingsSemi
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes CellTrackerSettingsSemi wait for user response (see UIRESUME)
% uiwait(handles.figure1);
%% set parameters to show
try
% Close the other windows
if ishandle(f_handles.h_GUIsetG); close(f_handles.h_GUIsetG); end;
if ishandle(f_handles.h_GUIsetT); close(f_handles.h_GUIsetT); end;
%if ishandle(f_handles.h_GUIsetS); close(f_handles.h_GUIsetS); end;
if ishandle(f_handles.h_GUIsetM); close(f_handles.h_GUIsetM); end;
if ishandle(f_handles.h_GUIstatistics); close(f_handles.h_GUIstatistics); end;
% Method selection
if f_handles.CellMatchingModality == 0
set(handles.radiobutton1, 'Value', 1);
set(handles.radiobutton2, 'Value', 0);
else
set(handles.radiobutton1, 'Value', 0);
set(handles.radiobutton2, 'Value', 1);
end
inpImage = imread(f_handles.PathImgCurrent, 1);
[rowI, colI, chI] = size(inpImage);
numImages = length(imfinfo(f_handles.PathImgCurrent));
% Setting show
v = floor(get(f_handles.h_slider1, 'Value'));
set(handles.edit01, 'String', num2str(v));
f_handles.TrackFirstPoint = v;
set(handles.edit02, 'String', num2str(numImages));
f_handles.TrackLastPoint = numImages;
% Check parameters
if f_handles.CellMaxDisp<1 || f_handles.CellMaxDisp>ceil(min([rowI, colI]))
f_handles.CellMaxDisp = ceil(min([rowI, colI])/10);
end
if f_handles.CellTempSize<1 || f_handles.CellTempSize>ceil(min([rowI, colI]))
f_handles.CellTempSize = ceil(min([rowI, colI])/10);
end
% Set parameters
set(handles.edit03, 'String', num2str(f_handles.CellMaxDisp));
set(handles.edit04, 'String', num2str(f_handles.CellTempSize));
catch ME1
Message = {'Wrong parameter set.', ...
' '};
msgbox(Message,'Message')
end
% --- Outputs from this function are returned to the command line.
function varargout = CellTrackerSettingsSemi_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 during object deletion, before destroying properties.
function figure1_DeleteFcn(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)
% --- Executes when user attempts to close figure1.
function figure1_CloseRequestFcn(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)
% Hint: delete(hObject) closes the figure
global f_handles
if f_handles.flagGUIclosedWithXrun ~= 0;
f_handles.flagGUIclosedWithX = 1;
end
delete(hObject);
% --- Executes on button press in pb_saveSettings.
function pb_saveSettings_Callback(hObject, eventdata, handles)
% hObject handle to pb_saveSettings (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%% OK button to save settings
global f_handles;
f_handles.flagGUIclosedWithXrun = 0;
try
if get(handles.radiobutton1, 'Value')== 1
f_handles.CellMatchingModality = 0;
else
f_handles.CellMatchingModality = 1;
end
% Check parameters
inpImage = imread(f_handles.PathImgCurrent, 1);
[rowI, colI, chI] = size(inpImage);
numImages = length(imfinfo(f_handles.PathImgCurrent));
MaxDisp = str2num(get(handles.edit03, 'String'));
TempSize = str2num(get(handles.edit04, 'String'));
flag_ComputationOn = 1;
if MaxDisp<1 || MaxDisp>ceil(min([rowI, colI]))
flag_ComputationOn = 0;
end
if TempSize<1 || TempSize>ceil(min([rowI, colI]))
flag_ComputationOn = 0;
end
if flag_ComputationOn == 1
f_handles.CellMaxDisp = str2num(get(handles.edit03, 'String'));
f_handles.CellTempSize = str2num(get(handles.edit04, 'String'));
% Update visualization
if ishandle(f_handles.h_GUIsetS); close(f_handles.h_GUIsetS); end;
else
Message = {'Wrong parameter set.', ...
' '};
msgbox(Message,'Message')
end
% Update visualization
if ishandle(f_handles.h_GUIsetS); close(f_handles.h_GUIsetMS); end;
catch ME1
Message = {'Wrong parameter set.', ...
' '};
msgbox(Message,'Message')
end
% --- Executes during object creation, after setting all properties.
function radiobutton1_CreateFcn(hObject, eventdata, handles)
% hObject handle to radiobutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes on button press in radiobutton1.
function radiobutton1_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton1
global f_handles
if get(hObject,'Value') == 1
set(handles.radiobutton2, 'Value', 0);
f_handles.CellMatchingModality = 0;
else
set(handles.radiobutton2, 'Value', 1);
f_handles.CellMatchingModality = 1;
end
% --- Executes during object creation, after setting all properties.
function radiobutton2_CreateFcn(hObject, eventdata, handles)
% hObject handle to radiobutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes on button press in radiobutton2.
function radiobutton2_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton2
global f_handles
if get(hObject,'Value') == 1
set(handles.radiobutton1, 'Value', 0);
f_handles.CellMatchingModality = 1;
else
set(handles.radiobutton1, 'Value', 1);
f_handles.CellMatchingModality = 0;
end
function edit01_Callback(hObject, eventdata, handles)
% hObject handle to edit01 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit01 as text
% str2double(get(hObject,'String')) returns contents of edit01 as a double
global f_handles
f_handles.TrackFirstPoint = str2double(get(hObject,'String'));
% --- Executes during object creation, after setting all properties.
function edit01_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit01 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit02_Callback(hObject, eventdata, handles)
% hObject handle to edit02 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit02 as text
% str2double(get(hObject,'String')) returns contents of edit02 as a double
global f_handles;
f_handles.TrackLastPoint = str2double(get(hObject,'String'));
% --- Executes during object creation, after setting all properties.
function edit02_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit02 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit03_Callback(hObject, eventdata, handles)
% hObject handle to edit03 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit03 as text
% str2double(get(hObject,'String')) returns contents of edit03 as a double
global f_handles;
f_handles.CellMaxDisp = str2double(get(hObject,'String'));
% --- Executes during object creation, after setting all properties.
function edit03_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit03 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit04_Callback(hObject, eventdata, handles)
% hObject handle to edit04 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit04 as text
% str2double(get(hObject,'String')) returns contents of edit04 as a double
global f_handles
f_handles.CellTempSize = str2double(get(hObject,'String'));
% --- Executes during object creation, after setting all properties.
function edit04_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit04 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
File added
function varargout = CellTrackerSettingsTracking(varargin)
% CELLTRACKERSETTINGSTRACKING M-file for CellTrackerSettingsTracking.fig
% CELLTRACKERSETTINGSTRACKING, by itself, creates a new CELLTRACKERSETTINGSTRACKING or raises the existing
% singleton*.
%
% H = CELLTRACKERSETTINGSTRACKING returns the handle to a new CELLTRACKERSETTINGSTRACKING or the handle to
% the existing singleton*.
%
% CELLTRACKERSETTINGSTRACKING('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in CELLTRACKERSETTINGSTRACKING.M with the given input arguments.
%
% CELLTRACKERSETTINGSTRACKING('Property','Value',...) creates a new CELLTRACKERSETTINGSTRACKING or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before CellTrackerSettingsTracking_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to CellTrackerSettingsTracking_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 CellTrackerSettingsTracking
% Last Modified by GUIDE v2.5 29-Jun-2015 10:46:15
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @CellTrackerSettingsTracking_OpeningFcn, ...
'gui_OutputFcn', @CellTrackerSettingsTracking_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 CellTrackerSettingsTracking is made visible.
function CellTrackerSettingsTracking_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 CellTrackerSettingsTracking (see VARARGIN)
global f_handles
f_handles.flagGUIclosedWithXrun = 1;
% Choose default command line output for CellTrackerSettingsTracking
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes CellTrackerSettingsTracking wait for user response (see UIRESUME)
% uiwait(handles.figure1);
%% set parameters to show
try
% Close the other windows
if ishandle(f_handles.h_GUIsetG); close(f_handles.h_GUIsetG); end;
if ishandle(f_handles.h_GUIsetS); close(f_handles.h_GUIsetS); end;
if ishandle(f_handles.h_GUIsetM); close(f_handles.h_GUIsetM); end;
if ishandle(f_handles.h_GUIstatistics); close(f_handles.h_GUIstatistics); end;
inpImage = imread(f_handles.PathImgOriginal, 1);
[rowI, colI, chI] = size(inpImage);
numImages = length(imfinfo(f_handles.PathImgOriginal));
% Check parameters
if f_handles.templateTreshold<1
f_handles.templateTreshold = 1;
end
if f_handles.tracking.mem<1 || f_handles.tracking.mem>numImages
f_handles.tracking.mem = ceil(numImages);
end
if f_handles.tracking.minlength<1 || f_handles.tracking.minlength>numImages
f_handles.tracking.minlength = ceil(numImages);
end
if f_handles.tracking.stepsize<0 || f_handles.tracking.stepsize>ceil(min([rowI, colI]))
f_handles.tracking.stepsize = ceil(min([rowI, colI]));
end
% Set parameters
set(handles.edit4, 'String', num2str(f_handles.templateTreshold));
set(handles.edit5, 'String', num2str(f_handles.tracking.mem));
set(handles.edit6, 'String', num2str(f_handles.tracking.minlength));
set(handles.edit7, 'String', num2str(f_handles.tracking.stepsize));
catch ME1
Message = {'Wrong parameter set.', ...
' '};
msgbox(Message,'Message')
end;
% --- Outputs from this function are returned to the command line.
function varargout = CellTrackerSettingsTracking_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 during object deletion, before destroying properties.
function figure1_DeleteFcn(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)
% --- Executes when user attempts to close figure1.
function figure1_CloseRequestFcn(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)
% Hint: delete(hObject) closes the figure
global f_handles
if f_handles.flagGUIclosedWithXrun ~= 0;
f_handles.flagGUIclosedWithX = 1;
end
delete(hObject);
% --- Executes on button press in pb_saveSettings.
function pb_saveSettings_Callback(hObject, eventdata, handles)
% hObject handle to pb_saveSettings (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%% OK button to save settings
global f_handles
f_handles.flagGUIclosedWithXrun = 0;
try
% Errors check
inpImage = imread(f_handles.PathImgOriginal, 1);
[rowI, colI, chI] = size(inpImage);
numImages = length(imfinfo(f_handles.PathImgOriginal));
testTemplateTreshold = str2num(get(handles.edit4, 'String'));
testTrackingMem = str2num(get(handles.edit5, 'String'));
testMinlength = str2num(get(handles.edit6, 'String'));
testStepsize = str2num(get(handles.edit7, 'String'));
flag_ComputationOn = 1;
if testTemplateTreshold<1
flag_ComputationOn = 0;
end
if testTrackingMem<1 || testTrackingMem>numImages
flag_ComputationOn = 0;
end
if testMinlength<1 || testMinlength>numImages
flag_ComputationOn = 0;
end
if testStepsize<0 || testStepsize>min([rowI, colI])
flag_ComputationOn = 0;
end
if flag_ComputationOn == 1
f_handles.templateTreshold = str2num(get(handles.edit4, 'String'));
f_handles.tracking.mem = str2num(get(handles.edit5, 'String'));
f_handles.tracking.minlength = str2num(get(handles.edit6, 'String'));
f_handles.tracking.stepsize = str2num(get(handles.edit7, 'String'));
% Reset GUI
set(f_handles.h_FCpb04, 'BackgroundColor', 'yellow');
set(f_handles.h_FCpb05, 'BackgroundColor', 'yellow');
set(f_handles.h_FCpb06, 'BackgroundColor', 'yellow');
% Update visualization
if ishandle(f_handles.h_GUIsetT); close(f_handles.h_GUIsetT); end;
else
Message = {'Wrong parameter set.', ...
' '};
msgbox(Message,'Message')
end
catch ME1
Message = {'Wrong parameter set.', ...
' '};
msgbox(Message,'Message')
end
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit3_Callback(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit3 as text
% str2double(get(hObject,'String')) returns contents of edit3 as a double
% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit4_Callback(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit4 as text
% str2double(get(hObject,'String')) returns contents of edit4 as a double
% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit5_Callback(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit5 as text
% str2double(get(hObject,'String')) returns contents of edit5 as a double
% --- Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit6_Callback(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit6 as text
% str2double(get(hObject,'String')) returns contents of edit6 as a double
% --- Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit7_Callback(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit7 as text
% str2double(get(hObject,'String')) returns contents of edit7 as a double
% --- Executes during object creation, after setting all properties.
function edit7_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
\ No newline at end of file
File added
This diff is collapsed.
function out = backgroundCorrection(inFile, startIm, stopIm, n, method)
% AUTHOR: Peter Horvath
% CellTracker Toolbox
% Copyright (C) 2015 Peter Horvath, Filippo Piccinini
% Synthetic and Systems Biology Unit
% Hungarian Academia of Sciences, BRC, Szeged. All rights reserved.
%
% This program is free software; you can redistribute it and/or modify it
% under the terms of the GNU General Public License version 3 (or higher)
% as published by the Free Software Foundation. This program is
% distributed WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
% General Public License for more details.
[xs, ys] = size(imread(inFile, startIm));
in = zeros(xs, ys, stopIm-startIm + 1, 'int16');
if n>xs || n>ys
Message = {'The black side parameter must be lower than the image side.', ...
' '};
msgbox(Message,'Message')
return;
end
%% start the process
h_wait = waitbar(0, 'Please wait...');
steps = (stopIm-startIm + 1);
% try
for i = 1:(stopIm-startIm + 1)
waitbar(i/steps)
img = imread(inFile, i+startIm-1);
in(:, :, i) = adaptivetresh(img, n, method);
end
% catch ME1
% if exist('h_wait'); if ishandle(h_wait); close(h_wait); end; end;
%
% Message = {'Could not perform this vignetting correction. Try to change correction method.', ...
% ' '};
% msgbox(Message,'Message')
% return;
% end
if exist('h_wait'); if ishandle(h_wait); close(h_wait); end; end;
%scale the data to 0-255
mini = min(in(:));
in = in - mini;
maxi = max(in(:)); maxi = double(maxi);
[pathstr, fileName, ext] = fileparts(inFile);
fileName = [pwd filesep 'tmpct' filesep fileName '_bc.tif'];
h_wait = waitbar(0, 'Please wait...');
steps = (stopIm-startIm + 1);
for i=1:(stopIm-startIm + 1)
waitbar(i/steps)
out = in(:,:,i);
out = double(out);
out = (out ./ maxi) * 255;
out = uint8(out);
if i==1
imwrite(out, fileName);
else
imwrite(out, fileName, 'WriteMode', 'append');
end
end
if exist('h_wait'); if ishandle(h_wait); close(h_wait); end; end;
function out = adaptivetresh(in, n, method)
[SizeX, SizeY] = size(in);
in = double(in);
if method == 1
small = imresize(in, 1/n);
out2 = imresize(small, [SizeX SizeY]);
elseif method == 2
% try
out = in;
counter = 1;
for i=1:floor(SizeX/n)+1
for j=1:floor(SizeY/n)+1
XLower = (i-1)*n+1;
XUpper = (i-1)*n+n;
YLower = (j-1)*n+1;
YUpper = (j-1)*n+n;
if XUpper > SizeX
XUpper = SizeX;
end
if YUpper > SizeY
YUpper = SizeY;
end
places(1, counter) = (XUpper + XLower)/2;
places(2, counter) = (YUpper + YLower)/2;
avg = mean(mean(in(XLower:XUpper, YLower:YUpper)));
values(counter) = avg;
counter = counter + 1;
end;
end;
approxFun = tpaps(places,values);
counter=1;
places = zeros(SizeX*SizeY, 2);
for i=1:SizeX
for j=1:SizeY
places(counter, 1) = i;
places(counter, 2) = j;
counter = counter + 1;
end;
end;
vals = fnval(approxFun, places');
counter = 1;
for i=1:SizeX
for j=1:SizeY
out2(i, j)=vals(counter);
counter = counter + 1;
end;
end;
% catch ME1
% Message = {'Could not perform background subtraction using TPS, make sure you have the Spline Fitting Toolbox!', ...
% ' '};
% msgbox(Message,'Message')
% return;
% end
end
out = in - out2;
\ No newline at end of file
function [result] = bfopen(id)
% A script for opening microscopy images in MATLAB using Bio-Formats.
%
% The function returns a list of image series; i.e., a cell array of cell
% arrays of (matrix, label) pairs, with each matrix representing a single
% image plane, and each inner list of matrices representing an image
% series. See below for examples of usage.
%
% Portions of this code were adapted from:
% http://www.mathworks.com/support/solutions/en/data/1-2WPAYR/
%
% This method is ~1.5x-2.5x slower than Bio-Formats's command line
% showinf tool (MATLAB 7.0.4.365 R14 SP2 vs. java 1.6.0_20),
% due to overhead from copying arrays.
%
% Thanks to all who offered suggestions and improvements:
% * Ville Rantanen
% * Brett Shoelson
% * Martin Offterdinger
% * Tony Collins
% * Cris Luengo
% * Arnon Lieber
% * Jimmy Fong
%
% NB: Internet Explorer sometimes erroneously renames the Bio-Formats library
% to loci_tools.zip. If this happens, rename it back to loci_tools.jar.
%
% Here are some examples of accessing data using the bfopen function:
%
% % read the data using Bio-Formats
% data = bfopen('C:/data/experiment.lif');
%
% % unwrap some specific image planes from the result
% numSeries = size(data, 1);
% series1 = data{1, 1};
% series2 = data{2, 1};
% series3 = data{3, 1};
% metadataList = data{1, 2};
% % ...etc.
% series1_numPlanes = size(series1, 1);
% series1_plane1 = series1{1, 1};
% series1_label1 = series1{1, 2};
% series1_plane2 = series1{2, 1};
% series1_label2 = series1{2, 2};
% series1_plane3 = series1{3, 1};
% series1_label3 = series1{3, 2};
% % ...etc.
%
% % plot the 1st series's 1st image plane in a new figure
% series1_colorMaps = data{1, 3};
% figure('Name', series1_label1);
% if isempty(series1_colorMaps{1})
% colormap(gray);
% else
% colormap(series1_colorMaps{1});
% end
% imagesc(series1_plane1);
%
% % Or if you have the image processing toolbox, you could use:
% % imshow(series1_plane1, []);
%
% % Or animate as a movie (assumes 8-bit unsigned data)
% v = linspace(0, 1, 256)';
% cmap = [v v v];
% for p = 1:series1_numPlanes
% M(p) = im2frame(uint8(series1{p, 1}), cmap);
% end
% movie(M);
%
% % Query some metadata fields (keys are format-dependent)
% subject = metadataList.get('Subject');
% title = metadataList.get('Title');
% -- Configuration - customize this section to your liking --
% Toggle the autoloadBioFormats flag to control automatic loading
% of the Bio-Formats library using the javaaddpath command.
%
% For static loading, you can add the library to MATLAB's class path:
% 1. Type "edit classpath.txt" at the MATLAB prompt.
% 2. Go to the end of the file, and add the path to your JAR file
% (e.g., C:/Program Files/MATLAB/work/loci_tools.jar).
% 3. Save the file and restart MATLAB.
%
% There are advantages to using the static approach over javaaddpath:
% 1. If you use bfopen within a loop, it saves on overhead
% to avoid calling the javaaddpath command repeatedly.
% 2. Calling 'javaaddpath' may erase certain global parameters.
autoloadBioFormats = 1;
% Toggle the stitchFiles flag to control grouping of similarly
% named files into a single dataset based on file numbering.
stitchFiles = 0;
% To work with compressed Evotec Flex, fill in your LuraWave license code.
%lurawaveLicense = 'xxxxxx-xxxxxxx';
% -- Main function - no need to edit anything past this point --
if exist('id') == 0
dir = uigetdir;
cd(dir);
file = uigetfile('*.*', 'Choose a file to open');
id = fullfile(dir, file);
end
% load the Bio-Formats library into the MATLAB environment
if autoloadBioFormats
path = fullfile(fileparts(mfilename('fullpath')), 'loci_tools.jar');
javaaddpath(path);
end
% set LuraWave license code, if available
if exist('lurawaveLicense')
path = fullfile(fileparts(mfilename('fullpath')), 'lwf_jsdk2.6.jar');
javaaddpath(path);
java.lang.System.setProperty('lurawave.license', lurawaveLicense);
end
% check MATLAB version, since typecast function requires MATLAB 7.1+
canTypecast = versionCheck(version, 7, 1);
% check Bio-Formats version, since makeDataArray2D function requires trunk
bioFormatsVersion = char(loci.formats.FormatTools.VERSION);
isBioFormatsTrunk = versionCheck(bioFormatsVersion, 5, 0);
% initialize logging
loci.common.DebugTools.enableLogging('INFO');
r = loci.formats.ChannelFiller();
r = loci.formats.ChannelSeparator(r);
if stitchFiles
r = loci.formats.FileStitcher(r);
end
tic
r.setMetadataStore(loci.formats.MetadataTools.createOMEXMLMetadata());
r.setId(id);
numSeries = r.getSeriesCount();
result = cell(numSeries, 2);
for s = 1:numSeries
fprintf('Reading series #%d', s);
r.setSeries(s - 1);
width = r.getSizeX();
height = r.getSizeY();
pixelType = r.getPixelType();
bpp = loci.formats.FormatTools.getBytesPerPixel(pixelType);
fp = loci.formats.FormatTools.isFloatingPoint(pixelType);
sgn = loci.formats.FormatTools.isSigned(pixelType);
bppMax = power(2, bpp * 8);
little = r.isLittleEndian();
numImages = r.getImageCount();
imageList = cell(numImages, 2);
colorMaps = cell(numImages);
for i = 1:numImages
if mod(i, 72) == 1
fprintf('\n ');
end
fprintf('.');
plane = r.openBytes(i - 1);
% retrieve color map data
if bpp == 1
colorMaps{s, i} = r.get8BitLookupTable()';
else
colorMaps{s, i} = r.get16BitLookupTable()';
end
warning off
if ~isempty(colorMaps{s, i})
newMap = colorMaps{s, i};
m = newMap < 0;
newMap(m) = newMap(m) + bppMax;
colorMaps{s, i} = newMap / (bppMax - 1);
end
warning on
% convert byte array to MATLAB image
if isBioFormatsTrunk && (sgn || ~canTypecast)
% can get the data directly to a matrix
arr = loci.common.DataTools.makeDataArray2D(plane, ...
bpp, fp, little, height);
else
% get the data as a vector, either because makeDataArray2D
% is not available, or we need a vector for typecast
arr = loci.common.DataTools.makeDataArray(plane, ...
bpp, fp, little);
end
% Java does not have explicitly unsigned data types;
% hence, we must inform MATLAB when the data is unsigned
if ~sgn
if canTypecast
% TYPECAST requires at least MATLAB 7.1
% NB: arr will always be a vector here
switch class(arr)
case 'int8'
arr = typecast(arr, 'uint8');
case 'int16'
arr = typecast(arr, 'uint16');
case 'int32'
arr = typecast(arr, 'uint32');
case 'int64'
arr = typecast(arr, 'uint64');
end
else
% adjust apparent negative values to actual positive ones
% NB: arr might be either a vector or a matrix here
mask = arr < 0;
adjusted = arr(mask) + bppMax / 2;
switch class(arr)
case 'int8'
arr = uint8(arr);
adjusted = uint8(adjusted);
case 'int16'
arr = uint16(arr);
adjusted = uint16(adjusted);
case 'int32'
arr = uint32(arr);
adjusted = uint32(adjusted);
case 'int64'
arr = uint64(arr);
adjusted = uint64(adjusted);
end
adjusted = adjusted + bppMax / 2;
arr(mask) = adjusted;
end
end
if isvector(arr)
% convert results from vector to matrix
shape = [width height];
arr = reshape(arr, shape)';
end
% build an informative title for our figure
label = id;
if numSeries > 1
qs = int2str(s);
label = [label, '; series ', qs, '/', int2str(numSeries)];
end
if numImages > 1
qi = int2str(i);
label = [label, '; plane ', qi, '/', int2str(numImages)];
if r.isOrderCertain()
lz = 'Z';
lc = 'C';
lt = 'T';
else
lz = 'Z?';
lc = 'C?';
lt = 'T?';
end
zct = r.getZCTCoords(i - 1);
sizeZ = r.getSizeZ();
if sizeZ > 1
qz = int2str(zct(1) + 1);
label = [label, '; ', lz, '=', qz, '/', int2str(sizeZ)];
end
sizeC = r.getSizeC();
if sizeC > 1
qc = int2str(zct(2) + 1);
label = [label, '; ', lc, '=', qc, '/', int2str(sizeC)];
end
sizeT = r.getSizeT();
if sizeT > 1
qt = int2str(zct(3) + 1);
label = [label, '; ', lt, '=', qt, '/', int2str(sizeT)];
end
end
% save image plane and label into the list
imageList{i, 1} = arr;
imageList{i, 2} = label;
end
% extract metadata table for this series
metadataList = r.getMetadata();
% save images and metadata into our master series list
result{s, 1} = imageList;
result{s, 2} = metadataList;
result{s, 3} = colorMaps;
result{s, 4} = r.getMetadataStore();
fprintf('\n');
end
r.close();
toc
% -- Helper functions --
function [result] = versionCheck(v, maj, min)
tokens = regexp(v, '[^\d]*(\d+)[^\d]+(\d+).*', 'tokens');
majToken = tokens{1}(1);
minToken = tokens{1}(2);
major = str2num(majToken{1});
minor = str2num(minToken{1});
result = major > maj || (major == maj && minor >= min);
This diff is collapsed.
function [pathstr, fileNameexEx, ext, versn] = filepartsCustom(fileName)
% AUTHOR: Peter Horvath
% CellTracker Toolbox
% Copyright (C) 2015 Peter Horvath, Filippo Piccinini
% Synthetic and Systems Biology Unit
% Hungarian Academia of Sciences, BRC, Szeged. All rights reserved.
%
% This program is free software; you can redistribute it and/or modify it
% under the terms of the GNU General Public License version 3 (or higher)
% as published by the Free Software Foundation. This program is
% distributed WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
% General Public License for more details.
[pathstr, fileNameexEx, ext] = fileparts(fileName);
versn = 1;
\ No newline at end of file
function mat = gauss2d(mat, sigma, center)
gsize = size(mat);
for r=1:gsize(1)
for c=1:gsize(2)
mat(r,c) = gaussC(r,c, sigma, center);
end
end
function val = gaussC(x, y, sigma, center)
xc = center(1);
yc = center(2);
exponent = ((x-xc).^2 + (y-yc).^2)./(2*sigma);
val = (exp(-exponent));
Supports Markdown
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