Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
miscmaths
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
miscmaths
Commits
ad2a84d8
Commit
ad2a84d8
authored
20 years ago
by
Tim Behrens
Browse files
Options
Downloads
Patches
Plain Diff
*** empty log message ***
parent
85d04f36
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
miscmaths.cc
+6
-3
6 additions, 3 deletions
miscmaths.cc
miscmaths.h
+2
-1
2 additions, 1 deletion
miscmaths.h
with
8 additions
and
4 deletions
miscmaths.cc
+
6
−
3
View file @
ad2a84d8
/* miscmaths.cc
/* miscmaths.cc
Mark Jenkinson & Mark Woolrich & Christian Beckmann, FMRIB Image Analysis Group
Mark Jenkinson & Mark Woolrich & Christian Beckmann
& Tim Behrens
, FMRIB Image Analysis Group
Copyright (C) 1999-2000 University of Oxford */
Copyright (C) 1999-2000 University of Oxford */
...
@@ -356,7 +356,10 @@ namespace MISCMATHS {
...
@@ -356,7 +356,10 @@ namespace MISCMATHS {
if
(
x
>
0.0
)
return
((
int
)
(
x
+
0.5
));
if
(
x
>
0.0
)
return
((
int
)
(
x
+
0.5
));
else
return
((
int
)
(
x
-
0.5
));
else
return
((
int
)
(
x
-
0.5
));
}
}
double
rounddouble
(
double
x
){
return
(
floor
(
x
+
0.5
));
}
int
periodicclamp
(
int
x
,
int
x1
,
int
x2
)
int
periodicclamp
(
int
x
,
int
x1
,
int
x2
)
{
{
if
(
x2
<
x1
)
return
periodicclamp
(
x
,
x2
,
x1
);
if
(
x2
<
x1
)
return
periodicclamp
(
x
,
x2
,
x1
);
...
@@ -1558,7 +1561,7 @@ void element_mod_n(Matrix& Mat,double n)
...
@@ -1558,7 +1561,7 @@ void element_mod_n(Matrix& Mat,double n)
for
(
int
i
=
1
;
i
<=
Mat
.
Nrows
();
i
++
){
for
(
int
i
=
1
;
i
<=
Mat
.
Nrows
();
i
++
){
if
(
!
(
(
Mat
(
i
,
j
)
>
0
)
&&
(
Mat
(
i
,
j
)
<
n
)
)
){
if
(
!
(
(
Mat
(
i
,
j
)
>
0
)
&&
(
Mat
(
i
,
j
)
<
n
)
)
){
tmp
=
(
Mat
(
i
,
j
)
-
MISCMATHS
::
round
(
Mat
(
i
,
j
)
/
n
)
*
n
);
tmp
=
(
Mat
(
i
,
j
)
-
rounddouble
(
Mat
(
i
,
j
)
/
n
)
*
n
);
Mat
(
i
,
j
)
=
tmp
>
0
?
tmp
:
tmp
+
n
;
Mat
(
i
,
j
)
=
tmp
>
0
?
tmp
:
tmp
+
n
;
}
}
...
...
This diff is collapsed.
Click to expand it.
miscmaths.h
+
2
−
1
View file @
ad2a84d8
...
@@ -71,7 +71,8 @@ namespace MISCMATHS {
...
@@ -71,7 +71,8 @@ namespace MISCMATHS {
int
round
(
int
x
);
int
round
(
int
x
);
int
round
(
float
x
);
int
round
(
float
x
);
int
round
(
double
x
);
int
round
(
double
x
);
double
rounddouble
(
double
x
);
inline
int
sign
(
int
x
){
if
(
x
>
0
)
return
1
;
else
{
if
(
x
<
0
)
return
-
1
;
else
return
0
;
}
}
inline
int
sign
(
int
x
){
if
(
x
>
0
)
return
1
;
else
{
if
(
x
<
0
)
return
-
1
;
else
return
0
;
}
}
inline
int
sign
(
float
x
){
if
(
x
>
0
)
return
1
;
else
{
if
(
x
<
0
)
return
-
1
;
else
return
0
;
}
}
inline
int
sign
(
float
x
){
if
(
x
>
0
)
return
1
;
else
{
if
(
x
<
0
)
return
-
1
;
else
return
0
;
}
}
inline
int
sign
(
double
x
){
if
(
x
>
0
)
return
1
;
else
{
if
(
x
<
0
)
return
-
1
;
else
return
0
;
}
}
inline
int
sign
(
double
x
){
if
(
x
>
0
)
return
1
;
else
{
if
(
x
<
0
)
return
-
1
;
else
return
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