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
1f3fa431
Commit
1f3fa431
authored
5 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Plain Diff
Merge branch 'bf/mesh_indices' into 'master'
Bf/mesh indices See merge request fsl/fslpy!185
parents
90fcc75d
0ab31648
No related branches found
No related tags found
No related merge requests found
Pipeline
#4875
canceled
5 years ago
Stage: test
Stage: style
Stage: doc
Stage: deploy
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG.rst
+3
-0
3 additions, 0 deletions
CHANGELOG.rst
fsl/data/mesh.py
+2
-10
2 additions, 10 deletions
fsl/data/mesh.py
fsl/utils/image/resample.py
+5
-4
5 additions, 4 deletions
fsl/utils/image/resample.py
requirements-extra.txt
+1
-1
1 addition, 1 deletion
requirements-extra.txt
with
11 additions
and
15 deletions
CHANGELOG.rst
+
3
−
0
View file @
1f3fa431
...
@@ -34,6 +34,9 @@ Fixed
...
@@ -34,6 +34,9 @@ Fixed
* Improved the algorithm used by the :func:`.mesh.needsFixing` function.
* Improved the algorithm used by the :func:`.mesh.needsFixing` function.
* The :meth:`.fslmaths.run` method now accepts :attr:`.wrappers.LOAD` as an
* The :meth:`.fslmaths.run` method now accepts :attr:`.wrappers.LOAD` as an
output specification.
output specification.
* Fixed a bug in the :class:`.Mesh` class to prevent indices from being loaded
as floating point type.
* Fixed a bug in the :func:`.resample` function.
Deprecated
Deprecated
...
...
This diff is collapsed.
Click to expand it.
fsl/data/mesh.py
+
2
−
10
View file @
1f3fa431
...
@@ -154,14 +154,6 @@ class Mesh(notifier.Notifier, meta.Meta):
...
@@ -154,14 +154,6 @@ class Mesh(notifier.Notifier, meta.Meta):
"""
"""
def
__new__
(
cls
,
*
args
,
**
kwargs
):
"""
Create a ``Mesh``. We must override ``__new__``, otherwise the
:class:`Meta` and :class:`Notifier` ``__new__`` methods will not be
called correctly.
"""
return
super
(
Mesh
,
cls
).
__new__
(
cls
,
*
args
,
**
kwargs
)
def
__init__
(
self
,
def
__init__
(
self
,
indices
,
indices
,
name
=
'
mesh
'
,
name
=
'
mesh
'
,
...
@@ -189,7 +181,7 @@ class Mesh(notifier.Notifier, meta.Meta):
...
@@ -189,7 +181,7 @@ class Mesh(notifier.Notifier, meta.Meta):
self
.
__name
=
name
self
.
__name
=
name
self
.
__dataSource
=
dataSource
self
.
__dataSource
=
dataSource
self
.
__nvertices
=
indices
.
max
()
+
1
self
.
__nvertices
=
int
(
indices
.
max
()
)
+
1
self
.
__selected
=
None
self
.
__selected
=
None
# We potentially store two copies of
# We potentially store two copies of
...
@@ -197,7 +189,7 @@ class Mesh(notifier.Notifier, meta.Meta):
...
@@ -197,7 +189,7 @@ class Mesh(notifier.Notifier, meta.Meta):
# orders. The vindices dict stores refs
# orders. The vindices dict stores refs
# to one or the other for each vertex
# to one or the other for each vertex
# set.
# set.
self
.
__indices
=
np
.
asarray
(
indices
).
reshape
((
-
1
,
3
))
self
.
__indices
=
np
.
asarray
(
indices
,
dtype
=
np
.
int32
).
reshape
((
-
1
,
3
))
self
.
__fixedIndices
=
None
self
.
__fixedIndices
=
None
self
.
__vindices
=
collections
.
OrderedDict
()
self
.
__vindices
=
collections
.
OrderedDict
()
...
...
This diff is collapsed.
Click to expand it.
fsl/utils/image/resample.py
+
5
−
4
View file @
1f3fa431
...
@@ -47,9 +47,9 @@ def resampleToReference(image, reference, matrix=None, **kwargs):
...
@@ -47,9 +47,9 @@ def resampleToReference(image, reference, matrix=None, **kwargs):
along the spatial (first three) dimensions.
along the spatial (first three) dimensions.
:arg image: :class:`.Image` to resample
:arg image: :class:`.Image` to resample
:arg matrix: Optional world-to-world affine alignment matrix
:arg reference: :class:`.Nifti` defining the space to resample ``image``
:arg reference: :class:`.Nifti` defining the space to resample ``image``
into
into
:arg matrix: Optional world-to-world affine alignment matrix
"""
"""
oldShape
=
list
(
image
.
shape
)
oldShape
=
list
(
image
.
shape
)
...
@@ -204,9 +204,10 @@ def resample(image,
...
@@ -204,9 +204,10 @@ def resample(image,
if
matrix
is
None
:
if
matrix
is
None
:
matrix
=
affine
.
rescale
(
data
.
shape
,
newShape
,
origin
)
matrix
=
affine
.
rescale
(
data
.
shape
,
newShape
,
origin
)
# identity matrix? the image
# same shape and identity matrix? the
# doesn't need to be resampled
# image doesn't need to be resampled
if
np
.
all
(
np
.
isclose
(
matrix
,
np
.
eye
(
len
(
newShape
)
+
1
))):
if
np
.
all
(
np
.
isclose
(
data
.
shape
,
newShape
))
and
\
np
.
all
(
np
.
isclose
(
matrix
,
np
.
eye
(
len
(
newShape
)
+
1
))):
return
data
,
image
.
voxToWorldMat
return
data
,
image
.
voxToWorldMat
newShape
=
np
.
array
(
np
.
round
(
newShape
),
dtype
=
np
.
int
)
newShape
=
np
.
array
(
np
.
round
(
newShape
),
dtype
=
np
.
int
)
...
...
This diff is collapsed.
Click to expand it.
requirements-extra.txt
+
1
−
1
View file @
1f3fa431
indexed_gzip>=0.7.0
indexed_gzip>=0.7.0
wxpython==4.*
wxpython==4.*
trimesh>=2.37.29
trimesh>=2.37.29
rtree
=
=0.8.3
rtree
>
=0.8.3
Pillow>=3.2.0
Pillow>=3.2.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