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
c3cbda7f
Commit
c3cbda7f
authored
Feb 21, 2013
by
Mark Winter
Browse files
Options
Downloads
Patches
Plain Diff
Added a couple of cost debug helpers.
parent
985e7346
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
baseCellTracker.vcproj
+4
-0
4 additions, 0 deletions
baseCellTracker.vcproj
src/helpers.cpp
+119
-0
119 additions, 0 deletions
src/helpers.cpp
src/tracker.h
+4
-0
4 additions, 0 deletions
src/tracker.h
with
127 additions
and
0 deletions
baseCellTracker.vcproj
+
4
−
0
View file @
c3cbda7f
...
...
@@ -332,6 +332,10 @@
RelativePath=
".\src\detection.cpp"
>
</File>
<File
RelativePath=
".\src\helpers.cpp"
>
</File>
<File
RelativePath=
".\src\paths.cpp"
>
...
...
This diff is collapsed.
Click to expand it.
src/helpers.cpp
0 → 100644
+
119
−
0
View file @
c3cbda7f
//***********************************************************************
//
// Copyright 2013 Andrew Cohen and Mark Winter
//
// This file is part of the Multitemporal Association Tracker. 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/>.
//
//
//***********************************************************************
#include
"tracker.h"
#include
<stdio.h>
double
DebugGetCost
(
double
&
forwardCost
,
std
::
vector
<
double
>&
partialCosts
,
const
std
::
vector
<
int
>&
path
,
int
srcFrameIdx
)
{
std
::
vector
<
int
>
tempPath
;
tempPath
.
reserve
(
path
.
size
());
partialCosts
.
reserve
(
path
.
size
()
-
srcFrameIdx
-
1
);
for
(
int
i
=
srcFrameIdx
;
i
<
path
.
size
();
++
i
)
tempPath
.
push_back
(
path
[
i
]);
forwardCost
=
GetCost
(
tempPath
,
0
,
0
);
tempPath
.
clear
();
for
(
int
i
=
0
;
i
<=
srcFrameIdx
;
++
i
)
tempPath
.
push_back
(
path
[
i
]);
for
(
int
i
=
srcFrameIdx
+
1
;
i
<
path
.
size
();
++
i
)
{
tempPath
.
push_back
(
path
[
i
]);
double
testCost
=
GetCost
(
tempPath
,
srcFrameIdx
,
0
);
partialCosts
.
push_back
(
testCost
);
}
return
GetCost
(
path
,
srcFrameIdx
,
0
);
}
int
maxDigits
(
const
std
::
vector
<
int
>&
index
,
int
startIdx
)
{
int
maxElem
=
0
;
for
(
int
i
=
startIdx
;
i
<
index
.
size
();
++
i
)
maxElem
=
std
::
max
<
int
>
(
maxElem
,
index
[
i
]);
const
int
maxAllowedDigits
=
20
;
for
(
int
i
=
1
;
i
<
maxAllowedDigits
;
++
i
)
{
maxElem
/=
10
;
if
(
maxElem
==
0
)
return
i
;
}
return
maxAllowedDigits
;
}
void
PrintDebugPathInfo
(
const
CSourcePath
&
path
,
int
srcFrameIdx
)
{
FILE
*
fDebug
=
fopen
(
"debugPathInfo.txt"
,
"at"
);
if
(
fDebug
==
NULL
)
return
;
double
memorylessCost
;
std
::
vector
<
double
>
partialCosts
;
double
totalCost
=
DebugGetCost
(
memorylessCost
,
partialCosts
,
path
.
index
,
srcFrameIdx
);
int
pathEntrySize
=
maxDigits
(
path
.
index
,
srcFrameIdx
);
if
(
pathEntrySize
<
7
)
pathEntrySize
=
7
;
char
buildPathPrintStr
[
20
];
char
buildCostPrintStr
[
20
];
_snprintf
(
buildPathPrintStr
,
20
,
"%%-%dd "
,
pathEntrySize
);
_snprintf
(
buildCostPrintStr
,
20
,
"%%-%dg "
,
pathEntrySize
);
fprintf
(
fDebug
,
"------------------------------
\n
"
);
fprintf
(
fDebug
,
"Total Cost: %g
\n
"
,
totalCost
);
fprintf
(
fDebug
,
"Memoryless Cost: %g
\n\n
"
,
memorylessCost
);
int
offset
=
0
;
for
(
int
i
=
0
;
i
<=
srcFrameIdx
;
++
i
)
offset
+=
fprintf
(
fDebug
,
"%-d "
,
path
.
index
[
i
]);
for
(
int
i
=
srcFrameIdx
+
1
;
i
<
path
.
index
.
size
();
++
i
)
fprintf
(
fDebug
,
buildPathPrintStr
,
path
.
index
[
i
]);
fprintf
(
fDebug
,
"
\n
"
);
for
(
int
i
=
0
;
i
<
offset
;
++
i
)
fprintf
(
fDebug
,
" "
);
for
(
int
i
=
srcFrameIdx
+
1
;
i
<
path
.
index
.
size
();
++
i
)
fprintf
(
fDebug
,
buildCostPrintStr
,
partialCosts
[
i
-
srcFrameIdx
-
1
]);
fprintf
(
fDebug
,
"
\n\n\n
"
);
fclose
(
fDebug
);
}
This diff is collapsed.
Click to expand it.
src/tracker.h
+
4
−
0
View file @
c3cbda7f
...
...
@@ -75,3 +75,7 @@ extern int gWindowSize;
extern
double
gVMax
;
extern
double
gCCMax
;
// Debug Helper functions (helpers.cpp)
void
PrintDebugPathInfo
(
const
CSourcePath
&
path
,
int
srcFrameIdx
);
double
DebugGetCost
(
double
&
forwardCost
,
std
::
vector
<
double
>&
partialCosts
,
const
std
::
vector
<
int
>&
path
,
int
srcFrameIdx
);
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