Monday, June 3, 2013

Learning Tomography: Rotation script



In a previous post [Link], I describe artifacts due to non-centered projections in tomography. For those interested, here is the procedure to simulate such a defect in a sinogram.


First, I started by computing a larger image (Fig. 1) based on the script seamless.js [Link] to avoid border artifacts during the computation.

Fig.1: Input image used to compute the shifted sinogram.

Second, as the rotation function of ImageJ only works about the image center, the rotation center must be moved to the image center before applying the sinogram rotation and then to move again to its origin position.

Fig.2: How to rotate an image about an arbitrary rotation center? A) Shift the image from rotation center to the image center. B) Apply the rotation. C) Move to its original position.

For example, in the 256x256 Lena, her right eye is located at (136,132), I have to move the image from (136,132) to (128,128) corresponding to a XY-shift of (-8, -4), and then after applying the sinogram rotation as usual , move again of (+8,+4). This is done in the JavaScript sinogram.js by adding two translate(...) in the code as follows...

[...]
tp.translate(-8,-4);
tp.rotate(step*y);
tp.translate(8,4);
[...]

And here is the script ...
+++ IJ JavaScript snippet : sinogram_shift.js +++ +++ End of IJ JavaScript snippet +++

 << Previous: Defect of non-centered projections


No comments:

Post a Comment