How to manage borders in sinogram computation ?
1. Borders
When computing a sinogram, the problem of the border arises. Indeed, during the image rotation, the function Image > Transform > Rotate... fills the empty space by the current background color as shown in Fig. 1. Thus, the various projections are not calculated from the same number of pixels. Which strategy is the best?Fig.1: During the sinogram creation, the empty space generated by the rotation is filled with the current background color (here, black by default). |
1.1- Black background color
The simplest method is to set a black background color (0,0,0) as shown before using the following javascript method:IJ.setBackgroundColor(0,0,0);
1-2- Use of the average as background value.
This is a two-step procedure. First, you need to compute the image statistics and then convert the mean value into a 8-bit value (range 0.. 255).
var stats = imp.getStatistics();
var avg=stats.mean/(stats.max - stats.min) *255;
IJ.setBackgroundColor(avg,avg,avg);var avg=stats.mean/(stats.max - stats.min) *255;
Fig.2: Rotation with background color set to the average of input image. |
Note: In the JavaScript sinogram.js, I implemented this approach, by default.
1-3- Use of a circular mask
In this case, you apply a circular mask to the original data, then compute the sinogram with a black background color.To conclude, the influence of the background value for the sinogram computation is clearly visible in the example of Fig. 3.
2- Reconstruction of the corners
If you want to reconstruct the whole area of the input image specially the corners, you have to compute a larger image whose size is equal to imageWidth * √2 before calculating the sinogram. In that case, the "average" method seen previously works correctly, but there are other more sophisticated alternatives...
2-1- Creation of a seamless image
First, an image composed of 9 tiles corresponding to combinations of vertically and/or horizontally flips is created as shown in Fig.4...Fig.4: Montage to build the seamless image |
... and then, this montage is cropped to a square of dimension equal to the image diagonal ( = imgWidth * √2 ) and is used for the sinogram computation (Fig. 5A).
+++ IJ JavaScript snippet +++
+++ end of IJ JavaScript snippet +++
2-2- Circular border
W o r k i n P r o g r e s sFig.6: Circular border composed of several dilations of the original image. |
I personally think that the "average" and "circular mask" methods have the best ratio speed/efficiency because in most cases, you don't bother about the corners as far as the sample is well centered.
No comments:
Post a Comment