Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
avwutils
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
avwutils
Commits
1b0bd3fb
Commit
1b0bd3fb
authored
15 years ago
by
Tom Nichols
Browse files
Options
Downloads
Patches
Plain Diff
Added -rank and -ranknorm options
parent
b0154f7a
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
fslmaths.cc
+67
-1
67 additions, 1 deletion
fslmaths.cc
with
67 additions
and
1 deletion
fslmaths.cc
+
67
−
1
View file @
1b0bd3fb
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
//
//
// CCOPYRIGHT
// CCOPYRIGHT
//
//
#define EXPOSE_TREACHEROUS
#include
"newimage/newimageall.h"
#include
"newimage/newimageall.h"
#include
"miscmaths/miscmaths.h"
#include
"miscmaths/miscmaths.h"
#include
"utils/fsl_isfinite.h"
#include
"utils/fsl_isfinite.h"
...
@@ -109,6 +109,8 @@ int printUsage(const string& programName)
...
@@ -109,6 +109,8 @@ int printUsage(const string& programName)
cout
<<
" -cpval : Same as -pval, but gives FWE corrected P-values"
<<
endl
;
cout
<<
" -cpval : Same as -pval, but gives FWE corrected P-values"
<<
endl
;
cout
<<
" -ztop : Convert Z-stat to (uncorrected) P"
<<
endl
;
cout
<<
" -ztop : Convert Z-stat to (uncorrected) P"
<<
endl
;
cout
<<
" -ptoz : Convert (uncorrected) P to Z"
<<
endl
;
cout
<<
" -ptoz : Convert (uncorrected) P to Z"
<<
endl
;
cout
<<
" -rank : Convert data to ranks (over T dim)"
<<
endl
;
cout
<<
" -ranknorm: Transform to Normal dist via ranks"
<<
endl
;
cout
<<
"
\n
Multi-argument operations:"
<<
endl
;
cout
<<
"
\n
Multi-argument operations:"
<<
endl
;
cout
<<
" -roi <xmin> <xsize> <ymin> <ysize> <zmin> <zsize> <tmin> <tsize> : zero outside roi (using voxel coordinates)"
<<
endl
;
cout
<<
" -roi <xmin> <xsize> <ymin> <ysize> <zmin> <zsize> <tmin> <tsize> : zero outside roi (using voxel coordinates)"
<<
endl
;
...
@@ -729,6 +731,70 @@ if (!separatenoise)
...
@@ -729,6 +731,70 @@ if (!separatenoise)
input_volume
.
value
(
x
,
y
,
z
,
t
)
=
(
T
)((
v
<=
0
||
v
>=
1
)
?
0
:
ndtri
(
1
-
v
));
input_volume
.
value
(
x
,
y
,
z
,
t
)
=
(
T
)((
v
<=
0
||
v
>=
1
)
?
0
:
ndtri
(
1
-
v
));
}
}
}
}
/***** Convert to ranks ********/
else
if
(
string
(
argv
[
i
])
==
"-rank"
)
{
ColumnVector
val
(
input_volume
.
tsize
()),
rank
(
input_volume
.
tsize
()),
sortval
(
input_volume
.
tsize
());
for
(
int
z
=
0
;
z
<
input_volume
.
zsize
();
z
++
)
for
(
int
y
=
0
;
y
<
input_volume
.
ysize
();
y
++
)
for
(
int
x
=
0
;
x
<
input_volume
.
xsize
();
x
++
)
{
for
(
int
t
=
0
;
t
<
input_volume
.
tsize
();
t
++
)
val
(
t
+
1
)
=
input_volume
.
value
(
x
,
y
,
z
,
t
);
/* Take sortval and 'unsort' it, finding ranks */
sortval
=
val
;
SortAscending
(
sortval
);
for
(
int
k
=
1
;
k
<=
val
.
Nrows
();
k
++
)
rank
(
k
)
=
k
;
for
(
int
k
=
1
;
k
<=
val
.
Nrows
();
k
++
)
if
(
val
(
k
)
!=
sortval
(
k
))
for
(
int
l
=
k
+
1
;
l
<=
val
.
Nrows
();
l
++
)
if
(
sortval
(
l
)
==
val
(
k
))
{
swap
(
rank
(
l
),
rank
(
k
));
swap
(
sortval
(
l
),
sortval
(
k
));
}
for
(
int
t
=
0
;
t
<
input_volume
.
tsize
();
t
++
)
input_volume
.
value
(
x
,
y
,
z
,
t
)
=
(
T
)
rank
(
t
+
1
);
}
}
/***** Convert to normal distribution via ranks ********/
else
if
(
string
(
argv
[
i
])
==
"-ranknorm"
)
{
ColumnVector
val
(
input_volume
.
tsize
()),
rank
(
input_volume
.
tsize
()),
sortval
(
input_volume
.
tsize
());
volume
<
double
>
valv
(
input_volume
.
tsize
(),
1
,
1
);
for
(
int
z
=
0
;
z
<
input_volume
.
zsize
();
z
++
)
for
(
int
y
=
0
;
y
<
input_volume
.
ysize
();
y
++
)
for
(
int
x
=
0
;
x
<
input_volume
.
xsize
();
x
++
)
{
for
(
int
t
=
0
;
t
<
input_volume
.
tsize
();
t
++
)
{
val
(
t
+
1
)
=
input_volume
.
value
(
x
,
y
,
z
,
t
);
valv
(
t
,
0
,
0
)
=
val
(
t
+
1
);
}
/* Take sortval and 'unsort' it, finding ranks */
sortval
=
val
;
SortAscending
(
sortval
);
for
(
int
k
=
1
;
k
<=
val
.
Nrows
();
k
++
)
rank
(
k
)
=
k
;
for
(
int
k
=
1
;
k
<=
val
.
Nrows
();
k
++
)
if
(
val
(
k
)
!=
sortval
(
k
))
for
(
int
l
=
k
+
1
;
l
<=
val
.
Nrows
();
l
++
)
if
(
sortval
(
l
)
==
val
(
k
))
{
swap
(
rank
(
l
),
rank
(
k
));
swap
(
sortval
(
l
),
sortval
(
k
));
}
/* Transform to expected order statisics of a Uniform */
rank
=
(
rank
-
0.5
)
/
rank
.
Nrows
();
/* Transform to expected order statisics of a Normal with same Mean & Sd */
for
(
int
t
=
0
;
t
<
input_volume
.
tsize
();
t
++
)
input_volume
.
value
(
x
,
y
,
z
,
t
)
=
(
T
)(
valv
.
mean
()
+
ndtri
(
rank
(
t
+
1
))
*
valv
.
stddev
());
}
}
/***************************************************************/
/***************************************************************/
else
if
(
string
(
argv
[
i
])
==
"-abs"
)
input_volume
=
abs
(
input_volume
);
else
if
(
string
(
argv
[
i
])
==
"-abs"
)
input_volume
=
abs
(
input_volume
);
/***************************************************************/
/***************************************************************/
...
...
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