Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LEVER
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenSource
LEVER
Commits
e9237145
Commit
e9237145
authored
Apr 2, 2013
by
Mark Winter
Browse files
Options
Downloads
Patches
Plain Diff
Actually add colors when creating a new phenotype. Uses the "bright" track color table.
parent
0862de99
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/MATLAB/+Editor/AddPhenotype.m
+34
-1
34 additions, 1 deletion
src/MATLAB/+Editor/AddPhenotype.m
with
34 additions
and
1 deletion
src/MATLAB/+Editor/AddPhenotype.m
+
34
−
1
View file @
e9237145
...
...
@@ -6,9 +6,21 @@
% undo stack it will always be followed by a ContextSetPhenotype action.
function
[
historyAction
phenoID
]
=
AddPhenotype
(
description
)
global
CellPhenotypes
global
CellPhenotypes
Colors
if
(
isempty
(
Colors
)
)
Load
.
CreateColors
();
end
% Find all colors that haven't been used yet
phenoColors
=
vertcat
(
CellPhenotypes
.
colors
);
allowedColors
=
getAllowedColors
(
phenoColors
);
newColorIdx
=
randi
(
size
(
allowedColors
,
1
));
newPhenoColor
=
allowedColors
(
newColorIdx
,:);
CellPhenotypes
.
descriptions
=
[
CellPhenotypes
.
descriptions
description
];
CellPhenotypes
.
colors
=
[
CellPhenotypes
.
colors
;
newPhenoColor
];
phenoID
=
length
(
CellPhenotypes
.
descriptions
);
...
...
@@ -16,3 +28,24 @@ function [historyAction phenoID] = AddPhenotype(description)
historyAction
=
''
;
end
function
[
allowedColors
bAllowedColors
]
=
getAllowedColors
(
phenoColors
)
global
Colors
if
(
isempty
(
Colors
)
)
Load
.
CreateColors
();
end
bAllowedColors
=
false
(
size
(
Colors
,
1
),
1
);
for
i
=
1
:
size
(
Colors
,
1
)
dists
=
sum
((
ones
(
size
(
phenoColors
,
1
),
1
)
*
Colors
(
i
,
1
:
3
)
-
phenoColors
)
.^
2
,
2
);
minDist
=
min
(
dists
);
% A dubious threshold, but less than anything in the table
if
(
minDist
>
(
0.1
^
2
)
)
bAllowedColors
(
i
)
=
1
;
end
end
allowedColors
=
Colors
(
bAllowedColors
,
1
:
3
);
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment