在3D空间中的两个平面之间进行插值 [英] Interpolating Between Two Planes in 3d space

查看:124
本文介绍了在3D空间中的两个平面之间进行插值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一种工具,可让您在3d体积"上画圈/包围事物.我想通过标记"slices"(切片)1和3,并从该信息中填充" slice 2(切片2)来节省时间.

I'm developing a tool that lets you circle/enclose things on a 3d "volume." I want to save time by labelling "slices" 1 and 3, and "filling in" slice 2 from that information.

两个简单的解决方案是:

Two easy solutions are to:

1. slice2 = slice1 AND slice3 (gets the overlap between the two)
2. slice2 = slice2 OR  slice3 (true for any pixel true in either image)

这些还可以并且速度很快,但是我更愿意通过使形状在两者之间进行某种平均/内插来做一些更聪明的事情. 您可以将其想象为试图找到将飞机与视平面和空中的某些高原连接起来的悬崖面.

These are ok and fast, but I would prefer to do something more intelligent by making the shape some sort of average/ interpolation between the two. You can imagine it as trying to find the cliff face that connects a plane at see level and some plateau in the air.

示例:填写此3d矩阵中的2-4个切片. (使用montage创建)

Example: Fill in slices 2-4 from this 3d matrix. (Created using montage)

随时提出全新的想法.我要把我的想法放在下面.

Feel free to come up with totally new ideas. I'm going to put my thoughts so far below.

我考虑过的某些内容可能会对您有帮助,回答者,但我无法成功使用.
-您可以在每个图像上进行bwperim.
-您可以尝试平均"图像(或加权平均值).

Some stuff I've thought about that might help you, the answerer, but that I haven't been able to use successfully.
- You can do a bwperim on each image.
- You can try to "average" the images (or a weighted average).

到目前为止我所能获得的最好成绩:

The best I've got so far:

添加图像. 给您重叠和两个周长:
-一个内周长(其中的内周绝对是1)
-和外围(里面有问题).
您也可以掩盖> 0 AND< 2的区域,这是该可疑区域的掩膜.
在两周图像上运行bwdist并屏蔽以下内容:

Add the images. Gives you overlap and two perimeters:
-an inner perimeter (inside of which will definitely be 1)
-and an outer perimeter (inside of which is questionable).
You can also mask the area that is >0 AND <2, which is a mask of this questionable area.
Run a bwdist on the two-perimeter image and mask that:

不过,不确定如何从这里开始.沿该区域采用最大"轮廓的线将起作用,但是我不确定如何可靠地执行该操作.

Not sure how to go from here, though. A line that took the "maximum" contour along that area would work, but I'm not sure how to do that robustly.

欢迎提出任何解决我的想法或任何其他想法的想法!

Any ideas on fixing my idea or any other ideas are welcome!

谢谢.

推荐答案

在阅读以下内容后,我今天想到了这一点: Schenk等人的医学图像中3D对象的有效半自动分割".

I figured this out today, after reading: "Efficient Semiautomatic Segmentation of 3D Objects in Medical Images" by Schenk, et. al.

这是我写的函数:

function out = interp_shape(top,bottom,num)


if nargin<2;
    error('not enough args');
end
if nargin<3;
    num = 1;
end
if ~num>0 && round(num)== num; 
    error('number of slices to be interpolated must be integer >0');
end

top = signed_bwdist(top); % see local function below
bottom = signed_bwdist(bottom);

r = size(top,1);
c = size(top,2);
t = num+2;

[x y z] = ndgrid(1:r,1:c,[1 t]); % existing data
[xi yi zi] = ndgrid(1:r,1:c,1:t); % including new slice

out = interpn(x,y,z,cat(3,bottom,top),xi,yi,zi);
out = out(:,:,2:end-1)>=0;

function im = signed_bwdist(im)
im = -bwdist(bwperim(im)).*~im + bwdist(bwperim(im)).*im;

这篇关于在3D空间中的两个平面之间进行插值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