vtk-ruby 5.0.4.0-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/VTK/common.rb +7 -0
- data/lib/VTK/common.rb.rule +1 -0
- data/lib/VTK/filtering.rb +7 -0
- data/lib/VTK/filtering.rb.rule +1 -0
- data/lib/VTK/genericfiltering.rb +7 -0
- data/lib/VTK/genericfiltering.rb.rule +1 -0
- data/lib/VTK/graphics.rb +7 -0
- data/lib/VTK/graphics.rb.rule +1 -0
- data/lib/VTK/gtk.rb +5 -0
- data/lib/VTK/gtk.rb.rule +1 -0
- data/lib/VTK/gtk/GtkGLExtVTKRenderWindow.rb +635 -0
- data/lib/VTK/gtk/GtkGLExtVTKRenderWindow.rb.rule +1 -0
- data/lib/VTK/gtk/GtkGLExtVTKRenderWindowInteractor.rb +355 -0
- data/lib/VTK/gtk/GtkGLExtVTKRenderWindowInteractor.rb.rule +1 -0
- data/lib/VTK/gtk/GtkVTKRenderWindow.rb +615 -0
- data/lib/VTK/gtk/GtkVTKRenderWindow.rb.rule +1 -0
- data/lib/VTK/gtk/GtkVTKRenderWindowInteractor.rb +336 -0
- data/lib/VTK/gtk/GtkVTKRenderWindowInteractor.rb.rule +1 -0
- data/lib/VTK/hybrid.rb +7 -0
- data/lib/VTK/hybrid.rb.rule +1 -0
- data/lib/VTK/imaging.rb +7 -0
- data/lib/VTK/imaging.rb.rule +1 -0
- data/lib/VTK/io.rb +7 -0
- data/lib/VTK/io.rb.rule +1 -0
- data/lib/VTK/parallel.rb +7 -0
- data/lib/VTK/parallel.rb.rule +1 -0
- data/lib/VTK/rendering.rb +7 -0
- data/lib/VTK/rendering.rb.rule +1 -0
- data/lib/VTK/tk.rb +4 -0
- data/lib/VTK/tk.rb.rule +1 -0
- data/lib/VTK/tk/vtkLoadRubyTkWidgets.rb +54 -0
- data/lib/VTK/tk/vtkLoadRubyTkWidgets.rb.rule +1 -0
- data/lib/VTK/tk/vtkTkImageViewerWidget.rb +377 -0
- data/lib/VTK/tk/vtkTkImageViewerWidget.rb.rule +1 -0
- data/lib/VTK/tk/vtkTkPhotoImage.rb +28 -0
- data/lib/VTK/tk/vtkTkPhotoImage.rb.rule +1 -0
- data/lib/VTK/tk/vtkTkRenderWidget.rb +486 -0
- data/lib/VTK/tk/vtkTkRenderWidget.rb.rule +1 -0
- data/lib/VTK/tk/vtkTkRenderWindowInteractor.rb +394 -0
- data/lib/VTK/tk/vtkTkRenderWindowInteractor.rb.rule +1 -0
- data/lib/VTK/util.rb +6 -0
- data/lib/VTK/util.rb.rule +1 -0
- data/lib/VTK/util/colors.rb +223 -0
- data/lib/VTK/util/colors.rb.rule +1 -0
- data/lib/VTK/util/misc.rb +68 -0
- data/lib/VTK/util/misc.rb.rule +1 -0
- data/lib/VTK/util/vtkConstants.rb +123 -0
- data/lib/VTK/util/vtkConstants.rb.rule +1 -0
- data/lib/VTK/util/vtkImageExportToArray.rb +96 -0
- data/lib/VTK/util/vtkImageExportToArray.rb.rule +1 -0
- data/lib/VTK/util/vtkImageImportFromArray.rb +116 -0
- data/lib/VTK/util/vtkImageImportFromArray.rb.rule +1 -0
- data/lib/VTK/volumerendering.rb +7 -0
- data/lib/VTK/volumerendering.rb.rule +1 -0
- data/lib/VTK/vtkCommon.dll +0 -0
- data/lib/VTK/vtkCommon.exp +0 -0
- data/lib/VTK/vtkCommon.lib +0 -0
- data/lib/VTK/vtkCommonRuby.dll +0 -0
- data/lib/VTK/vtkCommonRuby.exp +0 -0
- data/lib/VTK/vtkCommonRuby.lib +0 -0
- data/lib/VTK/vtkCommonRubyD.dll +0 -0
- data/lib/VTK/vtkCommonRubyD.exp +0 -0
- data/lib/VTK/vtkCommonRubyD.lib +0 -0
- data/lib/VTK/vtkDICOMParser.dll +0 -0
- data/lib/VTK/vtkDICOMParser.exp +0 -0
- data/lib/VTK/vtkDICOMParser.lib +0 -0
- data/lib/VTK/vtkFiltering.dll +0 -0
- data/lib/VTK/vtkFiltering.exp +0 -0
- data/lib/VTK/vtkFiltering.lib +0 -0
- data/lib/VTK/vtkFilteringRuby.dll +0 -0
- data/lib/VTK/vtkFilteringRuby.exp +0 -0
- data/lib/VTK/vtkFilteringRuby.lib +0 -0
- data/lib/VTK/vtkFilteringRubyD.dll +0 -0
- data/lib/VTK/vtkFilteringRubyD.exp +0 -0
- data/lib/VTK/vtkFilteringRubyD.lib +0 -0
- data/lib/VTK/vtkGenericFiltering.dll +0 -0
- data/lib/VTK/vtkGenericFiltering.exp +0 -0
- data/lib/VTK/vtkGenericFiltering.lib +0 -0
- data/lib/VTK/vtkGenericFilteringRuby.dll +0 -0
- data/lib/VTK/vtkGenericFilteringRuby.exp +0 -0
- data/lib/VTK/vtkGenericFilteringRuby.lib +0 -0
- data/lib/VTK/vtkGenericFilteringRubyD.dll +0 -0
- data/lib/VTK/vtkGenericFilteringRubyD.exp +0 -0
- data/lib/VTK/vtkGenericFilteringRubyD.lib +0 -0
- data/lib/VTK/vtkGraphics.dll +0 -0
- data/lib/VTK/vtkGraphics.exp +0 -0
- data/lib/VTK/vtkGraphics.lib +0 -0
- data/lib/VTK/vtkGraphicsRuby.dll +0 -0
- data/lib/VTK/vtkGraphicsRuby.exp +0 -0
- data/lib/VTK/vtkGraphicsRuby.lib +0 -0
- data/lib/VTK/vtkGraphicsRubyD.dll +0 -0
- data/lib/VTK/vtkGraphicsRubyD.exp +0 -0
- data/lib/VTK/vtkGraphicsRubyD.lib +0 -0
- data/lib/VTK/vtkHybrid.dll +0 -0
- data/lib/VTK/vtkHybrid.exp +0 -0
- data/lib/VTK/vtkHybrid.lib +0 -0
- data/lib/VTK/vtkHybridRuby.dll +0 -0
- data/lib/VTK/vtkHybridRuby.exp +0 -0
- data/lib/VTK/vtkHybridRuby.lib +0 -0
- data/lib/VTK/vtkHybridRubyD.dll +0 -0
- data/lib/VTK/vtkHybridRubyD.exp +0 -0
- data/lib/VTK/vtkHybridRubyD.lib +0 -0
- data/lib/VTK/vtkIO.dll +0 -0
- data/lib/VTK/vtkIO.exp +0 -0
- data/lib/VTK/vtkIO.lib +0 -0
- data/lib/VTK/vtkIORuby.dll +0 -0
- data/lib/VTK/vtkIORuby.exp +0 -0
- data/lib/VTK/vtkIORuby.lib +0 -0
- data/lib/VTK/vtkIORubyD.dll +0 -0
- data/lib/VTK/vtkIORubyD.exp +0 -0
- data/lib/VTK/vtkIORubyD.lib +0 -0
- data/lib/VTK/vtkImaging.dll +0 -0
- data/lib/VTK/vtkImaging.exp +0 -0
- data/lib/VTK/vtkImaging.lib +0 -0
- data/lib/VTK/vtkImagingRuby.dll +0 -0
- data/lib/VTK/vtkImagingRuby.exp +0 -0
- data/lib/VTK/vtkImagingRuby.lib +0 -0
- data/lib/VTK/vtkImagingRubyD.dll +0 -0
- data/lib/VTK/vtkImagingRubyD.exp +0 -0
- data/lib/VTK/vtkImagingRubyD.lib +0 -0
- data/lib/VTK/vtkNetCDF.dll +0 -0
- data/lib/VTK/vtkNetCDF.exp +0 -0
- data/lib/VTK/vtkNetCDF.lib +0 -0
- data/lib/VTK/vtkParallel.dll +0 -0
- data/lib/VTK/vtkParallel.exp +0 -0
- data/lib/VTK/vtkParallel.lib +0 -0
- data/lib/VTK/vtkParallelRuby.dll +0 -0
- data/lib/VTK/vtkParallelRuby.exp +0 -0
- data/lib/VTK/vtkParallelRuby.lib +0 -0
- data/lib/VTK/vtkParallelRubyD.dll +0 -0
- data/lib/VTK/vtkParallelRubyD.exp +0 -0
- data/lib/VTK/vtkParallelRubyD.lib +0 -0
- data/lib/VTK/vtkParseOGLExt.exe +0 -0
- data/lib/VTK/vtkRendering.dll +0 -0
- data/lib/VTK/vtkRendering.exp +0 -0
- data/lib/VTK/vtkRendering.lib +0 -0
- data/lib/VTK/vtkRenderingRuby.dll +0 -0
- data/lib/VTK/vtkRenderingRuby.exp +0 -0
- data/lib/VTK/vtkRenderingRuby.lib +0 -0
- data/lib/VTK/vtkRenderingRubyD.dll +0 -0
- data/lib/VTK/vtkRenderingRubyD.exp +0 -0
- data/lib/VTK/vtkRenderingRubyD.lib +0 -0
- data/lib/VTK/vtkVREncodeString.exe +0 -0
- data/lib/VTK/vtkVolumeRendering.dll +0 -0
- data/lib/VTK/vtkVolumeRendering.exp +0 -0
- data/lib/VTK/vtkVolumeRendering.lib +0 -0
- data/lib/VTK/vtkVolumeRenderingRuby.dll +0 -0
- data/lib/VTK/vtkVolumeRenderingRuby.exp +0 -0
- data/lib/VTK/vtkVolumeRenderingRuby.lib +0 -0
- data/lib/VTK/vtkVolumeRenderingRubyD.dll +0 -0
- data/lib/VTK/vtkVolumeRenderingRubyD.exp +0 -0
- data/lib/VTK/vtkVolumeRenderingRubyD.lib +0 -0
- data/lib/VTK/vtkWidgets.dll +0 -0
- data/lib/VTK/vtkWidgets.exp +0 -0
- data/lib/VTK/vtkWidgets.lib +0 -0
- data/lib/VTK/vtkWidgetsRuby.dll +0 -0
- data/lib/VTK/vtkWidgetsRuby.exp +0 -0
- data/lib/VTK/vtkWidgetsRuby.lib +0 -0
- data/lib/VTK/vtkWidgetsRubyD.dll +0 -0
- data/lib/VTK/vtkWidgetsRubyD.exp +0 -0
- data/lib/VTK/vtkWidgetsRubyD.lib +0 -0
- data/lib/VTK/vtkWrapRuby.exe +0 -0
- data/lib/VTK/vtkWrapRubyInit.exe +0 -0
- data/lib/VTK/vtk_dummy.rb +3 -0
- data/lib/VTK/vtkexoIIc.dll +0 -0
- data/lib/VTK/vtkexoIIc.exp +0 -0
- data/lib/VTK/vtkexoIIc.lib +0 -0
- data/lib/VTK/vtkexpat.dll +0 -0
- data/lib/VTK/vtkexpat.exp +0 -0
- data/lib/VTK/vtkexpat.lib +0 -0
- data/lib/VTK/vtkfreetype.dll +0 -0
- data/lib/VTK/vtkfreetype.exp +0 -0
- data/lib/VTK/vtkfreetype.lib +0 -0
- data/lib/VTK/vtkftgl.dll +0 -0
- data/lib/VTK/vtkftgl.exp +0 -0
- data/lib/VTK/vtkftgl.lib +0 -0
- data/lib/VTK/vtkjpeg.dll +0 -0
- data/lib/VTK/vtkjpeg.exp +0 -0
- data/lib/VTK/vtkjpeg.lib +0 -0
- data/lib/VTK/vtkpng.dll +0 -0
- data/lib/VTK/vtkpng.exp +0 -0
- data/lib/VTK/vtkpng.lib +0 -0
- data/lib/VTK/vtkruby.exe +0 -0
- data/lib/VTK/vtksys.dll +0 -0
- data/lib/VTK/vtksys.exp +0 -0
- data/lib/VTK/vtksys.lib +0 -0
- data/lib/VTK/vtksysEncodeExecutable.exe +0 -0
- data/lib/VTK/vtksysProcessFwd9x.exe +0 -0
- data/lib/VTK/vtktiff.dll +0 -0
- data/lib/VTK/vtktiff.exp +0 -0
- data/lib/VTK/vtktiff.lib +0 -0
- data/lib/VTK/vtkzlib.dll +0 -0
- data/lib/VTK/vtkzlib.exp +0 -0
- data/lib/VTK/vtkzlib.lib +0 -0
- data/lib/VTK/widgets.rb +7 -0
- data/lib/VTK/widgets.rb.rule +1 -0
- data/lib/setup.rb +104 -0
- data/lib/vtk.rb +35 -0
- data/lib/vtk_dummy.rb +3 -0
- metadata +256 -0
@@ -0,0 +1 @@
|
|
1
|
+
# generated from CMake
|
@@ -0,0 +1,68 @@
|
|
1
|
+
#----------------------------------------------------------------------
|
2
|
+
# the following functions are for the vtk regression testing and examples
|
3
|
+
|
4
|
+
def vtkGetDataRoot
|
5
|
+
dataIndex=-1;
|
6
|
+
for i in 0..ARGV.length
|
7
|
+
if ARGV[i] == '-D' && i < ARGV.length-1:
|
8
|
+
dataIndex = i+1
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
if dataIndex != -1
|
13
|
+
dataRoot = ARGV[dataIndex]
|
14
|
+
else
|
15
|
+
unless dataRoot = ENV['VTK_DATA_ROOT']
|
16
|
+
dataRoot = '../../../../VTKData'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
return dataRoot
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def vtkRegressionTestImage( renWin )
|
25
|
+
imageIndex=-1;
|
26
|
+
for i in 0..ARGV.length
|
27
|
+
if ARGV[i] == '-V' && i < ARGV.length-1:
|
28
|
+
imageIndex = i+1
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
if imageIndex != -1
|
33
|
+
fname = File.join(vtkGetDataRoot(), ARGV[imageIndex])
|
34
|
+
|
35
|
+
rt_w2if = vtk.vtkWindowToImageFilter()
|
36
|
+
rt_w2if.SetInput(renWin)
|
37
|
+
|
38
|
+
if File.exist?(fname)
|
39
|
+
pass
|
40
|
+
else
|
41
|
+
rt_pngw = vtk.vtkPNGWriter()
|
42
|
+
rt_pngw.SetFileName(fname)
|
43
|
+
rt_pngw.SetInput(rt_w2if.GetOutput())
|
44
|
+
rt_pngw.Write()
|
45
|
+
rt_pngw = nil
|
46
|
+
end
|
47
|
+
|
48
|
+
rt_png = vtk.vtkPNGReader()
|
49
|
+
rt_png.SetFileName(fname)
|
50
|
+
|
51
|
+
rt_id = vtk.vtkImageDifference()
|
52
|
+
rt_id.SetInput(rt_w2if.GetOutput())
|
53
|
+
rt_id.SetImage(rt_png.GetOutput())
|
54
|
+
rt_id.Update()
|
55
|
+
|
56
|
+
if rt_id.GetThresholdedError() <= 10
|
57
|
+
return 1
|
58
|
+
else
|
59
|
+
$stderr.print("Failed image test: %f\n",
|
60
|
+
rt_id.GetThresholdedError())
|
61
|
+
return 0
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
return 2
|
66
|
+
end
|
67
|
+
|
68
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
# generated from CMake
|
@@ -0,0 +1,123 @@
|
|
1
|
+
"""
|
2
|
+
Miscellaneous constants copied from vtkSystemIncludes.h
|
3
|
+
(It would be nice if this file were automatically generated,
|
4
|
+
but the constants don't change very often)
|
5
|
+
"""
|
6
|
+
|
7
|
+
# Some constants used throughout code
|
8
|
+
|
9
|
+
VTK_LARGE_FLOAT = 1.0e+38
|
10
|
+
VTK_LARGE_INTEGER = 2147483647 # 2^31 - 1
|
11
|
+
|
12
|
+
# These types are returned by GetDataType to indicate pixel type.
|
13
|
+
VTK_VOID = 0
|
14
|
+
VTK_BIT = 1
|
15
|
+
VTK_CHAR = 2
|
16
|
+
VTK_UNSIGNED_CHAR = 3
|
17
|
+
VTK_SHORT = 4
|
18
|
+
VTK_UNSIGNED_SHORT = 5
|
19
|
+
VTK_INT = 6
|
20
|
+
VTK_UNSIGNED_INT = 7
|
21
|
+
VTK_LONG = 8
|
22
|
+
VTK_UNSIGNED_LONG = 9
|
23
|
+
VTK_FLOAT =10
|
24
|
+
VTK_DOUBLE =11
|
25
|
+
VTK_ID_TYPE =12
|
26
|
+
|
27
|
+
# These types are not currently supported by GetDataType, but are
|
28
|
+
# for completeness.
|
29
|
+
VTK_STRING =13
|
30
|
+
VTK_OPAQUE =14
|
31
|
+
|
32
|
+
# Some constant required for correct template performance
|
33
|
+
VTK_BIT_MIN = 0
|
34
|
+
VTK_BIT_MAX = 1
|
35
|
+
VTK_CHAR_MIN = -128
|
36
|
+
VTK_CHAR_MAX = 127
|
37
|
+
VTK_UNSIGNED_CHAR_MIN = 0
|
38
|
+
VTK_UNSIGNED_CHAR_MAX = 255
|
39
|
+
VTK_SHORT_MIN = -32768
|
40
|
+
VTK_SHORT_MAX = 32767
|
41
|
+
VTK_UNSIGNED_SHORT_MIN = 0
|
42
|
+
VTK_UNSIGNED_SHORT_MAX = 65535
|
43
|
+
VTK_INT_MIN = (-VTK_LARGE_INTEGER-1)
|
44
|
+
VTK_INT_MAX = VTK_LARGE_INTEGER
|
45
|
+
#VTK_UNSIGNED_INT_MIN = 0
|
46
|
+
#VTK_UNSIGNED_INT_MAX = 4294967295
|
47
|
+
VTK_LONG_MIN = (-VTK_LARGE_INTEGER-1)
|
48
|
+
VTK_LONG_MAX = VTK_LARGE_INTEGER
|
49
|
+
#VTK_UNSIGNED_LONG_MIN = 0
|
50
|
+
#VTK_UNSIGNED_LONG_MAX = 4294967295
|
51
|
+
VTK_FLOAT_MIN = -VTK_LARGE_FLOAT
|
52
|
+
VTK_FLOAT_MAX = VTK_LARGE_FLOAT
|
53
|
+
VTK_DOUBLE_MIN = -1.0e+99
|
54
|
+
VTK_DOUBLE_MAX = 1.0e+99
|
55
|
+
|
56
|
+
# These types are returned to distinguish dataset types
|
57
|
+
VTK_POLY_DATA = 0
|
58
|
+
VTK_STRUCTURED_POINTS = 1
|
59
|
+
VTK_STRUCTURED_GRID = 2
|
60
|
+
VTK_RECTILINEAR_GRID = 3
|
61
|
+
VTK_UNSTRUCTURED_GRID = 4
|
62
|
+
VTK_PIECEWISE_FUNCTION = 5
|
63
|
+
VTK_IMAGE_DATA = 6
|
64
|
+
VTK_DATA_OBJECT = 7
|
65
|
+
VTK_DATA_SET = 8
|
66
|
+
VTK_POINT_SET = 9
|
67
|
+
|
68
|
+
# These types define error codes for vtk functions
|
69
|
+
VTK_OK = 1
|
70
|
+
VTK_ERROR = 2
|
71
|
+
|
72
|
+
# These types define different text properties
|
73
|
+
VTK_ARIAL = 0
|
74
|
+
VTK_COURIER = 1
|
75
|
+
VTK_TIMES = 2
|
76
|
+
|
77
|
+
VTK_TEXT_LEFT = 0
|
78
|
+
VTK_TEXT_CENTERED = 1
|
79
|
+
VTK_TEXT_RIGHT = 2
|
80
|
+
|
81
|
+
VTK_TEXT_BOTTOM = 0
|
82
|
+
VTK_TEXT_TOP = 2
|
83
|
+
|
84
|
+
VTK_TEXT_GLOBAL_ANTIALIASING_SOME = 0
|
85
|
+
VTK_TEXT_GLOBAL_ANTIALIASING_NONE = 1
|
86
|
+
VTK_TEXT_GLOBAL_ANTIALIASING_ALL = 2
|
87
|
+
|
88
|
+
VTK_LUMINANCE = 1
|
89
|
+
VTK_LUMINANCE_ALPHA = 2
|
90
|
+
VTK_RGB = 3
|
91
|
+
VTK_RGBA = 4
|
92
|
+
|
93
|
+
VTK_COLOR_MODE_DEFAULT = 0
|
94
|
+
VTK_COLOR_MODE_MAP_SCALARS = 1
|
95
|
+
|
96
|
+
# Constants for InterpolationType
|
97
|
+
VTK_NEAREST_INTERPOLATION = 0
|
98
|
+
VTK_LINEAR_INTERPOLATION = 1
|
99
|
+
|
100
|
+
# For volume rendering
|
101
|
+
VTK_MAX_VRCOMP = 4
|
102
|
+
|
103
|
+
|
104
|
+
# A macro to get the name of a type
|
105
|
+
|
106
|
+
__vtkTypeNameDict = {VTK_VOID=>"void",
|
107
|
+
VTK_DOUBLE=>"double",
|
108
|
+
VTK_FLOAT=>"float",
|
109
|
+
VTK_LONG=>"long",
|
110
|
+
VTK_UNSIGNED_LONG=>"unsigned long",
|
111
|
+
VTK_INT=>"int",
|
112
|
+
VTK_UNSIGNED_INT=>"unsigned int",
|
113
|
+
VTK_SHORT=>"short",
|
114
|
+
VTK_UNSIGNED_SHORT=>"unsigned short",
|
115
|
+
VTK_CHAR=>"char",
|
116
|
+
VTK_UNSIGNED_CHAR=>"unsigned char",
|
117
|
+
VTK_BIT=>"bit"}
|
118
|
+
|
119
|
+
def vtkImageScalarTypeNameMacro(type)
|
120
|
+
return __vtkTypeNameDict[type]
|
121
|
+
end
|
122
|
+
|
123
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
# generated from CMake
|
@@ -0,0 +1,96 @@
|
|
1
|
+
begin
|
2
|
+
require "narray"
|
3
|
+
|
4
|
+
module Vtk
|
5
|
+
class ImageExportToArray
|
6
|
+
def initialize
|
7
|
+
@export = ImageExport.new
|
8
|
+
@ConvertUnsignedShortToInt = false
|
9
|
+
end
|
10
|
+
|
11
|
+
@@typeDict = { VTK_CHAR=>NArray::BYTE,
|
12
|
+
VTK_UNSIGNED_CHAR=>NArray::BYTE,
|
13
|
+
VTK_SHORT=>NArray::SINT,
|
14
|
+
VTK_UNSIGNED_SHORT=>NArray::SINT,
|
15
|
+
VTK_INT=>NArray::INT,
|
16
|
+
VTK_FLOAT=>NArray::SFLOAT,
|
17
|
+
VTK_DOUBLE=>NArray::FLOAT }
|
18
|
+
|
19
|
+
@@sizeDict = { VTK_CHAR=>1,
|
20
|
+
VTK_UNSIGNED_CHAR=>1,
|
21
|
+
VTK_SHORT=>2,
|
22
|
+
VTK_UNSIGNED_SHORT=>2,
|
23
|
+
VTK_INT=>4,
|
24
|
+
VTK_FLOAT=>4,
|
25
|
+
VTK_DOUBLE=>8 }
|
26
|
+
|
27
|
+
# convert unsigned shorts to ints, to avoid sign problems
|
28
|
+
def SetConvertUnsignedShortToInt(yesno)
|
29
|
+
@ConvertUnsignedShortToInt = yesno
|
30
|
+
end
|
31
|
+
|
32
|
+
def GetConvertUnsignedShortToInt
|
33
|
+
return @ConvertUnsignedShortToInt
|
34
|
+
end
|
35
|
+
|
36
|
+
def ConvertUnsignedShortToIntOn
|
37
|
+
@ConvertUnsignedShortToInt = true
|
38
|
+
end
|
39
|
+
|
40
|
+
def ConvertUnsignedShortToIntOff
|
41
|
+
@ConvertUnsignedShortToInt = false
|
42
|
+
end
|
43
|
+
|
44
|
+
# set the input
|
45
|
+
def SetInput(input)
|
46
|
+
return @export.SetInput(input)
|
47
|
+
end
|
48
|
+
|
49
|
+
def GetInput
|
50
|
+
return @export.GetInput
|
51
|
+
end
|
52
|
+
|
53
|
+
def GetArray
|
54
|
+
input = @export.GetInput
|
55
|
+
input.UpdateInformation
|
56
|
+
type = input.GetScalarType
|
57
|
+
extent = input.GetWholeExtent
|
58
|
+
numComponents = input.GetNumberOfScalarComponents
|
59
|
+
dim = [extent[5]-extent[4]+1,
|
60
|
+
extent[3]-extent[2]+1,
|
61
|
+
extent[1]-extent[0]+1]
|
62
|
+
if (numComponents > 1)
|
63
|
+
dim = dim + [numComponents]
|
64
|
+
end
|
65
|
+
size = dim[0]*dim[1]*dim[2]*numComponents*@@sizeDict[type]
|
66
|
+
|
67
|
+
imString = NArray.byte(size).to_s
|
68
|
+
@export.Export(imString)
|
69
|
+
imArray = NArray.to_na(imString,@@typeDict[type])
|
70
|
+
|
71
|
+
# reshape array appropriately.
|
72
|
+
imArray.reshape!(*dim)
|
73
|
+
# convert unsigned short to int to avoid sign issues
|
74
|
+
if (type == VTK_UNSIGNED_SHORT && @ConvertUnsignedShortToInt)
|
75
|
+
imArray = umath.bitwise_and(imArray.astype(Numeric.Int32),0xffff)
|
76
|
+
return imArray
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def GetDataExtent
|
81
|
+
return @export.GetDataExtent
|
82
|
+
end
|
83
|
+
|
84
|
+
def GetDataSpacing
|
85
|
+
return @export.GetDataSpacing
|
86
|
+
end
|
87
|
+
|
88
|
+
def GetDataOrigin
|
89
|
+
return @export.GetDataOrigin
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
rescue LoadError
|
96
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
# generated from CMake
|
@@ -0,0 +1,116 @@
|
|
1
|
+
begin
|
2
|
+
require 'narray'
|
3
|
+
|
4
|
+
module Vtk
|
5
|
+
class ImageImportFromArray
|
6
|
+
def initialize
|
7
|
+
@import = ImageImport.new
|
8
|
+
@ConvertIntToUnsignedShort = false
|
9
|
+
@Array = nil
|
10
|
+
end
|
11
|
+
|
12
|
+
@@typeDict = {NArray::BYTE=>VTK_UNSIGNED_CHAR,
|
13
|
+
NArray::SINT=>VTK_SHORT,
|
14
|
+
NArray::INT=>VTK_INT,
|
15
|
+
NArray::SFLOAT=>VTK_FLOAT,
|
16
|
+
NArray::FLOAT=>VTK_DOUBLE }
|
17
|
+
|
18
|
+
@@sizeDict = { VTK_CHAR=>1,
|
19
|
+
VTK_UNSIGNED_CHAR=>1,
|
20
|
+
VTK_SHORT=>2,
|
21
|
+
VTK_UNSIGNED_SHORT=>2,
|
22
|
+
VTK_INT=>4,
|
23
|
+
VTK_FLOAT=>4,
|
24
|
+
VTK_DOUBLE=>8 }
|
25
|
+
|
26
|
+
# convert 'Int32' to 'unsigned short'
|
27
|
+
def SetConvertIntToUnsignedShort(yesno)
|
28
|
+
@ConvertIntToUnsignedShort = yesno
|
29
|
+
end
|
30
|
+
|
31
|
+
def GetConvertIntToUnsignedShort
|
32
|
+
return @ConvertIntToUnsignedShort
|
33
|
+
end
|
34
|
+
|
35
|
+
def ConvertIntToUnsignedShortOn
|
36
|
+
@ConvertIntToUnsignedShort = true
|
37
|
+
end
|
38
|
+
|
39
|
+
def ConvertIntToUnsignedShortOff
|
40
|
+
@ConvertIntToUnsignedShort = false
|
41
|
+
end
|
42
|
+
|
43
|
+
# get the output
|
44
|
+
def GetOutput
|
45
|
+
return @import.GetOutput
|
46
|
+
end
|
47
|
+
|
48
|
+
# import an array
|
49
|
+
def SetArray(imArray)
|
50
|
+
@Array = imArray
|
51
|
+
numComponents = 1
|
52
|
+
dim = imArray.shape
|
53
|
+
|
54
|
+
if (dim.length == 4)
|
55
|
+
numComponents = dim[3]
|
56
|
+
dim = [dim[0],dim[1],dim[2]]
|
57
|
+
end
|
58
|
+
|
59
|
+
type = @@typeDict[imArray.typecode]
|
60
|
+
|
61
|
+
if (@ConvertIntToUnsignedShort && imArray.typecode == NArray::INT)
|
62
|
+
imTmpArr = imArray.astype(Numeric.Int16).to_s
|
63
|
+
type = VTK_UNSIGNED_SHORT
|
64
|
+
else
|
65
|
+
imTmpArr = imArray.to_s
|
66
|
+
end
|
67
|
+
|
68
|
+
size = imTmpArr.len*@@sizeDict[type]
|
69
|
+
@import.CopyImportVoidPointer(imTmpArr, size)
|
70
|
+
@import.SetDataScalarType(type)
|
71
|
+
@import.SetNumberOfScalarComponents(numComponents)
|
72
|
+
extent = @import.GetDataExtent
|
73
|
+
@import.SetDataExtent(extent[0],extent[0]+dim[2]-1,
|
74
|
+
extent[2],extent[2]+dim[1]-1,
|
75
|
+
extent[4],extent[4]+dim[0]-1)
|
76
|
+
@import.SetWholeExtent(extent[0],extent[0]+dim[2]-1,
|
77
|
+
extent[2],extent[2]+dim[1]-1,
|
78
|
+
extent[4],extent[4]+dim[0]-1)
|
79
|
+
end
|
80
|
+
|
81
|
+
def GetArray
|
82
|
+
return @Array
|
83
|
+
end
|
84
|
+
|
85
|
+
# a whole bunch of methods copied from vtkImageImport
|
86
|
+
|
87
|
+
def SetDataExtent(extent)
|
88
|
+
@import.SetDataExtent(extent)
|
89
|
+
end
|
90
|
+
|
91
|
+
def GetDataExtent
|
92
|
+
return @import.GetDataExtent
|
93
|
+
end
|
94
|
+
|
95
|
+
def SetDataSpacing(spacing)
|
96
|
+
@import.SetDataSpacing(spacing)
|
97
|
+
end
|
98
|
+
|
99
|
+
def GetDataSpacing
|
100
|
+
return @import.GetDataSpacing
|
101
|
+
end
|
102
|
+
|
103
|
+
def SetDataOrigin(origin)
|
104
|
+
@import.SetDataOrigin(origin)
|
105
|
+
end
|
106
|
+
|
107
|
+
def GetDataOrigin
|
108
|
+
return @import.GetDataOrigin
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
rescue LoadError
|
114
|
+
end
|
115
|
+
|
116
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
# generated from CMake
|
@@ -0,0 +1 @@
|
|
1
|
+
# generated from CMake
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|