Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
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
fslpy
Commits
d5e61cdb
Commit
d5e61cdb
authored
7 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Fixes to ProbabilisticAtlas.maskPropotions method - was not calculating
weighted mean correctly.
parent
f162bb5b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/data/atlases.py
+7
-5
7 additions, 5 deletions
fsl/data/atlases.py
with
7 additions
and
5 deletions
fsl/data/atlases.py
+
7
−
5
View file @
d5e61cdb
...
@@ -825,16 +825,18 @@ class ProbabilisticAtlas(Atlas):
...
@@ -825,16 +825,18 @@ class ProbabilisticAtlas(Atlas):
# Make sure that the mask has the same
# Make sure that the mask has the same
# number of voxels as the atlas image
# number of voxels as the atlas image
mask
=
mask
.
resample
(
self
.
shape
[:
3
],
order
=
1
)
mask
=
mask
.
resample
(
self
.
shape
[:
3
],
dtype
=
np
.
float32
,
order
=
1
)
[
0
]
boolmask
=
mask
>
0
boolmask
=
mask
>
0
for
label
in
range
(
self
.
shape
[
3
]):
for
label
in
range
(
self
.
shape
[
3
]):
vals
=
self
[...,
label
]
weights
=
mask
[
boolmask
]
vals
=
vals
[
boolmask
]
*
mask
[
boolmask
]
vals
=
self
[...,
label
]
prop
=
vals
.
mean
()
vals
=
vals
[
boolmask
]
*
weights
prop
=
vals
.
sum
()
/
weights
.
sum
()
if
not
np
.
isclose
(
prop
,
0
):
if
prop
!=
0
:
labels
.
append
(
label
)
labels
.
append
(
label
)
props
.
append
(
prop
)
props
.
append
(
prop
)
...
...
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