Paganin Filtering¶
The following documentation has been extracted automatically from the comments found in the source code. Discard Parameters. object variable.
- class
Parameters_module.
Parameters
¶The input variables are read from the input file. The input file is written with python syntax. The Input file is interpreted as python after a preprocessing The preprocessing was introduced at the time of HST-> PYHST transition to maintaing compatibility with:
NO/YES meaning 0/1
items containing FILE in their name can be initialized without using the “” which are otherwise necessary for strings
The input file has to set (some of) the following variables. To setup easily an input file you are suggested to start from one of the examples given in the doc.
DO_OUTPUT_PAGANIN
= 0¶Set this to 1 to write preprocessed projection after Paganin. Each projection will be written to an edf file whose prefix is given by OUTPUT_PAGANIN_FILE input variable. No further processing is done when this option is on. To use properly this option the best way is selecting just the middle slice for reconstruction and then setting a high PAGANIN_MARGE marge such to encompass a whole radiography plus a margin for the paganin kernel. The output is the data after Paganin, before logarithm and before interpolation for longitudinal correction.
DO_PAGANIN
= 0¶The Paganin filtering (for homogenuous objects) is activated setting to 1 this parameter.
Paganin, D., Mayo, S. C., Gureyev, T. E., Miller, P. R. and Wilkins, S. W. (2002), Simultaneous phase and amplitude extraction from a single defocused image of a homogeneous object. Journal of Microscopy, 206: 33-40. doi: 10.1046/j.1365-2818.2002.01010.x
OUTPUT_PAGANIN_FILE
= ''¶Each projection will be written to an edf file whose prefix is this
PAGANIN_Lmicron
= 0¶For an infinitely distant point source and a detector at \(R_2\) distance
\[L^2 = 4 \pi^2 R_2 \frac{\delta}{\mu} = \pi \lambda R_2 \frac{ \delta}{ \beta }\]where \(\mu\) is the linear absorption coefficient. Note that this definition of \(L^2\) differes by a factor \(4 \pi^2\) from Paganin one. Such factor is compensated by the definition of frequencies (without \(2 \pi\)). The expression \(\pi \lambda*R_2 \frac{ \delta}{ \beta }\) is what one can literally read in the octave fasttomo scripts.
The lenght L enters the factors which are applied in Fourier space
1.0/((1.0+FF*PAGANIN_Lmicron*PAGANIN_Lmicron)*N1*N2)where
FF = (f2*f2)+(f1*f1)[:,None] and f1=fft_frequencies(N1)/PIXSZ_1 f2=fft_frequencies(N2)/PIXSZ_2 PIXSZ_1 = Parameters.IMAGE_PIXEL_SIZE_2 PIXSZ_2 = Parameters.IMAGE_PIXEL_SIZE_1and fft_frequencies is the following function
def fft_frequencies(Nx): fx = numpy.zeros(Nx,"f") fx[0:(Nx)//2+1] = numpy.arange((Nx)//2+1) fx[(Nx)//2+1:Nx] = -(Nx)//2+1 + numpy.arange(Nx-(Nx)//2-1) return fx /NxMind that in the expressions above both PAGANIN_Lmicron and .IMAGE_PIXEL_SIZE_1/2 are in microns
PAGANIN_MARGE
= 10¶When applying FFT the considered data have a larger extent than the ROI because the Paganin kernel has an effective lenght. PAGANIN_MARGE, is expressed in pixels. It should be of the same order of PAGANIN_Lmicron expressed in pixels ( Mind that PAGANIN_Lmicron is in micron )
PUC
= 0¶See above description for PUS
PUS
= 0¶Unsharp is part of the paganin alghorithm. it is activsated only inconjunction with Paganin. It consists in an additional filter that is applied after the Paganin filter For unsharp you must specify a non-zero Sigma
PUS=YourSigma <<<<<<< !!!!! SIGMA is in pixel units PUC=YourCoefficient <<<<<<<<<The image will be
(1+Parameters.PUC)*originalPaganinImage -Parameters.PUC*ConvolutedImage
UNSHARP_LOG
= 0¶IN THIS CASE THE CONVOLUTION KERNEL IS THE laplacian of the gaussian ( of PUS sigma ) and not the gaussian itself the image will be
originalPaganinImage +Parameters.PUC*ConvolutedImage