Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
hydra-image-processor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenSource
hydra-image-processor
Commits
295858cc
Commit
295858cc
authored
10 years ago
by
Eric Wait
Browse files
Options
Downloads
Patches
Plain Diff
Normalized covariance needed template arguments
parent
8728ba30
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/c/Common/CudaNormalizedCovariance.cuh
+10
-10
10 additions, 10 deletions
src/c/Common/CudaNormalizedCovariance.cuh
with
10 additions
and
10 deletions
src/c/Common/CudaNormalizedCovariance.cuh
+
10
−
10
View file @
295858cc
...
@@ -8,8 +8,8 @@
...
@@ -8,8 +8,8 @@
template
<
class
PixelType
>
template
<
class
PixelType
>
double
normalizedCovariance
(
const
PixelType
*
imageIn1
,
const
PixelType
*
imageIn2
,
Vec
<
size_t
>
dims
,
int
device
=
0
)
double
normalizedCovariance
(
const
PixelType
*
imageIn1
,
const
PixelType
*
imageIn2
,
Vec
<
size_t
>
dims
,
int
device
=
0
)
{
{
double
im1Mean
=
sumArray
(
imageIn1
,
dims
.
product
(),
device
)
/
(
double
)
dims
.
product
();
double
im1Mean
=
sumArray
<
double
>
(
imageIn1
,
dims
.
product
(),
device
)
/
(
double
)
dims
.
product
();
double
im2Mean
=
sumArray
(
imageIn2
,
dims
.
product
(),
device
)
/
(
double
)
dims
.
product
();
double
im2Mean
=
sumArray
<
double
>
(
imageIn2
,
dims
.
product
(),
device
)
/
(
double
)
dims
.
product
();
float
*
im1Sub
=
addConstant
<
PixelType
,
float
>
(
imageIn1
,
dims
,
-
1.0
*
im1Mean
,
NULL
,
device
);
float
*
im1Sub
=
addConstant
<
PixelType
,
float
>
(
imageIn1
,
dims
,
-
1.0
*
im1Mean
,
NULL
,
device
);
float
*
im2Sub
=
addConstant
<
PixelType
,
float
>
(
imageIn2
,
dims
,
-
1.0
*
im2Mean
,
NULL
,
device
);
float
*
im2Sub
=
addConstant
<
PixelType
,
float
>
(
imageIn2
,
dims
,
-
1.0
*
im2Mean
,
NULL
,
device
);
...
@@ -17,14 +17,14 @@ double normalizedCovariance(const PixelType* imageIn1, const PixelType* imageIn2
...
@@ -17,14 +17,14 @@ double normalizedCovariance(const PixelType* imageIn1, const PixelType* imageIn2
float
*
im1P
=
imagePow
<
float
>
(
im1Sub
,
dims
,
2.0
,
NULL
,
device
);
float
*
im1P
=
imagePow
<
float
>
(
im1Sub
,
dims
,
2.0
,
NULL
,
device
);
float
*
im2P
=
imagePow
<
float
>
(
im2Sub
,
dims
,
2.0
,
NULL
,
device
);
float
*
im2P
=
imagePow
<
float
>
(
im2Sub
,
dims
,
2.0
,
NULL
,
device
);
double
sigma1
=
sqrt
(
sumArray
(
im1P
,
dims
.
product
(),
device
)
/
(
double
)
dims
.
product
());
double
sigma1
=
sqrt
(
sumArray
<
double
>
(
im1P
,
dims
.
product
(),
device
)
/
(
double
)
dims
.
product
());
double
sigma2
=
sqrt
(
sumArray
(
im2P
,
dims
.
product
(),
device
)
/
(
double
)
dims
.
product
());
double
sigma2
=
sqrt
(
sumArray
<
double
>
(
im2P
,
dims
.
product
(),
device
)
/
(
double
)
dims
.
product
());
delete
[]
im1P
;
delete
[]
im1P
;
delete
[]
im2P
;
delete
[]
im2P
;
float
*
imMul
=
multiplyImageWith
<
float
>
(
im1Sub
,
im2Sub
,
dims
,
1.0
,
NULL
,
device
);
float
*
imMul
=
multiplyImageWith
<
float
>
(
im1Sub
,
im2Sub
,
dims
,
1.0
,
NULL
,
device
);
double
numerator
=
sumArray
(
imMul
,
dims
.
product
(),
device
);
double
numerator
=
sumArray
<
double
>
(
imMul
,
dims
.
product
(),
device
);
double
coVar
=
numerator
/
(
dims
.
product
()
*
sigma1
*
sigma2
);
double
coVar
=
numerator
/
(
dims
.
product
()
*
sigma1
*
sigma2
);
...
@@ -37,8 +37,8 @@ double normalizedCovariance(const PixelType* imageIn1, const PixelType* imageIn2
...
@@ -37,8 +37,8 @@ double normalizedCovariance(const PixelType* imageIn1, const PixelType* imageIn2
double
normalizedCovariance
(
const
double
*
imageIn1
,
const
double
*
imageIn2
,
Vec
<
size_t
>
dims
,
int
device
=
0
)
double
normalizedCovariance
(
const
double
*
imageIn1
,
const
double
*
imageIn2
,
Vec
<
size_t
>
dims
,
int
device
=
0
)
{
{
double
im1Mean
=
sumArray
(
imageIn1
,
dims
.
product
(),
device
)
/
(
double
)
dims
.
product
();
double
im1Mean
=
sumArray
<
double
>
(
imageIn1
,
dims
.
product
(),
device
)
/
(
double
)
dims
.
product
();
double
im2Mean
=
sumArray
(
imageIn2
,
dims
.
product
(),
device
)
/
(
double
)
dims
.
product
();
double
im2Mean
=
sumArray
<
double
>
(
imageIn2
,
dims
.
product
(),
device
)
/
(
double
)
dims
.
product
();
double
*
im1Sub
=
addConstant
<
double
,
double
>
(
imageIn1
,
dims
,
-
1.0
*
im1Mean
,
NULL
,
device
);
double
*
im1Sub
=
addConstant
<
double
,
double
>
(
imageIn1
,
dims
,
-
1.0
*
im1Mean
,
NULL
,
device
);
double
*
im2Sub
=
addConstant
<
double
,
double
>
(
imageIn2
,
dims
,
-
1.0
*
im2Mean
,
NULL
,
device
);
double
*
im2Sub
=
addConstant
<
double
,
double
>
(
imageIn2
,
dims
,
-
1.0
*
im2Mean
,
NULL
,
device
);
...
@@ -46,14 +46,14 @@ double normalizedCovariance(const double* imageIn1, const double* imageIn2, Vec<
...
@@ -46,14 +46,14 @@ double normalizedCovariance(const double* imageIn1, const double* imageIn2, Vec<
double
*
im1P
=
imagePow
<
double
>
(
im1Sub
,
dims
,
2.0
,
NULL
,
device
);
double
*
im1P
=
imagePow
<
double
>
(
im1Sub
,
dims
,
2.0
,
NULL
,
device
);
double
*
im2P
=
imagePow
<
double
>
(
im2Sub
,
dims
,
2.0
,
NULL
,
device
);
double
*
im2P
=
imagePow
<
double
>
(
im2Sub
,
dims
,
2.0
,
NULL
,
device
);
double
sigma1
=
sqrt
(
sumArray
(
im1P
,
dims
.
product
(),
device
)
/
(
double
)
dims
.
product
());
double
sigma1
=
sqrt
(
sumArray
<
double
>
(
im1P
,
dims
.
product
(),
device
)
/
(
double
)
dims
.
product
());
double
sigma2
=
sqrt
(
sumArray
(
im2P
,
dims
.
product
(),
device
)
/
(
double
)
dims
.
product
());
double
sigma2
=
sqrt
(
sumArray
<
double
>
(
im2P
,
dims
.
product
(),
device
)
/
(
double
)
dims
.
product
());
delete
[]
im1P
;
delete
[]
im1P
;
delete
[]
im2P
;
delete
[]
im2P
;
double
*
imMul
=
multiplyImageWith
<
double
>
(
im1Sub
,
im2Sub
,
dims
,
1.0
,
NULL
,
device
);
double
*
imMul
=
multiplyImageWith
<
double
>
(
im1Sub
,
im2Sub
,
dims
,
1.0
,
NULL
,
device
);
double
numerator
=
sumArray
(
imMul
,
dims
.
product
(),
device
);
double
numerator
=
sumArray
<
double
>
(
imMul
,
dims
.
product
(),
device
);
double
coVar
=
numerator
/
(
dims
.
product
()
*
sigma1
*
sigma2
);
double
coVar
=
numerator
/
(
dims
.
product
()
*
sigma1
*
sigma2
);
...
...
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