当前位置: 首页>>代码示例>>Python>>正文


Python vtk.VTK_DOUBLE属性代码示例

本文整理汇总了Python中vtk.VTK_DOUBLE属性的典型用法代码示例。如果您正苦于以下问题:Python vtk.VTK_DOUBLE属性的具体用法?Python vtk.VTK_DOUBLE怎么用?Python vtk.VTK_DOUBLE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在vtk的用法示例。


在下文中一共展示了vtk.VTK_DOUBLE属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: field_data_type

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import VTK_DOUBLE [as 别名]
def field_data_type(vtk_data_type):
    type_dict = dict()
    type_dict[vtk.VTK_BIT]           = tecio_szl.FD_UINT8
    type_dict[vtk.VTK_CHAR]          = tecio_szl.FD_UINT8 
    type_dict[vtk.VTK_UNSIGNED_CHAR] = tecio_szl.FD_UINT8
    type_dict[vtk.VTK_INT]           = tecio_szl.FD_INT16
    type_dict[vtk.VTK_UNSIGNED_INT]  = tecio_szl.FD_INT16
    type_dict[vtk.VTK_LONG]          = tecio_szl.FD_INT32
    type_dict[vtk.VTK_UNSIGNED_LONG] = tecio_szl.FD_INT32
    type_dict[vtk.VTK_FLOAT]         = tecio_szl.FD_FLOAT
    type_dict[vtk.VTK_DOUBLE]        = tecio_szl.FD_DOUBLE
    return type_dict[vtk_data_type]

#
# This function will only create SZL files. This uses a newer TecIO API which
# allows specification of the data type.  This should result in slightly
# smaller files for data files which contain data types smaller than single precision.
# 
开发者ID:Tecplot,项目名称:handyscripts,代码行数:20,代码来源:vti_converter_tecio.py

示例2: field_data_type

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import VTK_DOUBLE [as 别名]
def field_data_type(vtk_data_type):
    type_dict = dict()
    type_dict[vtk.VTK_BIT]           = FieldDataType.Bit
    type_dict[vtk.VTK_CHAR]          = FieldDataType.Byte 
    type_dict[vtk.VTK_UNSIGNED_CHAR] = FieldDataType.Byte
    type_dict[vtk.VTK_INT]           = FieldDataType.Int16
    type_dict[vtk.VTK_UNSIGNED_INT]  = FieldDataType.Int16
    type_dict[vtk.VTK_LONG]          = FieldDataType.Int32
    type_dict[vtk.VTK_UNSIGNED_LONG] = FieldDataType.Int32
    type_dict[vtk.VTK_FLOAT]         = FieldDataType.Float
    type_dict[vtk.VTK_DOUBLE]        = FieldDataType.Double
    return type_dict[vtk_data_type] 
开发者ID:Tecplot,项目名称:handyscripts,代码行数:14,代码来源:vtk_file_converter.py

示例3: save_vtk

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import VTK_DOUBLE [as 别名]
def save_vtk(filename, tracts, lines_indices=None, scalars = None):

	lengths = [len(p) for p in tracts]
	line_starts = ns.numpy.r_[0, ns.numpy.cumsum(lengths)]
	if lines_indices is None:
		lines_indices = [ns.numpy.arange(length) + line_start for length, line_start in izip(lengths, line_starts)]

	ids = ns.numpy.hstack([ns.numpy.r_[c[0], c[1]] for c in izip(lengths, lines_indices)])
	vtk_ids = ns.numpy_to_vtkIdTypeArray(ids, deep=True)

	cell_array = vtk.vtkCellArray()
	cell_array.SetCells(len(tracts), vtk_ids)
	points = ns.numpy.vstack(tracts).astype(ns.get_vtk_to_numpy_typemap()[vtk.VTK_DOUBLE])
	points_array = ns.numpy_to_vtk(points, deep=True)

	poly_data = vtk.vtkPolyData()
	vtk_points = vtk.vtkPoints()
	vtk_points.SetData(points_array)
	poly_data.SetPoints(vtk_points)
	poly_data.SetLines(cell_array)
	poly_data.BuildCells()

	if filename.endswith('.xml') or filename.endswith('.vtp'):
		writer = vtk.vtkXMLPolyDataWriter()
		writer.SetDataModeToBinary()
	else:
		writer = vtk.vtkPolyDataWriter()
		writer.SetFileTypeToBinary()


	writer.SetFileName(filename)
	if hasattr(vtk, 'VTK_MAJOR_VERSION') and vtk.VTK_MAJOR_VERSION > 5:
		writer.SetInputData(poly_data)
	else:
		writer.SetInput(poly_data)
	writer.Write() 
