function [ rasta_stack ] = LM_RastaStack( fits, px_size_in, px_size_out, pad, flatten, z_thickness )
% This file is part of LM.
%
% LM is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Foobar is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with LM. If not, see .
z_min=min(fits(:,9));
z_max=max(fits(:,9));
nz=ceil(abs((z_max-z_min)/z_thickness));
[~, cen_x, cen_y]=LM_Rasta(fits, px_size_in, px_size_out, pad, flatten);
for i=1:nz
slice_start=z_min+((i-1)*z_thickness)
slice_stop=z_min+(i*z_thickness)
fits_slice=fits((fits(:,9)>slice_start & fits(:,9)