如何在Matlab中制作没有圆柱体功能的圆柱体

时间:2018-11-06 19:10:16

标签: matlab

    nx = 400; 
    ny = 400;
    nz = 109;
    voxelsize_x = 2.036;
    voxelsize_y = 2.036;
    voxelsize_z = 2.027;
    FOV_diameter = 400;
    FOV_z = 109;

    [columnsInImage, rowsInImage, zInImage] = meshgrid(1:nx, 1:ny, 1:nz);
    sim_diameter_SC = 100/voxelsize_x; 
    sim_radius_SC = sim_diameter_SC/2;
    sim_diameter_LC = 200/voxelsize_x; 
    sim_radius_LC = sim_diameter_LC/2;
    sim_centerX = nx/2;
    sim_centerY = ny/2;
    sim_centerZ = nz/2;

    activity_LC = 10000;
    circlePixels_LC = (rowsInImage - sim_centerY).^2 ...
+ (columnsInImage - sim_centerX).^2 + (zInImage - sim_centerZ).^2 <= sim_radius_LC.^2;
    circlePixels_LC = circlePixels_LC.*activity_LC;

    activity_SC = 7000;
    circlePixels_SC = (rowsInImage - sim_centerY).^2 ...
+ (columnsInImage - sim_centerX).^2 + (zInImage - sim_centerZ).^2 <= sim_radius_SC.^2;
    circlePixels_SC = circlePixels_SC.*activity_SC;

    con_circle_emission = circlePixels_LC(:,:,:) - circlePixels_SC(:,:,:);

    figure;
    imagesc(con_circle_emission(:,:,50));

    filename='emission_400x400x109_frame003.raw';
    fid=fopen(filename,'w','l');
    count1=fwrite(fid,con_circle_emission,'float');
    fclose(fid);

我有这段代码,可以说,结果是2个同心圆,它们具有不同的“值”。就像您在横断面,冠状断面和矢状断面中看到的那样,它是一个圆(基本上是球形),但是就像我想看到“圆柱体部分”一样。我正在尝试使它成为圆柱,但我不知道该怎么做。我已经看到了圆柱体的表面积,但不确定如何将其合并。

有人可以帮助我吗? :(

谢谢!

0 个答案:

没有答案