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
2ce78622
Commit
2ce78622
authored
Aug 2, 2013
by
Mark Winter
Browse files
Options
Downloads
Patches
Plain Diff
Update movie-making code to be a little simpler to use.
parent
e7f607c3
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/MATLAB/+UI/DrawCells.m
+0
-2
0 additions, 2 deletions
src/MATLAB/+UI/DrawCells.m
src/MATLAB/+UI/DrawTree.m
+7
-3
7 additions, 3 deletions
src/MATLAB/+UI/DrawTree.m
src/MATLAB/+UI/GenerateAVI.m
+63
-35
63 additions, 35 deletions
src/MATLAB/+UI/GenerateAVI.m
with
70 additions
and
40 deletions
src/MATLAB/+UI/DrawCells.m
+
0
−
2
View file @
2ce78622
...
...
@@ -32,8 +32,6 @@ function DrawCells()
global
CellFamilies
CellTracks
CellHulls
HashedCells
Figures
CONSTANTS
FluorData
if
(
isempty
(
CellFamilies
(
Figures
.
tree
.
familyID
)
.
tracks
)),
return
,
end
% figure(Figures.cells.handle);
if
(
isempty
(
FluorData
)
||
isempty
(
FluorData
(
Figures
.
time
)
.
greenInd
))
set
(
Figures
.
cells
.
timeLabel
,
'String'
,[
'Time: '
num2str
(
Figures
.
time
)]);
...
...
This diff is collapsed.
Click to expand it.
src/MATLAB/+UI/DrawTree.m
+
7
−
3
View file @
2ce78622
...
...
@@ -23,10 +23,14 @@
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function
DrawTree
(
familyID
)
function
DrawTree
(
familyID
,
endTime
)
global
CellFamilies
CellTracks
HashedCells
Figures
CellPhenotypes
ResegState
FluorData
HaveFluor
if
(
~
exist
(
'endTime'
,
'var'
)
)
endTime
=
length
(
HashedCells
);
end
if
(
~
exist
(
'familyID'
,
'var'
)
||
isempty
(
familyID
)
)
Families
.
FindLargestTree
();
return
;
...
...
@@ -48,7 +52,7 @@ if ( ~isfield(Figures.tree,'axesHandle') || isempty(Figures.tree.axesHandle) )
set
(
Figures
.
tree
.
axesHandle
,
...
'YDir'
,
'reverse'
,
...
'YLim'
,
[
-
25
l
en
gth
(
HashedCells
)
],
...
'YLim'
,
[
-
25
en
dTime
],
...
'Position'
,
[
.
06
.
06
.
90
.
90
],
...
'XColor'
,
'w'
,
...
'XTick'
,
[],
...
...
...
@@ -121,7 +125,7 @@ end
UI
.
DrawPool
.
FinishDraw
(
Figures
.
tree
.
axesHandle
);
set
(
Figures
.
tree
.
axesHandle
,
'XLim'
,
[
xMin
-
1
xMax
+
1
],
'YLim'
,[
-
25
l
en
gth
(
HashedCells
)
]);
set
(
Figures
.
tree
.
axesHandle
,
'XLim'
,
[
xMin
-
1
xMax
+
1
],
'YLim'
,[
-
25
en
dTime
]);
% Figures.tree.axesHandle = overAxes;
if
(
CellFamilies
(
familyID
)
.
bLocked
)
...
...
This diff is collapsed.
Click to expand it.
src/MATLAB/+UI/GenerateAVI.m
+
63
−
35
View file @
2ce78622
...
...
@@ -27,12 +27,39 @@ function GenerateAVI(src, evt)
global
Figures
CONSTANTS
HashedCells
defaultPath
=
fileparts
(
CONSTANTS
.
matFullFile
);
defaultFile
=
[
CONSTANTS
.
datasetName
'.mp4'
];
[
movieFile
,
moviePath
]
=
uiputfile
(
'*.mp4'
,
'Save Movie'
,
fullfile
(
defaultPath
,
defaultFile
));
if
(
movieFile
==
0
)
return
;
end
movieFile
=
fullfile
(
moviePath
,
movieFile
);
endAns
=
inputdlg
(
'Enter stop frame for movie:'
,
'Movie end time'
,
1
,
{
num2str
(
length
(
HashedCells
))});
if
(
isempty
(
endAns
)
)
return
;
end
nframes
=
str2double
(
endAns
);
nframes
=
max
(
nframes
,
20
);
nframes
=
min
(
nframes
,
length
(
HashedCells
));
tic
nframes
=
length
(
HashedCells
);
oldDrawOffTree
=
get
(
Figures
.
cells
.
menuHandles
.
treeLabelsOn
,
'Checked'
);
oldTreePos
=
get
(
Figures
.
tree
.
handle
,
'Position'
);
oldCellPos
=
get
(
Figures
.
cells
.
handle
,
'Position'
);
set
(
Figures
.
cells
.
menuHandles
.
treeLabelsOn
,
'Checked'
,
'off'
);
UI
.
DrawTree
(
Figures
.
tree
.
familyID
,
nframes
);
movieDims
=
[
1920
1080
];
xLim
=
get
(
get
(
Figures
.
cells
.
handle
,
'CurrentAxes'
),
'XLim'
);
yLim
=
get
(
get
(
Figures
.
cells
.
handle
,
'CurrentAxes'
),
'YLim'
);
mp
=
get
(
0
,
'monitorpositions'
);
idxPrimaryMonitor
=
find
(
mp
(:,
1
)
==
1
&
mp
(:,
2
)
==
1
);
if
isempty
(
idxPrimaryMonitor
)
...
...
@@ -43,26 +70,21 @@ end
mp
=
mp
(
idxPrimaryMonitor
,:);
if
mp
(
3
)
<
960
||
mp
(
4
)
<
1080
fprintf
(
1
,
'monitor resolution too low for
1080p video'
);
Error
.
LogAction
(
'GenerateAVI: monitor resolution too low for
1080p
video'
,
0
,
0
);
if
(
mp
(
3
)
<
(
movieDims
(
1
)/
2
)
||
mp
(
4
)
<
movieDims
(
2
)
)
fprintf
(
1
,
'monitor resolution too low for
%d by %d video'
,
movieDims
(
1
),
movieDims
(
2
)
);
Error
.
LogAction
(
'GenerateAVI: monitor resolution too low for
%d by %d
video'
,
0
,
0
);
end
set
(
Figures
.
cells
.
handle
,
'outerposition'
,[
mp
(
3
)
-
960
mp
(
4
)
-
1080
960
1080
]);
set
(
Figures
.
tree
.
handle
,
'outerposition'
,[
mp
(
3
)
-
960
mp
(
4
)
-
1080
960
1080
]);
% Split movie into approximately 1GB chunks
mvsize
=
2
*
1920
*
1080
*
nframes
;
mvsplits
=
ceil
(
mvsize
/
(
2
^
30
));
tStarts
=
round
(((
0
:
mvsplits
)/
mvsplits
)
*
nframes
)
+
1
;
set
(
Figures
.
cells
.
handle
,
'position'
,[
mp
(
3
)
-
(
movieDims
(
1
)/
2
)
mp
(
4
)
-
movieDims
(
2
)
(
movieDims
(
1
)/
2
)
movieDims
(
2
)]);
set
(
Figures
.
tree
.
handle
,
'position'
,[
mp
(
3
)
-
(
movieDims
(
1
)/
2
)
mp
(
4
)
-
movieDims
(
2
)
(
movieDims
(
1
)/
2
)
movieDims
(
2
)]);
for
i
=
1
:
mvsplits
outfile
=
[
CONSTANTS
.
datasetName
'_uncomp'
num2str
(
i
,
'%02d'
)
'.avi'
];
aviobj
=
avifile
(
outfile
,
'compression'
,
'none'
);
vidObj
=
VideoWriter
(
movieFile
,
'MPEG-4'
);
vidObj
.
Quality
=
100
;
vidObj
.
FrameRate
=
20
;
open
(
vidObj
);
tStart
=
tStarts
(
i
)
;
tEnd
=
tStarts
(
i
+
1
)
-
1
;
tStart
=
1
;
tEnd
=
nframes
;
for
t
=
tStart
:
tEnd
UI
.
TimeChange
(
t
);
...
...
@@ -77,18 +99,24 @@ for i=1:mvsplits
X
=
getframe
();
i2
=
X
.
cdata
;
dim
=
[
1080
960
];
dim
=
[
movieDims
(
2
)
(
movieDims
(
1
)/
2
)
];
i1
=
imresize
(
i1
,
[
dim
(
1
)
dim
(
2
)]);
i2
=
imresize
(
i2
,
[
dim
(
1
)
dim
(
2
)]);
icomp
=
[
i1
i2
];
fr
=
im2frame
(
icomp
);
aviobj
=
addframe
(
avio
bj
,
fr
);
writeVideo
(
vidO
bj
,
fr
);
end
aviobj
=
close
(
aviobj
);
end
close
(
vidObj
);
set
(
Figures
.
cells
.
menuHandles
.
treeLabelsOn
,
'Checked'
,
oldDrawOffTree
);
set
(
Figures
.
tree
.
handle
,
'Position'
,
oldTreePos
);
set
(
Figures
.
cells
.
handle
,
'Position'
,
oldCellPos
);
UI
.
DrawTree
(
Figures
.
tree
.
familyID
);
tElapsed
=
toc
;
Error
.
LogAction
(
'GenerateAVI: elapsed time'
,
tElapsed
,
0
);
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
register
or
sign in
to comment