开发者ID:jeanfeydy,项目名称:geomloss,代码行数:38,代码来源:tract_io.py

示例4: save_vtk_labels

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import VTK_DOUBLE [as 别名]
def save_vtk_labels(filename, tracts, scalars, lines_indices=None):

	lengths = [len(p) for p in tracts]
	line_starts = ns.numpy.r_[0, ns.numpy.cumsum(lengths)]
	if lines_indices is None:
		lines_indices = [ns.numpy.arange(length) + line_start for length, line_start in izip(lengths, line_starts)]

	ids = ns.numpy.hstack([ns.numpy.r_[c[0], c[1]] for c in izip(lengths, lines_indices)])
	vtk_ids = ns.numpy_to_vtkIdTypeArray(ids, deep=True)

	cell_array = vtk.vtkCellArray()
	cell_array.SetCells(len(tracts), vtk_ids)
	points = ns.numpy.vstack(tracts).astype(ns.get_vtk_to_numpy_typemap()[vtk.VTK_DOUBLE])
	points_array = ns.numpy_to_vtk(points, deep=True)

	poly_data = vtk.vtkPolyData()
	vtk_points = vtk.vtkPoints()
	vtk_points.SetData(points_array)
	poly_data.SetPoints(vtk_points)
	poly_data.SetLines(cell_array)
	poly_data.GetPointData().SetScalars(ns.numpy_to_vtk(scalars))
	poly_data.BuildCells()
#    poly_data.SetScalars(scalars)

	if filename.endswith('.xml') or filename.endswith('.vtp'):
		writer = vtk.vtkXMLPolyDataWriter()
		writer.SetDataModeToBinary()
	else:
		writer = vtk.vtkPolyDataWriter()
		writer.SetFileTypeToBinary()


	writer.SetFileName(filename)
	if hasattr(vtk, 'VTK_MAJOR_VERSION') and vtk.VTK_MAJOR_VERSION > 5:
		writer.SetInputData(poly_data)
	else:
		writer.SetInput(poly_data)
	writer.Write() 
开发者ID:jeanfeydy,项目名称:geomloss,代码行数:40,代码来源:tract_io.py

示例5: make_image_data

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import VTK_DOUBLE [as 别名]
def make_image_data():
    image_data = vtk.vtkImageData()
    image_data.SetDimensions(3, 4, 5)
    image_data.AllocateScalars(vtk.VTK_DOUBLE, 1)

    dims = image_data.GetDimensions()

    # Fill every entry of the image data with random double
    for z in range(dims[2]):
        for y in range(dims[1]):
            for x in range(dims[0]):
                image_data.SetScalarComponentFromDouble(x, y, z, 0, np.random.rand())
    return image_data 
开发者ID:holoviz,项目名称:panel,代码行数:15,代码来源:test_vtk.py

示例6: get_dtypes

# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import VTK_DOUBLE [as 别名]
def get_dtypes(dtype='', endian=None):
    """This converts char dtypes and an endian to a numpy and VTK data type.

    Return:
        tuple (numpy.dtype, int):
            the numpy data type and the integer type id specified in vtkType.h
            for VTK data types
    """
    # If native `@` was chosen then do not pass an endian
    if endian == '@':
        #print('WARNING: Native endianness no longer supported for packed binary reader. Please chose `>` or `<`. This defaults to big `>`.')
        endian = ''
    # No endian specified:
    elif endian is None:
        endian = ''
    # Get numpy and VTK data types and return them both
    if dtype == 'd':
        vtktype = vtk.VTK_DOUBLE
    elif dtype == 'f':
        vtktype = vtk.VTK_FLOAT
    elif dtype == 'i':
        vtktype = vtk.VTK_INT
    else:
        raise _helpers.PVGeoError('dtype \'%s\' unknown:' % dtype)
    # Return data types
    dtype = np.dtype('%s%s' % (endian, dtype))
    return dtype, vtktype 
开发者ID:OpenGeoVis,项目名称:PVGeo,代码行数:29,代码来源:interface.py


注:本文中的vtk.VTK_DOUBLE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。