當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。