CERN / TIGRE

TIGRE: Tomographic Iterative GPU-based Reconstruction Toolbox
BSD 3-Clause "New" or "Revised" License
573 stars 188 forks source link

Orientation of Phantoms #287

Closed tsadakane closed 3 years ago

tsadakane commented 3 years ago

Expected Behavior

Orientation of the Head and Shepp-Logan phantoms are the same.

Actual Behavior

phantoms

The AP direction of the head phantom is Y+, and that of the SL phantom is X+.

SL phantom matrix does not seems to match the memory layout described at https://github.com/CERN/TIGRE/issues/191#issuecomment-750699972

Code to reproduce the problem (If applicable)

%% Initialize
clear;
close all;
%% Define Geometry
geo=defaultGeometry('nVoxel',[64; 128; 256]);   
%% Sample data:
shepp_type='Modified Shepp-Logan';  % (default).
shepp=sheppLogan3D(geo.nVoxel,shepp_type); % Default are 128^3 and Modified shepp-logan
head=headPhantom(geo.nVoxel); %default is 128^3
%% Plot
plotImg([head  shepp],'Dim','Z','Savegif','phantoms.gif');

Specifications

Proposal

Modify sheppLogan3D.m as below:

if nargin==0
    sz=[128,128,128];
    type='modified shepp-logan';
else
    if nargin<2
    type='modified shepp-logan';
    end
end
sz = [sz(2), sz(1), sz(3)];   % ADD
warning('This file is NOT under BSD license!')
[p,ellipse]=phantom3dAniso(sz,type);
p=permute(p, [2,1,3]);  % ADD
p=single(p);
% p=[];
end

, which results in phantoms_modified

AnderBiguri commented 3 years ago

Good catch! thanks a lot!

I guess the ideal solution would be to swap all ellipse making indexes, but that is quite more work and its a third party code. So I am happy with your proposed solution.

Would you be happy to make a Pull request with your proposed solution?