Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Christian Butz
VTK
Commits
74d7e025
Commit
74d7e025
authored
Apr 15, 2011
by
David Gobbi
Committed by
David Partyka
Apr 21, 2011
Browse files
Fix mistakes in previous commit.
parent
8235ecfc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Wrapping/Python/vtk/util/vtkImageImportFromArray.py
View file @
74d7e025
...
...
@@ -54,8 +54,21 @@ class vtkImageImportFromArray:
'L'
:
VTK_UNSIGNED_LONG
,
# uint64
'f'
:
VTK_FLOAT
,
# float32
'd'
:
VTK_DOUBLE
,
# float64
'F'
:
VTK_FLOAT
,
# float32
'D'
:
VTK_DOUBLE
,
# float64
}
__sizeDict
=
{
VTK_SIGNED_CHAR
:
1
,
VTK_UNSIGNED_CHAR
:
1
,
VTK_SHORT
:
2
,
VTK_UNSIGNED_SHORT
:
2
,
VTK_INT
:
4
,
VTK_UNSIGNED_INT
:
4
,
VTK_LONG
:
4
,
VTK_UNSIGNED_LONG
:
4
,
VTK_FLOAT
:
4
,
VTK_DOUBLE
:
8
}
# convert 'Int32' to 'unsigned short'
def
SetConvertIntToUnsignedShort
(
self
,
yesno
):
self
.
__ConvertIntToUnsignedShort
=
yesno
...
...
@@ -100,8 +113,10 @@ class vtkImageImportFromArray:
ar_type
=
self
.
__typeDict
[
typecode
]
complexComponents
=
1
if
(
typecode
==
'F'
or
typecode
==
'D'
):
numComponents
=
numComponents
*
2
complexComponents
=
2
if
(
self
.
__ConvertIntToUnsignedShort
and
typecode
==
'i'
):
imTmpArr
=
imArray
.
astype
(
'h'
).
flat
...
...
@@ -109,7 +124,7 @@ class vtkImageImportFromArray:
else
:
imTmpArr
=
imArray
.
flat
size
=
len
(
imTmpArr
)
*
self
.
__sizeDict
[
type
]
*
num
Components
size
=
len
(
imTmpArr
)
*
self
.
__sizeDict
[
ar_
type
]
*
complex
Components
self
.
__import
.
CopyImportVoidPointer
(
imTmpArr
,
size
)
self
.
__import
.
SetDataScalarType
(
ar_type
)
self
.
__import
.
SetNumberOfScalarComponents
(
numComponents
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment