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
c146920a
Commit
c146920a
authored
19 years ago
by
Mark Jenkinson
Browse files
Options
Downloads
Patches
Plain Diff
Added histogram feature
parent
a9e1fe0b
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
fslstats.cc
+57
-1
57 additions, 1 deletion
fslstats.cc
with
57 additions
and
1 deletion
fslstats.cc
+
57
−
1
View file @
c146920a
...
...
@@ -2,7 +2,7 @@
Mark Jenkinson, FMRIB Image Analysis Group
Copyright (C) 2003 University of Oxford */
Copyright (C) 2003
-2005
University of Oxford */
/* CCOPYRIGHT */
...
...
@@ -44,6 +44,8 @@ void print_usage(const string& progname) {
cout
<<
"-P <n> : output nth percentile (for nonzero voxels)"
<<
endl
;
cout
<<
"-a : use absolute values of all image intensities"
<<
endl
;
cout
<<
"-k <mask> : use the specified image (filename) for masking - overrides lower and upper thresholds"
<<
endl
;
cout
<<
"-h <nbins> : output a histogram (for the thresholded/masked voxels only) with nbins"
<<
endl
;
cout
<<
"-H <nbins> <min> <max> : output a histogram (for the thresholded/masked voxels only) with nbins and histogram limits of min and max"
<<
endl
;
cout
<<
endl
;
cout
<<
"Note - thresholds are not inclusive ie lthresh<allowed<uthresh"
<<
endl
;
}
...
...
@@ -408,6 +410,60 @@ int fmrib_main_float(int argc, char* argv[])
vol
=
vin
*
mask
;
}
cout
<<
vol
.
percentile
((
float
)
n
/
100.0
,
masknz
)
<<
" "
;
}
else
if
(
sarg
==
"-h"
)
{
float
n
;
narg
++
;
if
(
narg
<
argc
)
{
n
=
atof
(
argv
[
narg
]);
}
else
{
cerr
<<
"Must specify the number of bins"
<<
endl
;
exit
(
2
);
}
int
nbins
=
(
int
)
n
;
if
(
nbins
<
1
)
{
cerr
<<
"Must specify at least 1 bin"
<<
endl
;
exit
(
1
);
}
if
(
masks_used
)
{
cout
<<
vol
.
histogram
(
nbins
,
vol
.
min
(),
vol
.
max
(),
mask
)
<<
" "
;
}
else
{
cout
<<
vol
.
histogram
(
nbins
,
vol
.
min
(),
vol
.
max
())
<<
" "
;
}
}
else
if
(
sarg
==
"-H"
)
{
float
n
;
narg
++
;
if
(
narg
<
argc
)
{
n
=
atof
(
argv
[
narg
]);
}
else
{
cerr
<<
"Must specify the number of bins"
<<
endl
;
exit
(
2
);
}
int
nbins
=
(
int
)
n
;
if
(
nbins
<
1
)
{
cerr
<<
"Must specify at least 1 bin"
<<
endl
;
exit
(
1
);
}
float
min
=
0
;
narg
++
;
if
(
narg
<
argc
)
{
min
=
atof
(
argv
[
narg
]);
}
else
{
cerr
<<
"Must specify the histogram minimum intensity"
<<
endl
;
exit
(
2
);
}
float
max
=
0
;
narg
++
;
if
(
narg
<
argc
)
{
max
=
atof
(
argv
[
narg
]);
}
else
{
cerr
<<
"Must specify the histogram maximum intensity"
<<
endl
;
exit
(
2
);
}
if
(
masks_used
)
{
cout
<<
vol
.
histogram
(
nbins
,
min
,
max
,
mask
)
<<
" "
;
}
else
{
cout
<<
vol
.
histogram
(
nbins
,
min
,
max
)
<<
" "
;
}
}
else
{
cerr
<<
"Unrecognised option: "
<<
sarg
<<
endl
;
exit
(
3
);
...
...
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