Skip to content
Snippets Groups Projects
Commit 0862de99 authored by Mark Winter's avatar Mark Winter
Browse files

Added Phenotype colors field and an arbitrary color in FixupOldFileVersions.

parent 31c0bcb0
Branches
Tags
No related merge requests found
......@@ -36,6 +36,12 @@ function bNeedsUpdate = FixOldFileVersions()
end
end
% Add color field to phenotype structure as of ver 7.2
if ( ~isfield(CellPhenotypes,'colors') )
CellPhenotypes.colors = hsv(length(CellPhenotypes.descriptions));
CellPhenotypes.colors(1,:) = [0 0 0];
end
% Add imagePixels field to CellHulls structure (and resave in place)
if ( ~isfield(CellHulls, 'imagePixels') )
fprintf('\nAdding Image Pixel Information...\n');
......@@ -51,12 +57,14 @@ function bNeedsUpdate = FixOldFileVersions()
end
% Remove HashedCells.editedFlag field as of ver 7.0
if ( ~isempty(HashedCells) && isfield(HashedCells{1}, 'editedFlag') )
if ( ~isempty(HashedCells) )
for t=1:length(HashedCells)
if ( isfield(HashedCells{t}, 'editedFlag') )
HashedCells{t} = rmfield(HashedCells{t}, 'editedFlag');
end
bNeedsUpdate = 1;
end
end
end
if ( isempty(GraphEdits) )
GraphEdits = sparse([], [], [], size(Costs,1), size(Costs,2), round(0.1*size(Costs,2)));
......@@ -95,6 +103,7 @@ function bNeedsUpdate = FixOldFileVersions()
bNeedsUpdate = 1;
end
% Get rid of timer handle in Log
for i=1:length(Log)
if(isfield(Log(i),'figures'))
if(isfield(Log(i).figures,'advanceTimerHandle'))
......
......@@ -69,9 +69,7 @@ hold on
trackHeights = containers.Map('KeyType', 'uint32', 'ValueType', 'uint32');
computeTrackHeights(trackID, trackHeights);
phenoColors = hsv(length(CellPhenotypes.descriptions));
phenoLength = length(CellPhenotypes.descriptions);
[xTracks bFamHasPheno] = simpleTraverseTree(trackID, 0, phenoLength, trackHeights);
[xTracks bFamHasPheno] = simpleTraverseTree(trackID, 0, trackHeights);
xMin = min(xTracks(:,2));
xMax = max(xTracks(:,2));
......@@ -85,7 +83,7 @@ for i=1:size(xTracks,1)
end
for i=1:size(xTracks,1)
drawVerticalEdge(xTracks(i,1), xTracks(i,2), phenoColors);
drawVerticalEdge(xTracks(i,1), xTracks(i,2));
end
if ( Figures.cells.showInterior )
......@@ -114,7 +112,7 @@ for i=1:length(hasPhenos)
color = [0 0 0];
sym = 'o';
else
color = phenoColors(hasPhenos(i),:);
color = CellPhenotypes.colors(hasPhenos(i),:);
sym = 's';
end
......@@ -171,8 +169,8 @@ function hLine = drawHorizontalEdge(xMin,xMax,y,trackID)
plot([xMin xMax],[y y],'-k','UserData',trackID,'uicontextmenu',Figures.tree.contextMenuHandle);
end
function labelHandles = drawVerticalEdge(trackID, xVal, phenoColors)
global CellTracks Figures
function labelHandles = drawVerticalEdge(trackID, xVal)
global CellTracks CellPhenotypes Figures
labelHandles = [];
bDrawLabels = strcmp('on',get(Figures.tree.menuHandles.labelsMenu, 'Checked'));
......@@ -203,7 +201,7 @@ if ( phenotype ~= 1 )
cPheno = [];
if (phenotype > 0)
cPheno = phenoColors(phenotype,:);
cPheno = CellPhenotypes.colors(phenotype,:);
end
if isempty(cPheno)
......@@ -224,7 +222,7 @@ if ( phenotype ~= 1 )
scaleMarker=1.2;
end;
color = phenoColors(phenotype,:);
color = CellPhenotypes.colors(phenotype,:);
labelHandles = [labelHandles plot(xVal,yMin,'s',...
'MarkerFaceColor', color,...
'MarkerEdgeColor', 'w',...
......@@ -279,10 +277,10 @@ else
end
end
function [xTracks bFamHasPheno] = simpleTraverseTree(trackID, xVal, phenoLength, trackHeights)
global CellTracks
function [xTracks bFamHasPheno] = simpleTraverseTree(trackID, xVal, trackHeights)
global CellTracks CellPhenotypes
bFamHasPheno = false(phenoLength,1);
bFamHasPheno = false(length(CellPhenotypes.descriptions),1);
phenoType = Tracks.GetTrackPhenotype(trackID);
if ( phenoType > 0 )
bFamHasPheno(phenoType) = 1;
......@@ -303,10 +301,10 @@ function [xTracks bFamHasPheno] = simpleTraverseTree(trackID, xVal, phenoLength,
rightChild = 1;
end
[xTracks bLeftChildHasPheno] = simpleTraverseTree(CellTracks(trackID).childrenTracks(leftChild), xVal, phenoLength, trackHeights);
[xTracks bLeftChildHasPheno] = simpleTraverseTree(CellTracks(trackID).childrenTracks(leftChild), xVal, trackHeights);
leftMax = max(xTracks(:,2));
[xChild bRightChildHasPheno] = simpleTraverseTree(CellTracks(trackID).childrenTracks(rightChild), leftMax+1, phenoLength, trackHeights);
[xChild bRightChildHasPheno] = simpleTraverseTree(CellTracks(trackID).childrenTracks(rightChild), leftMax+1, trackHeights);
xTracks = [xTracks;xChild];
bFamHasPheno = (bFamHasPheno | bLeftChildHasPheno | bRightChildHasPheno);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment