Line: 1 to 1  

MATLAB scripts for Medipix2 analysisThe Medipix2 USB interface produces output files that are just ASCII arrays containing the no. of photons detected by each pixel. These can be loaded into MATLAB and analysed.  
Changed:  
< <  
> >  
THLScanSpectrumImages.m  Script takes a series of images taken during one or more THL scans, and uses them to find the spectrum measured by the detector. Additional code in the script can find the peak from a monoenergetic source. If we know the calibration of the detector, we can plot the spectrum vs energy (rather than versus THL values) and calculate total no of hits and fraction of charge shared events.  
Line: 26 to 26  
Mixed source image:  
Changed:  
< <  
> >  
 DavidPennicard  30 Jul 2008 
Line: 1 to 1  

MATLAB scripts for Medipix2 analysis  
Line: 10 to 10  
NoiseAnalysis.m  This script takes a series of images taken during a THL scan without any beam or source present (in a similar fashion to the script above). It records the THL value where each pixel sees 1, 10, 100… noise counts. Then, it plots a graph showing the no. of pixels with 1, 10, 100… noise counts at each THL value. This can be useful for deciding which pixels to mask when doing analysis of spectra.  
Changed:  
< <  ThresholdDistributions.m  After performing a threshold equalisation, there is a “save distributions” option which allows you to save the histograms produced during the equalisation. This script loads the histogram of threshold positions after equalisation, and does a Gaussian fit. This can, for example, allow you to find the position of the noise centroid, giving you the “zero” level of the detector after equalisation.  
> >  FullThresholdDistributions.m  After performing a threshold equalisation, there is a “save distributions” option which allows you to save the histograms produced during the equalisation. This script loads the histogram of threshold positions before and after equalisation, and does Gaussian fits. This can, for example, allow you to find the position of the noise centroid, giving you the “zero” level of the detector after equalisation.  
MeanImage.m  If you use Pixelman to take multiple acquisitions, an index will be added to the filename of each image. This is a very simple function to find the mean of the images, by looping through them.
FlatFieldCoefficients.m  After you take a series of flat field images and find their mean, this can be used to generate a matrix containing flat field coefficients. Flat field correction can then be applied in MATLAB by multiplying an image by this matrix. Note that any pixels in the flatfield image containing zero counts cannot be corrected – this function sets the corresponding FF coefficients to 1.  
Changed:  
< <  FindMTFFromEdge_testbeam.m  This script takes an image of an edge, and finds the edge spread function from it. It then differentiates this to find the line spread function, and takes the Fourier transform to get the Modulation Transfer Function. (Insert reference.) There are also a few bits of code to extract data directly from the line spread function, such as the fullwidth half maximum. Ideally, the image of the edge should have been flatfield corrected.  
> >  FindMTFFromEdge_testbeam.m  This script takes an image of an edge, and finds the edge spread function from it. It then differentiates this to find the line spread function, and takes the Fourier transform to get the Modulation Transfer Function. For more info on the MTF, see Fujita 1992 http://dx.doi.org/10.1109/42.126908 and Moy 2000 http://dx.doi.org/10.1118/1.598859 . There are also a few bits of code to extract data directly from the line spread function, such as the fullwidth half maximum. Ideally, the image of the edge should have been flatfield corrected.  
NoisePowerSpectrum.m  As discussed on the previous page, to measure the frequency response of a detector you need to consider the signaltonoise ratio, rather than the MTF alone. For example, some processes in a detector such as charge sharing will "blur" both the signal and the noise, whereas others like poor optics will blur the signal without reducing the noise. This script is used to calculate the noise power spectrum from a large number of flood images.  
Line: 34 to 34  
 
Changed:  
< < 
 
> > 
 
 
Line: 42 to 42  
 
Added:  
> > 

Line: 1 to 1  

MATLAB scripts for Medipix2 analysis  
Line: 18 to 18  
FindMTFFromEdge_testbeam.m  This script takes an image of an edge, and finds the edge spread function from it. It then differentiates this to find the line spread function, and takes the Fourier transform to get the Modulation Transfer Function. (Insert reference.) There are also a few bits of code to extract data directly from the line spread function, such as the fullwidth half maximum. Ideally, the image of the edge should have been flatfield corrected.  
Added:  
> >  NoisePowerSpectrum.m  As discussed on the previous page, to measure the frequency response of a detector you need to consider the signaltonoise ratio, rather than the MTF alone. For example, some processes in a detector such as charge sharing will "blur" both the signal and the noise, whereas others like poor optics will blur the signal without reducing the noise. This script is used to calculate the noise power spectrum from a large number of flood images.  
ClusterAnalysis.m  If you use a short acquisition time or a lowerintensity source, so that most pixels have 0 hits and very few have more than 1, it becomes possible to distinguish between hits produced by alphas (large round clusters), betas (smaller, irregular clusters due to scattering) and gammas (photoelectric absorption, hitting only 1 or 2 pixels). See the image below. This example script uses histogramming and image erosion to distinguish between the different clusters. Example ASCII image files are available for a mixed alpha, beta, gamma source, and the same source with alphas removed using a slide.  
Line: 34 to 36  
 
