Skip to content
Snippets Groups Projects
Commit 232053bb authored by Eric Wait's avatar Eric Wait
Browse files

LEVer 4.2

parent b8078501
No related branches found
No related tags found
No related merge requests found
mcc -m ../LEVer.m mcc -m ..\LEVer.m
mcc -m ../Segmentor.m mcc -m ..\Segmentor.m
system('copy Segmentor.exe ..\.');
if(isempty(dir('./MTC.exe'))) if(isempty(dir('./MTC.exe')))
warndlg('Make sure that MTC.exe is in the same dir as LEVer.exe'); warndlg('Make sure that MTC.exe is in the same dir as LEVer.exe');
end end
\ No newline at end of file
function AddFields()
global HashedCells
if(~isfield([HashedCells{:}],'editedFlag'))
for i=1:length(HashedCells)
for j = 1:length(HashedCells{i})
HashedCells{i}(j).editedFlag = 0;
end
end
end
end
\ No newline at end of file
...@@ -17,7 +17,7 @@ if(~isempty(trackID)) ...@@ -17,7 +17,7 @@ if(~isempty(trackID))
% Try to split the existing hull % Try to split the existing hull
History('Push'); History('Push');
try try
newTracks = SplitHull(hullID,num+1);%adding one to the number so that the original hull is accounted for newTracks = SplitHull(hullID,num);
if(isempty(newTracks)) if(isempty(newTracks))
msgbox(['Unable to split ' num2str(trackID) ' any further in this frame'],'Unable to Split','help','modal'); msgbox(['Unable to split ' num2str(trackID) ' any further in this frame'],'Unable to Split','help','modal');
return return
......
...@@ -18,7 +18,7 @@ if(CellTracks(newParentID).startTime > time) ...@@ -18,7 +18,7 @@ if(CellTracks(newParentID).startTime > time)
msgbox(['Parent ' num2str(newParentID) ' comes after ' num2str(trackID) ' consider a different edit.'],'Parent Change','warn'); msgbox(['Parent ' num2str(newParentID) ' comes after ' num2str(trackID) ' consider a different edit.'],'Parent Change','warn');
return return
elseif(CellTracks(trackID).endTime < CellTracks(newParentID).startTime) elseif(CellTracks(trackID).endTime < CellTracks(newParentID).startTime)
msgbox(['Sibling ' num2str(trackID) ' exists completely before ' num2str(newParentID) ' consider a rename instead.'],'Parent Change','warn'); msgbox(['Sister Cell ' num2str(trackID) ' exists completely before ' num2str(newParentID) ' consider a rename instead.'],'Parent Change','warn');
return return
end end
......
...@@ -32,28 +32,23 @@ uimenu(Figures.cells.contextMenuHandle,... ...@@ -32,28 +32,23 @@ uimenu(Figures.cells.contextMenuHandle,...
% 'CallBack', @changeParent); % 'CallBack', @changeParent);
addHull = uimenu(Figures.cells.contextMenuHandle,... addHull = uimenu(Figures.cells.contextMenuHandle,...
'Label', 'Add Hull',... 'Label', 'Add Segmentation',...
'Separator', 'on'); 'Separator', 'on');
uimenu(addHull,... uimenu(addHull,...
'Label', 'Number of Hulls to add'); 'Label', 'Number of Cells');
uimenu(addHull,...
'Label', '1',...
'Separator', 'on',...
'CallBack', @addHull1);
uimenu(addHull,... uimenu(addHull,...
'Label', '2',... 'Label', '2',...
'CallBack', @addHull2); 'CallBack', @addHull1);
uimenu(addHull,... uimenu(addHull,...
'Label', '3',... 'Label', '3',...
'CallBack', @addHull3); 'CallBack', @addHull1);
uimenu(addHull,... uimenu(addHull,...
'Label', '4',... 'Label', '4',...
'CallBack', @addHull4); 'CallBack', @addHull3);
uimenu(addHull,... uimenu(addHull,...
'Label', 'Other',... 'Label', 'Other',...
...@@ -61,7 +56,7 @@ uimenu(addHull,... ...@@ -61,7 +56,7 @@ uimenu(addHull,...
'CallBack', @addHullOther); 'CallBack', @addHullOther);
uimenu(Figures.cells.contextMenuHandle,... uimenu(Figures.cells.contextMenuHandle,...
'Label', 'Remove Hull',... 'Label', 'Remove Cell',...
'CallBack', @removeHull); 'CallBack', @removeHull);
uimenu(Figures.cells.contextMenuHandle,... uimenu(Figures.cells.contextMenuHandle,...
...@@ -141,7 +136,7 @@ if(isempty(trackID)),return,end ...@@ -141,7 +136,7 @@ if(isempty(trackID)),return,end
% answer = inputdlg({['Enter new sibling of ' num2str(trackID)],'Enter Time of Mitosis'},... % answer = inputdlg({['Enter new sibling of ' num2str(trackID)],'Enter Time of Mitosis'},...
% 'Add Mitosis',1,{'',num2str(Figures.time)}); % 'Add Mitosis',1,{'',num2str(Figures.time)});
answer = inputdlg({['Enter new sibling of ' num2str(trackID)]},... answer = inputdlg({['Enter new sister of cell' num2str(trackID)]},...
'Add Mitosis',1,{''}); 'Add Mitosis',1,{''});
if(isempty(answer)),return,end if(isempty(answer)),return,end
...@@ -154,11 +149,11 @@ if(siblingTrack>length(CellTracks) || isempty(CellTracks(siblingTrack).hulls)) ...@@ -154,11 +149,11 @@ if(siblingTrack>length(CellTracks) || isempty(CellTracks(siblingTrack).hulls))
return return
end end
if(CellTracks(siblingTrack).endTime<time || siblingTrack==trackID) if(CellTracks(siblingTrack).endTime<time || siblingTrack==trackID)
msgbox([answer(1) ' is not a valid sibling'],'Not a valid sibling','error'); msgbox([answer(1) ' is not a valid sister cell'],'Not a valid sister cell','error');
return return
end end
if(CellTracks(trackID).startTime>time) if(CellTracks(trackID).startTime>time)
msgbox([num2str(trackID) ' exists after ' answer(1)],'Not a valid child','error'); msgbox([num2str(trackID) ' exists after ' answer(1)],'Not a valid daughter cell','error');
return return
end end
if(~isempty(CellTracks(siblingTrack).timeOfDeath) && CellTracks(siblingTrack).timeOfDeath<=time) if(~isempty(CellTracks(siblingTrack).timeOfDeath) && CellTracks(siblingTrack).timeOfDeath<=time)
...@@ -201,7 +196,7 @@ elseif(CellTracks(siblingTrack).startTime==time && CellTracks(trackID).startTime ...@@ -201,7 +196,7 @@ elseif(CellTracks(siblingTrack).startTime==time && CellTracks(trackID).startTime
elseif(CellTracks(siblingTrack).startTime==time && CellTracks(trackID).startTime==time) elseif(CellTracks(siblingTrack).startTime==time && CellTracks(trackID).startTime==time)
valid = 0; valid = 0;
while(~valid) while(~valid)
answer = inputdlg({'Enter parent of these siblings '},'Parent',1,{''}); answer = inputdlg({'Enter parent of these daughter cells '},'Parent',1,{''});
if(isempty(answer)),return,end if(isempty(answer)),return,end
parentTrack = str2double(answer(1)); parentTrack = str2double(answer(1));
...@@ -297,10 +292,6 @@ if(isempty(trackID)),return,end ...@@ -297,10 +292,6 @@ if(isempty(trackID)),return,end
ContextChangeParent(trackID,Figures.time); ContextChangeParent(trackID,Figures.time);
end end
function addHull1(src,evnt)
AddHull(1);
end
function addHull2(src,evnt) function addHull2(src,evnt)
AddHull(2); AddHull(2);
end end
...@@ -314,7 +305,7 @@ AddHull(4); ...@@ -314,7 +305,7 @@ AddHull(4);
end end
function addHullOther(src,evnt) function addHullOther(src,evnt)
num = inputdlg('Enter Number of Hulls to Add','Add Hulls',1,{'1'}); num = inputdlg('Enter Number of Cells Present','Add Hulls',1,{'1'});
if(isempty(num)),return,end; if(isempty(num)),return,end;
num = str2double(num(1)); num = str2double(num(1));
AddHull(num); AddHull(num);
...@@ -352,7 +343,7 @@ if(isempty(CellFamilies(Figures.tree.familyID).tracks)) ...@@ -352,7 +343,7 @@ if(isempty(CellFamilies(Figures.tree.familyID).tracks))
end end
DrawTree(Figures.tree.familyID); DrawTree(Figures.tree.familyID);
DrawCells(); DrawCells();
msgbox(['By removing this hull, the complete tree is no more. Displaying tree rooted at ' num2str(CellFamilies(i).rootTrackID) ' instead'],'Displaying Tree','help'); msgbox(['By removing this cell, the complete tree is no more. Displaying clone rooted at ' num2str(CellFamilies(i).rootTrackID) ' instead'],'Displaying Tree','help');
return return
end end
......
...@@ -140,7 +140,7 @@ trackID = get(gco,'UserData'); ...@@ -140,7 +140,7 @@ trackID = get(gco,'UserData');
time = get(gca,'CurrentPoint'); time = get(gca,'CurrentPoint');
time = round(time(1,2)); time = round(time(1,2));
answer = inputdlg({'Enter Time of Mitosis',['Enter new sibling of ' num2str(trackID)]},... answer = inputdlg({'Enter Time of Mitosis',['Enter new sister cell of ' num2str(trackID)]},...
'Add Mitosis',1,{num2str(time),''}); 'Add Mitosis',1,{num2str(time),''});
if(isempty(answer)),return,end if(isempty(answer)),return,end
...@@ -153,7 +153,7 @@ if(siblingTrack>length(CellTracks) || isempty(CellTracks(siblingTrack).hulls)) ...@@ -153,7 +153,7 @@ if(siblingTrack>length(CellTracks) || isempty(CellTracks(siblingTrack).hulls))
return return
end end
if(CellTracks(trackID).startTime>time) if(CellTracks(trackID).startTime>time)
msgbox([num2str(trackID) ' exists after ' answer(1)],'Not a valid child','error'); msgbox([num2str(trackID) ' exists after ' answer(1)],'Not a valid daughter cell','error');
return return
end end
......
...@@ -97,7 +97,7 @@ labelsMenu = uimenu(... ...@@ -97,7 +97,7 @@ labelsMenu = uimenu(...
siblingsMenu = uimenu(... siblingsMenu = uimenu(...
'Parent', viewMenu,... 'Parent', viewMenu,...
'Label', 'Show Sibling Relationships',... 'Label', 'Show Sister Cell Relationships',...
'HandleVisibility', 'callback',... 'HandleVisibility', 'callback',...
'Callback', @toggleSiblings,... 'Callback', @toggleSiblings,...
'Checked', 'off',... 'Checked', 'off',...
......
...@@ -36,10 +36,10 @@ end ...@@ -36,10 +36,10 @@ end
function objsSegment=GetDistances(objsSegment,HashedHulls,t1,t2) function objsSegment=GetDistances(objsSegment,HashedHulls,t1,t2)
bwHalo1=GetHalo(t1); % bwHalo1=GetHalo(t1);
bwHalo2=GetHalo(t2); % bwHalo2=GetHalo(t2);
bwCombo=GetCombo(bwHalo1,bwHalo2,objsSegment,HashedHulls,t1,t2); % bwCombo=GetCombo(bwHalo1,bwHalo2,objsSegment,HashedHulls,t1,t2);
LCombo=bwlabel(bwCombo); % LCombo=bwlabel(bwCombo);
for i=1:length(HashedHulls{t1}) for i=1:length(HashedHulls{t1})
hi=HashedHulls{t1}(i); hi=HashedHulls{t1}(i);
ipix=objsSegment(hi).indPixels; ipix=objsSegment(hi).indPixels;
......
function trackID = GetTrackID(hullID) function trackIDs = GetTrackID(hullIDs,time)
%Given a hull ID a track ID will be returned or [] if none found %Given a hull ID a track ID will be returned or [] if none found
%--Eric Wait %--Eric Wait
global CellHulls HashedCells global CellHulls HashedCells
trackID = []; trackIDs = [];
if(hullID>length(CellHulls)) if(~exist('time','var'))
for i=1:length(hullIDs)
if(hullIDs(i)>length(CellHulls))
continue
else
hullTime = CellHulls(hullIDs(i)).time;
hashedCellIndex = [HashedCells{hullTime}.hullID] == hullIDs(i);
if(isempty(hashedCellIndex)),continue,end
trackIDs = [trackIDs HashedCells{hullTime}(hashedCellIndex).trackID];
end
end
else
if(time>length(HashedCells))
return return
else else
hullTime = CellHulls(hullID).time; trackIDs = [HashedCells{time}(ismember([HashedCells{time}.hullID],hullIDs)).trackID];
hashedCellIndex = [HashedCells{hullTime}.hullID] == hullID;
if(isempty(hashedCellIndex)),return,end
trackID = HashedCells{hullTime}(hashedCellIndex).trackID;
end end
end end
\ No newline at end of file
...@@ -7,7 +7,7 @@ function opened = OpenData() ...@@ -7,7 +7,7 @@ function opened = OpenData()
global Figures Colors CONSTANTS CellFamilies CellHulls HashedCells Costs CellTracks global Figures Colors CONSTANTS CellFamilies CellHulls HashedCells Costs CellTracks
if(isempty(Figures)) if(isempty(Figures))
fprintf('LEVer ver 4.1\n***DO NOT DISTRIBUTE***\n\n'); fprintf('LEVer ver 4.2\n***DO NOT DISTRIBUTE***\n\n');
end end
if(exist('ColorScheme.mat','file')) if(exist('ColorScheme.mat','file'))
...@@ -141,6 +141,7 @@ switch answer ...@@ -141,6 +141,7 @@ switch answer
fprintf(['New file saved as:\n' CONSTANTS.datasetName '_LEVer.mat']); fprintf(['New file saved as:\n' CONSTANTS.datasetName '_LEVer.mat']);
goodLoad = 1; goodLoad = 1;
elseif(exist('CellHulls','var')) elseif(exist('CellHulls','var'))
TestDataIntegrity(1);
goodLoad = 1; goodLoad = 1;
else else
errordlg('Data either did not load properly or is not the right format for LEVer.'); errordlg('Data either did not load properly or is not the right format for LEVer.');
......
...@@ -24,6 +24,8 @@ for timeStart=1:step:numberOfImages ...@@ -24,6 +24,8 @@ for timeStart=1:step:numberOfImages
system(['start Segmentor ' num2str(timeStart) ' ' num2str(step-1) ' "' ... system(['start Segmentor ' num2str(timeStart) ' ' num2str(step-1) ' "' ...
CONSTANTS.rootImageFolder(1:end-1) '" ' CONSTANTS.datasetName ' ' ... CONSTANTS.rootImageFolder(1:end-1) '" ' CONSTANTS.datasetName ' ' ...
num2str(CONSTANTS.imageAlpha) ' ' num2str(CONSTANTS.imageSignificantDigits) ' && exit']); num2str(CONSTANTS.imageAlpha) ' ' num2str(CONSTANTS.imageSignificantDigits) ' && exit']);
%use line below instead of the 3 lines above for non-parallel or to debug
% Segmentor(timeStart,step-1,CONSTANTS.rootImageFolder(1:end-1),CONSTANTS.datasetName,CONSTANTS.imageAlpha,CONSTANTS.imageSignificantDigits);
end end
for i=1:step:numberOfImages for i=1:step:numberOfImages
...@@ -46,13 +48,13 @@ end ...@@ -46,13 +48,13 @@ end
fprintf('Please wait...'); fprintf('Please wait...');
cellSegments = GetDarkConnectedHulls(cellSegments); cellSegments = GetDarkConnectedHulls(cellSegments);
save ( ['SegObjs_' CONSTANTS.datasetName '.mat'],'cellSegments'); save ( ['.\segmentationData\SegObjs_' CONSTANTS.datasetName '.mat'],'cellSegments');
WriteSegData(cellSegments,CONSTANTS.datasetName); WriteSegData(cellSegments,CONSTANTS.datasetName);
fprintf(1,'\nDone\n'); fprintf(1,'\nDone\n');
fnameIn=['SegObjs_' CONSTANTS.datasetName '.txt']; fnameIn=['.\segmentationData\SegObjs_' CONSTANTS.datasetName '.txt'];
fnameOut=['Tracked_' CONSTANTS.datasetName '.txt']; fnameOut=['.\segmentationData\Tracked_' CONSTANTS.datasetName '.txt'];
tSeg=toc; tSeg=toc;
%% Tracking %% Tracking
......
...@@ -30,10 +30,7 @@ for t = tStart:tStart + tLength ...@@ -30,10 +30,7 @@ for t = tStart:tStart + tLength
fname=[rootImageFolder '\' datasetName '_t' frameT '.TIF']; fname=[rootImageFolder '\' datasetName '_t' frameT '.TIF'];
if(isempty(dir(fname))),continue,end if(isempty(dir(fname))),continue,end
fprintf('%d, ', t); fprintf('%d%%...',ceil((t-tStart)/tLength*100));
if ( mod(t,20) == 0 )
fprintf('\n');
end
[im map]=imread(fname); [im map]=imread(fname);
im=mat2gray(im); im=mat2gray(im);
...@@ -254,4 +251,6 @@ end ...@@ -254,4 +251,6 @@ end
fileName = ['.\segmentationData\objs_' num2str(tStart) '.mat']; fileName = ['.\segmentationData\objs_' num2str(tStart) '.mat'];
if(isempty(dir('.\segmentationData'))),system('mkdir .\segmentationData');end if(isempty(dir('.\segmentationData'))),system('mkdir .\segmentationData');end
save(fileName,'objs'); save(fileName,'objs');
fprintf('\tDone\n');
end end
\ No newline at end of file
function TestDataIntegrity(correct) function TestDataIntegrity(correct)
%TestDataIntegrity(correct) tests to make sure that the database is consistant. %TestDataIntegrity(correct) tests to make sure that the database is consistant.
%Takes the CellTracks as the most accurate. If correct=='yes', this %Takes the CellTracks as the most accurate. If correct==1, this
%function will attempt to correct the error using the data from CellTracks %function will attempt to correct the error using the data from CellTracks
%***USE SPARINGLY, TAKES A LOT OF TIME*** %***USE SPARINGLY, TAKES A LOT OF TIME***
...@@ -10,6 +10,7 @@ global CellTracks CellHulls CellFamilies HashedCells ...@@ -10,6 +10,7 @@ global CellTracks CellHulls CellFamilies HashedCells
hullsList = []; hullsList = [];
fprintf('Checking CellTracks...'); fprintf('Checking CellTracks...');
AddFields();
progress = 0; progress = 0;
iterations = length(CellTracks); iterations = length(CellTracks);
for i=1:length(CellTracks) for i=1:length(CellTracks)
...@@ -117,21 +118,21 @@ end ...@@ -117,21 +118,21 @@ end
%% check CellHulls %% check CellHulls
% if(length(hullsList)~=length(find([CellHulls.deleted]==0))) % if(length(hullsList)~=length(find([CellHulls.deleted]==0)))
missingHulls = find(ismember(find([CellHulls.deleted]==0),hullsList')==0); missingHulls = find(ismember(find([CellHulls.deleted]==0),hullsList')==0);
% if(~isempty(missingHulls)) if(~isempty(missingHulls))
% if(correct) if(correct)
% progress = 0; progress = 0;
% iterations = length(missingHulls); iterations = length(missingHulls);
% for i=1:length(missingHulls) for i=1:length(missingHulls)
% progress = progress+1; progress = progress+1;
% Progressbar(progress/iterations); Progressbar(progress/iterations);
% if(isempty(CellHulls(missingHulls(i)).points)) if(isempty(CellHulls(missingHulls(i)).points))
% CellHulls(missingHulls(i)).deleted = 1; CellHulls(missingHulls(i)).deleted = 1;
% end end
% end end
% else else
% error('HullsList ~= CellHulls'); error('HullsList ~= CellHulls');
% end end
% end end
Progressbar(1);%clear it out Progressbar(1);%clear it out
fprintf('\nDone\n'); fprintf('\nDone\n');
......
...@@ -7,7 +7,7 @@ HashedHulls=cell(th,1); ...@@ -7,7 +7,7 @@ HashedHulls=cell(th,1);
for n=1:length(objsSegment) for n=1:length(objsSegment)
HashedHulls{objsSegment(n).t}=[HashedHulls{objsSegment(n).t};n]; HashedHulls{objsSegment(n).t}=[HashedHulls{objsSegment(n).t};n];
end end
fname=['SegObjs_' DatasetName '.txt']; fname=['.\segmentationData\SegObjs_' DatasetName '.txt'];
fid=fopen(fname,'wt'); fid=fopen(fname,'wt');
fprintf(fid,'%d %d\n',th,length(objsSegment) ); fprintf(fid,'%d %d\n',th,length(objsSegment) );
for i=1:length(HashedHulls) for i=1:length(HashedHulls)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment