SetDirectory["C:/drorbn/classes/LinAlg2/CT"];  
    pict = Import["S1.gif"];

pixels = N[pict[[1, 1]]/255];

{H, W} = Dimensions[pixels]

M = Round[Sqrt[H^2 + W^2]]

Clear[Ray];  
    Ray[i1_, i2_]  :=  Ray[i1, i2]  =  
        Module[
{
r = {}, dir1,  dir2,  
            p1, p2, k, 
m = {H/2 - 1/2, 
                W/2 - 1/2}, 
θ = 
              N[π*i1/
                    M]
}, 
dir1 = {Cos[θ],  
              Sin[θ]}; 
dir2 = {Cos[θ  +  π/2],  Sin[θ  +  π/2]}; 
For[
            k = -M/2,  k ≤ M/2,  
            k += 1/2, 
{p1, p2} = 
              Round[m + (i2 - M/2)*dir1 + k*dir2]; 
If[
              0 ≤ p1 < H  &&  0 ≤ p2 < W,  
              AppendTo[
                r,  {p1 + 1, 
                  p2 + 1}]]
]; 
Union[
            r]
]

Ray[50, 22]

CTScan = 
      Table[
Plus  @@  Extract[pixels,  Ray[i1, i2]] + 
          0*Random[Real, {-1, 1}], 
{i1, 1, M}, {i2, 0, 
          M}
];  Dimensions[CTScan]

Show[Graphics[Raster[CTScan/Max[CTScan]]],  
      AspectRatio -> Automatic]

Save["CTScan.m",  CTScan]