Difference: MedipixMATLABScripts (1 vs. 2)

Revision 22008-07-30 - DavidPennicard

Line: 1 to 1
 
META TOPICPARENT name="MedipixUSBReadout"

MATLAB scripts for Medipix2 analysis

Line: 6 to 6
  Spectrum from Medipix 3D
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 flat-field 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 full-width half maximum. Ideally, the image of the edge should have been flat-field corrected.

ClusterAnalysis.m - If you use a short acquisition time or a lower-intensity 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.

Mixed source image:

Mixed source image

 -- DavidPennicard - 30 Jul 2008

META FILEATTACHMENT attachment="3D1_15keV_keVspectrum_stderror.jpg" attr="" comment="Example spectrum from 3D Medipix" date="1217431031" name="3D1_15keV_keVspectrum_stderror.jpg" path="3D1_15keV_keVspectrum_stderror.jpg" size="33741" stream="3D1_15keV_keVspectrum_stderror.jpg" tmpFilename="/usr/tmp/CGItemp29034" user="DavidPennicard" version="1"
Added:
>
>
META FILEATTACHMENT attachment="ThresholdDistributions.m" attr="" comment="Threshold distribution script" date="1217438977" name="ThresholdDistributions.m" path="ThresholdDistributions.m" size="4309" stream="ThresholdDistributions.m" tmpFilename="/usr/tmp/CGItemp28978" user="DavidPennicard" version="1"
META FILEATTACHMENT attachment="THLScanSpectrumImages.m" attr="" comment="Spectrum-finding script" date="1217439014" name="THLScanSpectrumImages.m" path="THLScanSpectrumImages.m" size="14226" stream="THLScanSpectrumImages.m" tmpFilename="/usr/tmp/CGItemp31628" user="DavidPennicard" version="1"
META FILEATTACHMENT attachment="MeanImage.m" attr="" comment="Mean image script" date="1217439028" name="MeanImage.m" path="MeanImage.m" size="1245" stream="MeanImage.m" tmpFilename="/usr/tmp/CGItemp31727" user="DavidPennicard" version="1"
META FILEATTACHMENT attachment="FlatFieldCoefficients.m" attr="" comment="Flat field script" date="1217439041" name="FlatFieldCoefficients.m" path="FlatFieldCoefficients.m" size="1904" stream="FlatFieldCoefficients.m" tmpFilename="/usr/tmp/CGItemp31680" user="DavidPennicard" version="1"
META FILEATTACHMENT attachment="NoiseAnalysis.m" attr="" comment="Noise analysis script" date="1217439053" name="NoiseAnalysis.m" path="NoiseAnalysis.m" size="4825" stream="NoiseAnalysis.m" tmpFilename="/usr/tmp/CGItemp31658" user="DavidPennicard" version="1"
META FILEATTACHMENT attachment="FindMTFFromEdge_testbeam.m" attr="" comment="Modulation Transfer Function script" date="1217439070" name="FindMTFFromEdge_testbeam.m" path="FindMTFFromEdge_testbeam.m" size="15939" stream="FindMTFFromEdge_testbeam.m" tmpFilename="/usr/tmp/CGItemp31782" user="DavidPennicard" version="1"
META FILEATTACHMENT attachment="ClusterAnalysis.m" attr="" comment="Cluster analysis script" date="1217439082" name="ClusterAnalysis.m" path="ClusterAnalysis.m" size="2865" stream="ClusterAnalysis.m" tmpFilename="/usr/tmp/CGItemp31677" user="DavidPennicard" version="1"
META FILEATTACHMENT attachment="MixedSourceImage.jpg" attr="" comment="Image with mixed source showing clusters" date="1217440419" name="MixedSourceImage.jpg" path="MixedSourceImage.jpg" size="39367" stream="MixedSourceImage.jpg" tmpFilename="/usr/tmp/CGItemp31761" user="DavidPennicard" version="1"
META FILEATTACHMENT attachment="Image_aby.txt" attr="" comment="Alpha, beta, gamma ASCII file" date="1217440437" name="Image_aby.txt" path="Image_aby.txt" size="131328" stream="Image_aby.txt" tmpFilename="/usr/tmp/CGItemp31848" user="DavidPennicard" version="1"
META FILEATTACHMENT attachment="Image_by.txt" attr="" comment="Beta, gamma ASCII file" date="1217440460" name="Image_by.txt" path="Image_by.txt" size="131328" stream="Image_by.txt" tmpFilename="/usr/tmp/CGItemp31788" user="DavidPennicard" version="1"

Revision 12008-07-30 - DavidPennicard

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="MedipixUSBReadout"

MATLAB scripts for Medipix2 analysis

The 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.

Spectrum from Medipix 3D

-- DavidPennicard - 30 Jul 2008

META FILEATTACHMENT attachment="3D1_15keV_keVspectrum_stderror.jpg" attr="" comment="Example spectrum from 3D Medipix" date="1217431031" name="3D1_15keV_keVspectrum_stderror.jpg" path="3D1_15keV_keVspectrum_stderror.jpg" size="33741" stream="3D1_15keV_keVspectrum_stderror.jpg" tmpFilename="/usr/tmp/CGItemp29034" user="DavidPennicard" version="1"
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback