在 3d 空间中的两个平面之间插值

问题描述 投票:0回答:1

我正在开发一种工具,可以让您在 3D“体积”上圈出/包围事物。我想通过标记“切片”1 和 3 并从该信息“填充”切片 2 来节省时间。

两个简单的解决方案是:

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

这些是好的并且速度很快,但我更喜欢通过使形状在两者之间进行某种平均/插值来做一些更智能的事情。 您可以将其想象为试图找到连接海平面飞机和空中高原的悬崖面。

示例:填充此 3d 矩阵中的切片 2-4。 (使用

montage
创建) slices one through five

随意想出全新的想法。我将把我的想法写在下面。

我想到的一些东西可能会对你(回答者)有所帮助,但我还没有能够成功使用。

  • 您可以对每个图像执行 bwperim。
  • 您可以尝试对图像进行“平均”(或加权平均值)。

迄今为止我所拥有的最好的:

添加图像。 为您提供重叠和两个周长:
- 一个内周长(其内部肯定是1)
-和一个外周界(其内部是有问题的)。
您还可以屏蔽 >0 AND <2, which is a mask of this questionable area.
的区域 在两周边图像上运行

bwdist
并遮罩:

![蒙版 bwdist 图像] 2

但不知道如何从这里开始。沿着该区域绘制“最大”轮廓的线是可行的,但我不确定如何稳健地做到这一点。

欢迎任何关于修正我的想法或任何其他想法的想法!

谢谢。

matlab math 3d contour spatial-interpolation
1个回答
5
投票

今天读完后我明白了这一点: “医学图像中 3D 对象的高效半自动分割”,作者:Schenk 等人。等。

这是我写的函数:

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;

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.