使用MATLAB在3D MRI体积中创建中间切片 [英] Creating intermediate slices in a 3D MRI volume with MATLAB

查看:114
本文介绍了使用MATLAB在3D MRI体积中创建中间切片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有9张MRI图像,并希望用这些图像制作3D体积。从那里,我想插入每个切片之间。给定卷中的两个切片,我想在两个切片之间插入一个中间帧。目标是创建一个18个MRI体积来执行此插值。

I have 9 MRI images and would like to make a 3D volume out of these images. From there, I would like to interpolate in between each slice. Given two slices in the volume, I would like to create an intermediate frame in between that interpolates between the two slices. The goal is to create an 18 MRI volume that performs this interpolation.

我将如何在MATLAB中实现此目的?

How would I accomplish this in MATLAB?

推荐答案

假设您的MRI图像处于3D堆叠体积中,您可以使用 interp3 。选择采样点时,切片的行和列将保持不变,但是时间或 Z 方向的大小只会加倍。所以这样的事情,假设 MRI 是你的音量:

Assuming that your MRI images are in a 3D stacked volume, you can accomplish what you want by using interp3. The rows and columns of a slice will stay the same when choosing the sampling points, but the temporal or Z direction will simply double in size. So something like this, assuming that MRI is your volume:

[rows,cols,slices] = size(MRI);
[X,Y,Z] = meshgrid(1:cols, 1:rows, 1:slices);
[X2,Y2,Z2] = meshgrid(1:cols, 1:rows, 0.5:0.5:slices);
out = interp3(X, Y, Z, MRI, X2, Y2, Z2, 'linear', 0);

以上将生成一个包含两倍切片的卷,保持行和列相同,使用双线性插值。额外的 0 确保如果我们创建的值超出原始采样点,我们会将这些点推断为0。

The above will generate a volume that has twice as many slices, keeping the rows and columns the same and using bilinear interpolation. The extra 0 ensures that if we are creating values that are outside of the original sampling points, we will extrapolate these points to 0.

如果您的图像是3D体积,则需要将其放入3D矩阵中。假设他们被称为 MRI1 高达 MRI9 ,你可以这样做:

If your images are not a 3D volume, you'll need to place this into a 3D matrix. Assuming that they're called MRI1 up to MRI9, you can do:

MRI = cat(3, MRI1, MRI2, MRI3, MRI4, MRI5, MRI6, MRI7, MRI8, MRI9);

然后您可以使用上述代码。完成后,您可以通过以下操作获取中间切片:

You can then use the above code. Once you're finished, you can grab the intermediate slices by doing:

final_slices = MRI(:,:,1:2:end);

然后,您可以使用 final_slices 。

作为一个看到这个工作的快速示例,让我们假设我们的卷是一堆3中的随机数x 3 x 3卷:

As a quick example seeing this working, let's assume that our volume is a bunch of random numbers in a 3 x 3 x 3 volume:

rng(123123);
MRI = rand(3,3,3)

MRI(:,:,1) =

    0.3002    0.8302    0.1768
    0.9946    0.7214    0.0678
    0.2901    0.4627    0.5201


MRI(:,:,2) =

    0.2323    0.8516    0.7838
    0.3251    0.5326    0.6377
    0.7220    0.4735    0.0717


MRI(:,:,3) =

    0.3202    0.1259    0.3360
    0.1004    0.9260    0.6287
    0.6922    0.3191    0.9011

运行上面的插值代码,我们得到:

Running the above interpolation code, we get:

out(:,:,1) =

     0     0     0
     0     0     0
     0     0     0


out(:,:,2) =

    0.3002    0.8302    0.1768
    0.9946    0.7214    0.0678
    0.2901    0.4627    0.5201


out(:,:,3) =

    0.2662    0.8409    0.4803
    0.6598    0.6270    0.3527
    0.5060    0.4681    0.2959


out(:,:,4) =

    0.2323    0.8516    0.7838
    0.3251    0.5326    0.6377
    0.7220    0.4735    0.0717


out(:,:,5) =

    0.2763    0.4887    0.5599
    0.2127    0.7293    0.6332
    0.7071    0.3963    0.4864


out(:,:,6) =

    0.3202    0.1259    0.3360
    0.1004    0.9260    0.6287
    0.6922    0.3191    0.9011

如您所见,代码肯定会正确创建中间切片。您会看到每个偶数位置都是原始MRI图像之一,而奇数位置是插值结果。第一个切片并不意味着什么,因为我们试图从已知体积外推断。您可能希望在此点之后专注于第三个切片及其奇数位置,直到新卷结束。

As you can see, the code certainly does create intermediate slices correctly. You see that every even position is one of the original MRI images, while the odd positions are the interpolated results. The first slice doesn't mean anything as we are trying to extrapolate from outside the known volume. You probably want to concentrate on the third slice and its odd positions after this point up until the end of the new volume.

这篇关于使用MATLAB在3D MRI体积中创建中间切片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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