Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MAT
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
MAT
Commits
ce616eb0
Commit
ce616eb0
authored
Feb 21, 2013
by
Mark Winter
Browse files
Options
Downloads
Patches
Plain Diff
Added read/write code samples from LEVer.
parent
5171cd21
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
samples/TestReadTrackData.m
+77
-0
77 additions, 0 deletions
samples/TestReadTrackData.m
samples/TestWriteSegData.m
+63
-0
63 additions, 0 deletions
samples/TestWriteSegData.m
with
140 additions
and
0 deletions
samples/TestReadTrackData.m
0 → 100644
+
77
−
0
View file @
ce616eb0
% [objTracks gConnect] = SampleReadTrackData(DatasetDir, DatasetName) - Sample LEVer track data writer.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Copyright 2013 Andrew Cohen, Eric Wait and Mark Winter
%
% This file is part of LEVer - the tool for stem cell lineaging. See
% http://bioimage.coe.drexel.edu 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
[
objTracks
gConnect
]
=
SampleReadTrackData
(
DatasetDir
,
DatasetName
)
global
CellHulls
bValidCell
=
~
[
CellHulls
.
deleted
];
backMap
=
find
(
bValidCell
);
objTracks
=
struct
(
'Label'
,
cell
(
1
,
length
(
CellHulls
)),
'ccc'
,
cell
(
1
,
length
(
CellHulls
)),
...
'outID'
,{
0
},
'inID'
,{
0
});
fname
=
fullfile
(
DatasetDir
,[
'Tracked_'
DatasetName
'.txt'
]);
fid
=
fopen
(
fname
,
'rt'
);
bDone
=
0
;
TrackList
=
[];
while
~
bDone
dd
=
fscanf
(
fid
,
'%d,%d,%d\n'
,
3
);
if
-
1
==
dd
(
1
)
bDone
=
1
;
break
end
TrackList
=
[
TrackList
;
dd
'
];
end
bDone
=
0
;
InList
=
[];
dd
=
textscan
(
fid
,
'%f,%f,%f'
);
InList
=
[
dd
{
1
},
dd
{
2
},
dd
{
3
}];
fclose
(
fid
);
for
i
=
1
:
size
(
TrackList
,
1
)
o1
=
backMap
(
TrackList
(
i
,
2
));
o2
=
backMap
(
TrackList
(
i
,
3
));
objTracks
(
o1
)
.
Label
=
TrackList
(
i
,
1
);
objTracks
(
o2
)
.
Label
=
TrackList
(
i
,
1
);
objTracks
(
o1
)
.
outID
=
o2
;
objTracks
(
o2
)
.
inID
=
o1
;
end
nLabel
=
max
([
objTracks
.
Label
])
+
1
;
for
n
=
1
:
length
(
objTracks
)
if
(
objTracks
(
n
)
.
Label
>
0
)
continue
;
end
objTracks
(
n
)
.
Label
=
nLabel
;
nLabel
=
nLabel
+
1
;
end
gConnect
=
sparse
(
InList
(:,
2
),
InList
(:,
1
),
InList
(:,
3
),
length
(
CellHulls
),
length
(
CellHulls
));
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
samples/TestWriteSegData.m
0 → 100644
+
63
−
0
View file @
ce616eb0
% SampleWriteSegData(DatasetDir, DatasetName) - Sample LEVer segmentation data writer.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Copyright 2013 Andrew Cohen, Eric Wait and Mark Winter
%
% This file is part of LEVer - the tool for stem cell lineaging. See
% http://bioimage.coe.drexel.edu 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
SampleWriteSegData
(
DatasetDir
,
DatasetName
)
global
CONSTANTS
CellHulls
sz
=
CONSTANTS
.
imageSize
;
th
=
max
([
CellHulls
.
time
]);
hashedHulls
=
cell
(
th
,
1
);
% reset tracking info
for
n
=
1
:
length
(
CellHulls
)
hashedHulls
{
CellHulls
(
n
)
.
time
}
=
[
hashedHulls
{
CellHulls
(
n
)
.
time
};
n
];
end
fname
=
fullfile
(
DatasetDir
,
[
'SegObjs_Test_'
DatasetName
'.txt'
]);
fid
=
fopen
(
fname
,
'wt'
);
fprintf
(
fid
,
'%d %d\n'
,
sz
(
2
),
sz
(
1
));
fprintf
(
fid
,
'%d %d\n\n'
,
th
,
length
(
CellHulls
));
for
t
=
1
:
length
(
hashedHulls
)
fprintf
(
fid
,
'%d\n'
,
length
(
hashedHulls
{
t
}));
for
i
=
1
:
length
(
hashedHulls
{
t
})
[
r
c
]
=
ind2sub
(
sz
,
CellHulls
(
hashedHulls
{
t
}(
i
))
.
indexPixels
);
COM
=
mean
([
c
r
],
1
);
fprintf
(
fid
,
'%f %f %d:'
,
COM
(
1
),
COM
(
2
),
length
(
r
));
for
k
=
1
:
length
(
r
)
fprintf
(
fid
,
' (%d,%d)'
,
c
(
k
),
r
(
k
));
end
fprintf
(
fid
,
'\n'
);
end
end
fclose
(
fid
);
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
register
or
sign in
to comment