The page details some functions available in ROOT that may be of use for editing / manipulating images from the Compton imaging code.

Re-binning / compressing the image

For cases where the statistics are limited the default imaging resolution of 1mm may be too fine and result in ambiguous identification of a source's position.
In this case it is possible to re-bin the image, into a smaller number of bin producing a coarser image with a higher number of statistics.

The image below shows a Compton image generated from ~ 700 cones with large (> 90 degrees) scattering angles.
The 700 cones are plotted over 800 x 800 bins in the x and y axes.
The location of the source cannot be clearly identified from this plot.


Right-clicking on the image displays the Option menu. From this, select the DrawPanel option and then select the Binning tab on the form that is generated.



By default the number of bin is set to 800 (relating to a 1 mm resolution imaging space).
This number can be reduced to change the resolution of the imaging space, thus compressing the image.
For example, changing the number of bin to 80 is equivalent to compressing the imaging space by a factor of 10, thus each pixel is 10 mm in both the x and y direction.
It is possible to change the x and y resolution independently but this is not recommended.

The image below shows the same image as above but with the number of channels reduced to 80 in the x and y axes.
The source location is now clearly identifiable as 300, 300 in the x and y directions.


The Smooth function can then be used from the Option panel (right click on the image) if desired to remove some of the artifacts from the image.
Use the default options in the Smooth dialogue box and select Ok. A smoothed example of the image above is shown below.
 

 
Producing 1d slices from a 2d image.

In some cases, the 1d plots produced by the imaging code may not be sufficient. For example if the 2d image has been compressed as described above, it will be necessary to reproduce the x and y slices to include the compression. This can be done in the following way.

Right click on the 2d image and select SetShowProjectionX or SetShowProjectionY, depending on whether you wish to slice through the x or y axis, from the Option menu.


In the dialogue box that appears enter the number of channels that is required in the slice.  For a slice, a value of 1 should be used.

Entering the required value and pressing the Ok button will result in a new empty canvas being produced. Moving the mouse over the original 2d image will cause the new canvas to be filled with the number of counts in the x or y slice the mouse is currently over. A horizontal or vertical band (depending on whether the x or y slice is being produced)  is highlighted in the 2d plot showing the data that is being used to produce the 1d slice. The image below shows a slice through the y-axis projected onto the x axis at channel y = 30 (note that the image has been compressed by a factor of 10) . As the mouse is moved in the y direction over the 2d image, the 1d slice will change in real time.


Creating a 1d projection


The process of creating a 1d projection is very similar to that of producing a 1d slice detailed above. The only difference is in the number of bins entered into the SetShowProjectionX(Y) dialogue box. entering a value of greater than 1 will result in the number of counts in a the sum of this number of bins being displayed. A band channels is displayed in the 2d plot showing which channels are included in the projection. The channels selected will change as the mouse is moved and the projection will be updated in real time. The image below shows a projection of 40 bins projected onto the y axis.


Fitting 1d plots

ROOT has a built in function to allow easy fitting of simple distributions. This is not strictly applicable to the Compton camera data as has a complex multi-component distribution. The ROOT function can be used as a simple way to generate a very rough estimate of an images resolution. This method should not however be relied up to give useful reliable information.

Open the ROOT file that you wish to fit from the ROOT Browser and then select Tools -> Fit Panel to open the fit panel.
If trying to fit a distribution produced from a slice / projection method described above, the spectra must first be saved as a .root file and then re-opened.



Ensure that the name of the dataset in the top of the Fit Panel matches the name of shown in the statistics panel of the plot to be fitted, in the figure above this is "xy profile_px".
A selection of pre-defined fit functions are available in the Fit Function section of the Fit Panel. Select "gaus" for a Gaussian fit.  Keep the rest of the parameters as the default values. The fit range can be specified using the slider at the bottom of the Fit Panel. Asjust this range so that the peak that is to be fitted is selected and as little of the background as possible is included. As the range is adjusted in the Fit Panel, a box will be drawn in the spectrum window showing the range that is to be fitted. This is shown in the image below. A range of 275 - 325 has been selected in the Fit Panel and a box is drawn around this region in the spectrum window.


To fit the selected region of the distribution, click the Fit button. The fit is then shown as a thick black line over the spectrum. The parameter of the fit, such as the chi-squared and the mean will be displayed in the statistics panel in the spectrum window. Below shows a fit the to above spectrum. On the left the region 275 to 325 is fitted and a reasonable result is obtained. On the right of the figure the fit is over the range 200 - 400. This range is far to large and incorporates regions where the distribution is not Gaussian and so the fit is not very good. It make take a bit of trial and error to find a region over which the fit is reasonable. The value chi-squared / ndf in the statistics window is a measure of how good the fit is. This is essentially the difference between the fit and the data so should be as small as possible. for the figure on the left this value is ~ 1.95, compared to the value from the fit on the right which equates to 13.78.

.


The value of sigma displayed in the statistics panel is related to the FWHM by FWHM = sigma * 2.355. and so from the fit, a FWHM of 14.92 * 2.355 = ~35 mm can be estimated. This compares to a value from the full multi-component fit of 34 mm