title: Implementation of Radon transform in Matlab, output size
body: <p>Due to the nature of my problem, I want to evaluate the numerical implementations of the Radon transform in Matlab (i.e. different interpolation methods give different numerical values).</p>
  
  <p>while trying to code my own Radon, and compare it to Matlab's output, I found out that my radon projection sizes are different than Matlab's. </p>
  
  <p>So a bit of intuition of how I compute the amount if radon samples needed. Let's do the 2D case.</p>
  
  <hr>
  
  <p>The idea is that the maximum size would be when the diagonal (in a rectangular shape at least) part is proyected in the radon transform, so <code>diago=sqrt(size(I,1),size(I,2))</code>. As we dont wan nothing out, <code>n_r=ceil(diago)</code>. <code>n_r</code> should be the amount of discrete samples of the radon transform should be to ensure no data is left out. </p>
  
  <p>I noticed that Matlab's <code>radon</code> output is always even, which makes sense as you would want a "ray" through the rotation center always. And I noticed that there are 2 zeros in the endpoints of the array in all cases. </p>
  
  <p>So in that case, <code>n_r=ceil(diago)+mod(ceil(diago)+1,2)+2;</code></p>
  
  <p>However, it seems that I get small discrepancies with Matlab.</p>
  
  <p>A MWE:</p>
  
  <pre><code> % Try: 255,256
   pixels=256;
   I=phantom('Modified Shepp-Logan',pixels);
  
   rd=radon(I,pi/4);
   size(rd,1)
  
   s=size(I);
   diagsize=sqrt(sum(s.^2));
   n_r=ceil(diagsize)+mod(ceil(diagsize)+1,2)+2
  </code></pre>
  
  <hr>
  
  <pre><code>rd=
  
     367
  
  
  n_r =
  
     365
  </code></pre>
  
  <p>As Matlab's Radon transform is a function I can not look into, I wonder why could it be this discrepancy.</p>