0

我正在使用 3D 原始图像(PET 图像(浮动)的大小为 [84*71*103],间距大小为 4.07*4.07*3 mm)。

我想要:

  • 使用对应于肿瘤中心的体素坐标[116,177,86](由我定义),并创建一个与肿瘤中心同心的球体。
  • 将球体的直径更改为比肿瘤本身大一点。

所以球体将用作覆盖图像的蒙版,我可以获得该球体形状内图像值的统计信息。

我希望我已经说得够清楚了。我将衷心感谢您的帮助。我的代码无法正常工作,我不知道如何继续。

fid_1 = fopen('I:\PatientData\patient3\case1\DIR_CT1toCT2\New-     
crop\PET1FEM_PET2_DIFF.img','r','l');
pet1fem_pet2_diff = fread(fid_1,'float32');
pet1fem_pet2_diff = reshape(pet1fem_pet2_diff, [84 71 103]);
% interpolation is nearest neighbour, and 'crop' Makes output the same size as the input image
pet1fem_pet2_diff = imrotate(pet1fem_pet2_diff,90,'nearest','crop');

% create the image 
imageSizeX = 84;
imageSizeY = 71;
imageSizeZ = 103;
% columns are in the x direction and, rows are in the y direction
[columnsInImage rowsInImage pagesInImage] = meshgrid(1:imageSizeX, 1:imageSizeY,1:imageSizeZ);

% Next create the sphere in the image.
centerX = 29;
centerY = 26;
centerZ = 74;
radius = 5;

nonSphereVoxels = (rowsInImage - centerY).^2 ...
    + (columnsInImage - centerX).^2 + (pagesInImage - centerZ).^2 > radius.^2;
    pet1fem_pet2_diff(nonSphereVoxels) = 0;

figure(1);
imagesc(pet1fem_pet2_diff(:,:,30)); 
title('PET1FEM-PET2-DIFF');
4

1 回答 1

0

我已经解决了您问题的简化 2D 版本,希望这有助于回答您的问题。首先,让我们创建一个输入

A = rand(128,128); % this is your pet1_diff data
% you can plot it like this:
clf reset
imagesc(A)
daspect([1 1 1])

接下来,我们应用截止:

[x,y] = meshgrid(1:128,1:128);
r2 = ((x-40).^2 + (y-40).^2) > 10^2; % radius 10 cutoff from position (40,40)
A(r2) = 0; % delete pixels outside the cutoff radius

% plot the filtered data
clf reset
imagesc(A)
daspect([1 1 1])

这是你想要的结果吗?

于 2016-08-26T15:47:11.887 回答