Changed:  
< < 
 
> > 
 
 
Added:  
> > 

Line: 1 to 1  

MATLAB scripts for Medipix2 analysis  
Line: 14 to 14  
MeanImage.m  If you use Pixelman to take multiple acquisitions, an index will be added to the filename of each image. This is a very simple function to find the mean of the images, by looping through them.  
Changed:  
< <  FlatFieldCoefficients.m  After taking a series of flat field images and finding their mean, this generates an matrix containing flat field coefficients. Flat field correction can then be applied in MATLAB by multiplying an image by this matrix. Note that any pixels in the flatfield image containing zero counts cannot be corrected – this function sets the corresponding FF coefficients to 1.  
> >  FlatFieldCoefficients.m  After you take a series of flat field images and find their mean, this can be used to generate a matrix containing flat field coefficients. Flat field correction can then be applied in MATLAB by multiplying an image by this matrix. Note that any pixels in the flatfield image containing zero counts cannot be corrected – this function sets the corresponding FF coefficients to 1.  
FindMTFFromEdge_testbeam.m  This script takes an image of an edge, and finds the edge spread function from it. It then differentiates this to find the line spread function, and takes the Fourier transform to get the Modulation Transfer Function. (Insert reference.) There are also a few bits of code to extract data directly from the line spread function, such as the fullwidth half maximum. Ideally, the image of the edge should have been flatfield corrected. 
Line: 1 to 1  

MATLAB scripts for Medipix2 analysis  
Line: 6 to 6  
Added:  
> >  THLScanSpectrumImages.m  Script takes a series of images taken during one or more THL scans, and uses them to find the spectrum measured by the detector. Additional code in the script can find the peak from a monoenergetic source. If we know the calibration of the detector, we can plot the spectrum vs energy (rather than versus THL values) and calculate total no of hits and fraction of charge shared events.
NoiseAnalysis.m  This script takes a series of images taken during a THL scan without any beam or source present (in a similar fashion to the script above). It records the THL value where each pixel sees 1, 10, 100… noise counts. Then, it plots a graph showing the no. of pixels with 1, 10, 100… noise counts at each THL value. This can be useful for deciding which pixels to mask when doing analysis of spectra. ThresholdDistributions.m  After performing a threshold equalisation, there is a “save distributions” option which allows you to save the histograms produced during the equalisation. This script loads the histogram of threshold positions after equalisation, and does a Gaussian fit. This can, for example, allow you to find the position of the noise centroid, giving you the “zero” level of the detector after equalisation. MeanImage.m  If you use Pixelman to take multiple acquisitions, an index will be added to the filename of each image. This is a very simple function to find the mean of the images, by looping through them. FlatFieldCoefficients.m  After taking a series of flat field images and finding their mean, this generates an matrix containing flat field coefficients. Flat field correction can then be applied in MATLAB by multiplying an image by this matrix. Note that any pixels in the flatfield image containing zero counts cannot be corrected – this function sets the corresponding FF coefficients to 1. FindMTFFromEdge_testbeam.m  This script takes an image of an edge, and finds the edge spread function from it. It then differentiates this to find the line spread function, and takes the Fourier transform to get the Modulation Transfer Function. (Insert reference.) There are also a few bits of code to extract data directly from the line spread function, such as the fullwidth half maximum. Ideally, the image of the edge should have been flatfield corrected. ClusterAnalysis.m  If you use a short acquisition time or a lowerintensity source, so that most pixels have 0 hits and very few have more than 1, it becomes possible to distinguish between hits produced by alphas (large round clusters), betas (smaller, irregular clusters due to scattering) and gammas (photoelectric absorption, hitting only 1 or 2 pixels). See the image below. This example script uses histogramming and image erosion to distinguish between the different clusters. Example ASCII image files are available for a mixed alpha, beta, gamma source, and the same source with alphas removed using a slide.
 
 DavidPennicard  30 Jul 2008
 
Added:  
> > 

Line: 1 to 1  

Added:  
> > 
MATLAB scripts for Medipix2 analysisThe Medipix2 USB interface produces output files that are just ASCII arrays containing the no. of photons detected by each pixel. These can be loaded into MATLAB and analysed.
 DavidPennicard  30 Jul 2008
