我正在使用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');
答案 0 :(得分: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])
这是你瞄准的那种结果吗?