Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vt-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor 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
morpheme
vt-python
Commits
4424c78b
Commit
4424c78b
authored
5 years ago
by
MALANDAIN Gregoire
Browse files
Options
Downloads
Patches
Plain Diff
minor changes
parent
9e09f8b1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/vt/apply_trsf.py
+24
-0
24 additions, 0 deletions
src/vt/apply_trsf.py
wrp/python/vtImageBridgePython.cpp
+6
-0
6 additions, 0 deletions
wrp/python/vtImageBridgePython.cpp
with
30 additions
and
0 deletions
src/vt/apply_trsf.py
+
24
−
0
View file @
4424c78b
...
...
@@ -35,6 +35,30 @@ vtTransformation = vtpython._vtTransformation
#
def
apply_trsf
(
image
,
trsf
,
ref
=
None
,
params
=
""
,
**
kwargs
):
"""
Resample an image with a given transformation
Parameters
----------
image : _vtImage or str
the image to be resampled
trsf : _vtTrsf or str
the transformation to be used. This transformation goes from the result image towards the input image.
ref : _vtImage or str
a template image, used to define the geometry of the result image (dimension, voxel size)
params : str
a string containing computation options
kwargs :
additional variables
Returns
-------
If `out_file_path` is found in the additional variables, this procedure will call the inline command.
Hence, `image`, `trsf`, `ref` and `out_file_path` are supposed to be file names.
Else, `image` and `ref` are supposed to be of _vtImage type, `trsf` is supposed to be of _vtTrsf type, and this
function returns a _vtImage.
"""
proc
=
"
apply_trsf
"
if
params
is
not
None
and
not
isinstance
(
params
,
str
):
...
...
This diff is collapsed.
Click to expand it.
wrp/python/vtImageBridgePython.cpp
+
6
−
0
View file @
4424c78b
...
...
@@ -99,10 +99,16 @@ namespace vt {
template
<
class
T
>
py
::
object
_copy_img_to_py_array
(
vtImage
&
img
)
{
std
::
string
proc
=
"mv_img_pointer_to_py_array"
;
py
::
object
o
;
std
::
array
<
unsigned
long
,
3
>
img_shape
=
img
.
shape
();
T
*
data
=
img
.
data
<
T
>
();
if
(
data
==
nullptr
)
{
std
::
cerr
<<
proc
<<
": data pointer is already NULL "
<<
std
::
endl
;
return
o
;
}
if
(
img
.
dims
()
>
1
)
{
// vectorial image
if
(
img_shape
[
2
]
>
1
)
{
...
...
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