Commit 6aa69a43 authored by Walt Mankowski's avatar Walt Mankowski

expanded multitree commands to new subtree

new commands include:
  * add all hulls on frame to extended family
  * remove all hulls on frame from extended family
  * add multiple hulls at once to extended family via ctrl-click
parent 398f4191
% ContextAddAllToExtendedFamily.m - Context menu callback function for adding
% all tracks on a frame to an extended family
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Copyright 2011 Andrew Cohen, Eric Wait and Mark Winter
%
% This file is part of LEVer - the tool for stem cell lineaging. See
% https://pantherfile.uwm.edu/cohena/www/LEVer.html for details
%
% LEVer is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% LEVer is distributed in the hope that it will be useful,
% but 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.
%
% You should have received a copy of the GNU General Public License
% along with LEVer in file "gnu gpl v3.txt". If not, see
% <http://www.gnu.org/licenses/>.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function ContextAddAllToExtendedFamily(time)
global Figures
Families.MultiTreeAllTracks(time);
UI.DrawTree(Figures.tree.familyID);
UI.DrawCells();
end
......@@ -24,17 +24,21 @@
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function ContextAddToExtendedFamily(trackID)
function ContextAddToExtendedFamily(hullIDs)
global CellFamilies CellTracks Figures
familyID = CellTracks(trackID).familyID;
if ~isempty(CellFamilies(familyID).extFamily)
xfam = CellFamilies(familyID).extFamily;
if length(xfam) > 1
warn = sprintf('Track %d is already in an extended family', trackID);
warndlg(warn);
return;
trackIDs = Hulls.GetTrackID(hullIDs);
familyIDs = [CellTracks(trackIDs).familyID];
for i=1:length(familyIDs)
familyID = familyIDs(i);
if ~isempty(CellFamilies(familyID).extFamily)
xfam = CellFamilies(familyID).extFamily;
if length(xfam) > 1
warn = sprintf('Track %d is already in an extended family', trackID);
warndlg(warn);
return;
end
end
end
......@@ -57,14 +61,14 @@ function ContextAddToExtendedFamily(trackID)
return
end
if ( newTrackID == trackID )
warn = sprintf('Track %s is the current track.', newTrackIDLocal);
if ( ismember(newTrackID, trackIDs) )
warn = sprintf('Track %s is one of the selected track(s).', newTrackIDLocal);
warndlg(warn);
return;
end
newFamilyID = CellTracks(newTrackID).familyID;
newExtFamily = union(CellFamilies(newFamilyID).extFamily, [familyID newFamilyID]);
newExtFamily = union(CellFamilies(newFamilyID).extFamily, [familyIDs newFamilyID]);
[CellFamilies(newExtFamily).extFamily] = deal(newExtFamily);
UI.DrawTree(Figures.tree.familyID);
......
% ContextAddAllToExtendedFamily.m - Context menu callback function for adding
% all tracks on a frame to an extended family
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Copyright 2011 Andrew Cohen, Eric Wait and Mark Winter
%
% This file is part of LEVer - the tool for stem cell lineaging. See
% https://pantherfile.uwm.edu/cohena/www/LEVer.html for details
%
% LEVer is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% LEVer is distributed in the hope that it will be useful,
% but 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.
%
% You should have received a copy of the GNU General Public License
% along with LEVer in file "gnu gpl v3.txt". If not, see
% <http://www.gnu.org/licenses/>.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function ContextRemoveAllFromExtendedFamily()
global Figures CellFamilies
[CellFamilies(:).extFamily] = deal([]);
UI.DrawTree(Figures.tree.familyID);
UI.DrawCells();
end
......@@ -85,19 +85,30 @@ uimenu(Figures.cells.contextMenuHandle,...
'Label', 'Remove From Tree',...
'CallBack', @removeFromTree);
uimenu(Figures.cells.contextMenuHandle,...
'Label', 'Add To Extended Family',...
'CallBack', @addToExtendedFamily,...
multiTreeMenu = uimenu(Figures.cells.contextMenuHandle,...
'Label', 'Multi Tree',...
'Separator', 'on');
uimenu(Figures.cells.contextMenuHandle,...
uimenu(multiTreeMenu,...
'Label', 'Add To Extended Family',...
'CallBack', @addToExtendedFamily)
uimenu(multiTreeMenu,...
'Label', 'Remove From Extended Family',...
'CallBack', @removeFromExtendedFamily);
uimenu(Figures.cells.contextMenuHandle,...
uimenu(multiTreeMenu,...
'Label', 'Show Extended Family',...
'CallBack', @showExtendedFamily);
uimenu(multiTreeMenu,...
'Label', 'Add All To Extended Family',...
'CallBack', @addAllToExtendedFamily);
uimenu(multiTreeMenu,...
'Label', 'Remove All From Extended Family',...
'CallBack', @removeAllFromExtendedFamily);
uimenu(Figures.cells.contextMenuHandle,...
'Label', 'Properties',...
'CallBack', @properties,...
......@@ -251,10 +262,13 @@ end
function addToExtendedFamily(src,evnt)
global Figures
[hullID trackID] = UI.GetClosestCell(0);
if(isempty(trackID)),return,end
hullIDs = Figures.cells.selectedHulls;
if isempty(hullIDs)
[hullIDs ~] = UI.GetClosestCell(0);
end
if(isempty(hullIDs)),return,end
Editor.ContextAddToExtendedFamily(trackID);
Editor.ContextAddToExtendedFamily(hullIDs);
end
function removeFromExtendedFamily(src,evnt)
......@@ -274,6 +288,18 @@ function showExtendedFamily(src,evnt)
msgbox({'Extended family:', num2str(CellFamilies(familyID).extFamily)})
end
function addAllToExtendedFamily(src,evnt)
global Figures
Editor.ContextAddAllToExtendedFamily(Figures.time);
end
function removeAllFromExtendedFamily(src,evnt)
global Figures
Editor.ContextRemoveAllFromExtendedFamily();
end
function properties(src,evnt)
[hullID trackID] = UI.GetClosestCell(0);
if(isempty(trackID)),return,end
......
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