python 三维图片 任意切片_matplotlib三维二维切片

体积切片操作通常依赖于插值的概念,最典型的是:Nearest neighbor,Linear,和{a3}。请注意,这些方法适用于更多的维度(例如请参见Bilinear或Trilinear插值)。在

在本例中,您是说您有一个卷,可以从中检索X、Y、Z(或一个混合体,但不考虑这种情况,因为这是一个新的整体问题,只会带来混乱)。在

以切片X=5和X=6为例,你想知道如何得到X=5.5。看看这个例子:def linear_interpolation(p1, p2, x0):

"""

Function that receives as arguments the coordinates of two points (x,y)

and returns the linear interpolation of a y0 in a given x0 position. This is the

equivalent to obtaining y0 = y1 + (y2 - y1)*((x0-x1)/(x2-x1)).

Look into https://en.wikipedia.org/wiki/Linear_interpolation for more

information.

Parameters

p1 : tuple (floats)

Tuple (x,y) of a first point in a line.

p2 : tuple (floats)

Tuple (x,y) of a second point in a line.

x0 : float

X coordinate on which you want to interpolate a y0.

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值