Skip to content

Commit

Permalink
trajCleanUp is done
Browse files Browse the repository at this point in the history
  • Loading branch information
lbl1985 committed Jul 28, 2011
1 parent 1818c31 commit 949e622
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 1 deletion.
1 change: 1 addition & 0 deletions 20Tracking/@TrackBlobs/TrackBlobs.m
Expand Up @@ -20,6 +20,7 @@
timeSearchScope = 15;
searchRadius = 10;
areaThreshold = 5;
steadyCriteria = 6;
videoName = [];
end

Expand Down
36 changes: 36 additions & 0 deletions 20Tracking/@TrackBlobs/dbCleanUp.m
@@ -0,0 +1,36 @@
function dbCleanUp(obj)
cleanUpOnlyOneAppearance(obj);
cleanUpSteady(obj);
end

function cleanUpOnlyOneAppearance(obj)
ndb = length(obj.DB);
keepIndex = true(ndb, 1);
for i = 1 : ndb
if length(obj.DB{i}.timeIDX) == 1
keepIndex(i) = false;
end
end
obj.DB = obj.DB(keepIndex);
end

function cleanUpSteady(obj)
ndb = length(obj.DB);
keepIndex = true(ndb, 1);
for i = 1 : ndb
isSteady = checkIsSteady(obj, i);
if isSteady == 1
keepIndex(i) = false;
end
end
obj.DB = obj.DB(keepIndex);
end

function isSteady = checkIsSteady(obj, i)
tmpEntry = obj.DB{i};
tmpStd = std(tmpEntry.Centroid);
isSteady = 0;
if all(tmpStd < obj.steadyCriteria)
isSteady = 1;
end
end
1 change: 1 addition & 0 deletions 20Tracking/@TrackBlobs/playTrackingBlobs.m
Expand Up @@ -6,6 +6,7 @@ function playTrackingBlobs(obj)
rectShow = figure;
for t = 1 : obj.fg.nFrame
I = uint8(obj.fg.Data(:, :, t));
I = I > 0.01;
imshow(I, 'border', 'tight');
for j = 1 : length(obj.DBbyFrame{t})
tBlob = obj.DBbyFrame{t}(j);
Expand Down
1 change: 1 addition & 0 deletions 20Tracking/@TrackBlobs/saveTrackingBlobs.m
Expand Up @@ -9,6 +9,7 @@ function saveTrackingBlobs( obj )

for t = 1 : obj.fg.nFrame
I = uint8(obj.fg.Data(:, :, t));
I = I > 0.01;
imshow(I, 'border', 'tight');
for j = 1 : length(obj.DBbyFrame{t})
tBlob = obj.DBbyFrame{t}(j);
Expand Down
3 changes: 2 additions & 1 deletion main_class.m
Expand Up @@ -27,7 +27,7 @@
end
combinedImagePath = '/Users/herbert19lee/Documents/MATLAB/work/celltrack/Results/vivo/combinedImage';
[datapath videoName n] = rfdatabase(datapath, [], '.mat');
for i = 4
for i = 11
idName = videoName{i}(7 : end - 4);
display([idName 'i = ' num2str(i)]);
load(fullfile(datapath, videoName{i}));
Expand All @@ -45,6 +45,7 @@
trackBlobsObj.DBMergeLocation();
% TODO Dynamics
trackBlobsObj.DBMergeDynamics();
trackBlobsObj.dbCleanUp();
trackBlobsObj.DBSortByFrame();
trackBlobsObj.playTrackingBlobs();
trackBlobsObj.videoName = ['video' idName '_trial1.avi'];
Expand Down

0 comments on commit 949e622

Please sign in to comment.