# 需要導入模塊: from skimage import measure [as 別名]

# 或者: from skimage.measure import marching_cubes [as 別名]

def compute_marching_cubes_regular_grid(self, level: float, scalar_field,

mask_array=None,

rescale=False, **kwargs):

"""Compute the surface (vertices and edges) of a given surface by computing

marching cubes (by skimage)

Args:

level (float): value of the scalar field at the surface

scalar_field (np.array): scalar_field vector objects

mask_array (np.array): mask vector with trues where marching cubes has to be performed

rescale (bool): if True surfaces will be located between 0 and 1

**kwargs: skimage.measure.marching_cubes_lewiner args (see below)

Returns:

list: vertices, simplices, normals, values

See Also:

:func:`skimage.measure.marching_cubes`

"""

vertices, simplices, normals, values = measure.marching_cubes(

scalar_field.reshape(self.grid.regular_grid.resolution[0],

self.grid.regular_grid.resolution[1],

self.grid.regular_grid.resolution[2]),

level,

spacing=self.grid.regular_grid.get_dx_dy_dz(rescale=rescale),

mask=mask_array,

**kwargs)

if rescale is True:

loc_0 = self.grid.regular_grid.extent_r[[0, 2, 4]] + \

np.array(self.grid.regular_grid.get_dx_dy_dz(rescale=True)) / 2

vertices += np.array(loc_0).reshape(1, 3)

else:

loc_0 = self.grid.regular_grid.extent[[0, 2, 4]] + \

np.array(self.grid.regular_grid.get_dx_dy_dz(rescale=False)) / 2

vertices += np.array(loc_0).reshape(1, 3)

return [vertices, simplices, normals, values]

# def mask_topo(self, mask_matrix):

# """Add the masked elements of the topography to the masking matrix"""

# x = ~self.grid.regular_grid.mask_topo

# a = (np.swapaxes(x, 0, 1) * mask_matrix)

# return a

python的cubes怎么使用_Python measure.marching_cubes方法代碼示例相关推荐

  1. python里turtle.circle什么意思_Python turtle.circle方法代碼示例

    本文整理匯總了Python中turtle.circle方法的典型用法代碼示例.如果您正苦於以下問題:Python turtle.circle方法的具體用法?Python turtle.circle怎麽 ...

  2. python的from_bytes属性_Python parse.quote_from_bytes方法代碼示例

    本文整理匯總了Python中urllib.parse.quote_from_bytes方法的典型用法代碼示例.如果您正苦於以下問題:Python parse.quote_from_bytes方法的具體 ...

  3. python中startout是什么意思_Python socket.timeout方法代碼示例

    本文整理匯總了Python中gevent.socket.timeout方法的典型用法代碼示例.如果您正苦於以下問題:Python socket.timeout方法的具體用法?Python socket ...

  4. python markdown2 样式_Python markdown2.markdown方法代碼示例

    本文整理匯總了Python中markdown2.markdown方法的典型用法代碼示例.如果您正苦於以下問題:Python markdown2.markdown方法的具體用法?Python markd ...

  5. python socketio例子_Python socket.SocketIO方法代碼示例

    本文整理匯總了Python中socket.SocketIO方法的典型用法代碼示例.如果您正苦於以下問題:Python socket.SocketIO方法的具體用法?Python socket.Sock ...

  6. python unescape函数_Python escape.url_unescape方法代碼示例

    本文整理匯總了Python中tornado.escape.url_unescape方法的典型用法代碼示例.如果您正苦於以下問題:Python escape.url_unescape方法的具體用法?Py ...

  7. python linspace函数_Python torch.linspace方法代碼示例

    本文整理匯總了Python中torch.linspace方法的典型用法代碼示例.如果您正苦於以下問題:Python torch.linspace方法的具體用法?Python torch.linspac ...

  8. pythonitems方法_Python environ.items方法代碼示例

    本文整理匯總了Python中os.environ.items方法的典型用法代碼示例.如果您正苦於以下問題:Python environ.items方法的具體用法?Python environ.item ...

  9. python中fmod什么意思_Python fmod()用法及代碼示例

    fmod()函數是Python中的標準數學庫函數之一,用於計算指定給定參數的模塊. 用法: math.fmod( x, y ) 參數: x任何有效數字(正數或負數). y任何有效數字(正數或負數). ...

  10. python wheel使用_Python wheel.Wheel方法代碼示例

    # 需要導入模塊: from pip import wheel [as 別名] # 或者: from pip.wheel import Wheel [as 別名] def from_line(cls, ...

最新文章

  1. 用局部条件图集建模三维曲面流形
  2. java基础初步总结
  3. 多个结果集ResultSet的问题
  4. 【Java 并发编程】线程池机制 ( 线程池状态分析 | 线程池状态转换 | RUNNING | SHUTDOWN | STOP | TIDYING | TERMINATED )
  5. MyCat学习:使用MySQL搭建主从复制(一主一从模式)
  6. carsim学习笔记4——构建路面
  7. 哪些人不能要 哪些人不能留
  8. [转载] JVM(一):JVM体系结构详解
  9. 复习---使用基础语法实现栈及迭代
  10. compose yaml规则
  11. 安卓源码下载的环境搭建
  12. arma 预测 matlab代码,求助:ARMA模型进行预测
  13. Java 后台 google地图通过经纬度寻找地址
  14. smipleChart 简单图表类 javascript
  15. APISpace 手机号码归属地API 方便好用
  16. 斯坦福用算法降低:令欧洲头大的难民犯罪率
  17. 树莓派计算模块CM4 eMMC系统烧写、配置、相机连接
  18. curaengine linux编译,Cura Engine
  19. 云服务器(一)基本操作
  20. 你应该如何学习一个未知的技术领域?- 菜鸟小白篇

热门文章

  1. 坚果nuts 加速 官网_quot;如果你不吃坚果,你就是坚果(傻瓜)!quot;
  2. 创建选区快捷键是什么_ps选区的快捷键是什么
  3. 每日单词20110502
  4. Vue的一些API理解整理,如何一次引入多次调用
  5. 图灵大会圆满落幕,码隆科技与全球最强大脑同台
  6. virtualbox 清理磁盘占用空间
  7. c语言中pinMode的作用,Arduino C语言的基本结构
  8. 第一次接触低代码平台 AppCube,还是有点门槛的
  9. 【火炉炼AI】机器学习052-OpenCV构建人脸鼻子眼睛检测器
  10. SovitChart工具1分钟快速开发前端统计图表