⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gethorizontaldistributiontransforms.m

📁 matlab aamtool box
💻 M
字号:
function transforms = getHorizontalDistributionTransforms(volumes, spacing)
% function transforms] = getHorizontalDistributionTransforms(volumes)
% 
% Description:
% Function to obtain transforms that distribute volumes horizontally with a
% given spacing. The number of transforms obtained equals the number of
% volumes passed
% 
% Author: Johann Strasser
% Date: 070326

xDims = [];
totalWidth = 0;
% transforms = getHTTransform();

for i = 1:length(volumes)
    l = size(volumes(i).volume, 2);
    totalWidth = totalWidth + l * volumes(i).voxelSize(1);
    
    if i ~= length(volumes)
        totalWidth = totalWidth + spacing;
    end
    
    xDims = [xDims l];
    transforms(i) = getHTTransform();
    transforms(i).name = volumes(i).parentTransform;
end


offset = -totalWidth / 2;

for j = 1:length(transforms)
    offset = offset + xDims(j) * volumes(j).voxelSize(1) / 2;
    
    if j ~= 1
        offset = offset + spacing;
        offset = offset + xDims(j - 1) * volumes(j).voxelSize(1) / 2;
    end
    
    transforms(j).translation(1) = offset;
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -