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

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

问题描述

我正在开发一种工具,可让您在 3d体积"上圈出/圈出事物.我想通过标记切片"1 和 3 并从该信息中填充"切片 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).

目前为止最好的:

添加图像.为您提供重叠和两个周长:
- 一个内周长(里面肯定是 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!

谢谢.

推荐答案

我今天在阅读后发现了这一点:医学图像中 3D 对象的高效半自动分割",作者:Schenk 等.

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天全站免登陆