Class AlgorithmMaximumLikelihoodIteratedBlindDeconvolution

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.WindowListener, java.lang.Runnable, java.util.EventListener

    public class AlgorithmMaximumLikelihoodIteratedBlindDeconvolution
    extends AlgorithmBase
    An implementation of Maximum Likelihood Iterated Blind Deconvolution based on the following papers:

    Holmes, T.J., Maximum Likelihood Image Restoration Adapted for Noncoherent Optical Imaging, JOSA-A, 5(5): 666-673, 1988.

    Holmes, T., Bhattacharyya, S., Cooper, J., Hanzel, D., Krishnamurthi, V., Lin, W., Roysam, B., Szarowski, D., Turner, J., Light Microscopic Images Reconstructed by Maximum Likelihood Deconvolution, Ch. 24, Handbook of Biological Confocal Microscopy, J. Pawley, Plenum, 1995.

    Holmes, T., Liu, Y., Image Restoration for 2D and 3D Fluorescence Microscopy, Visualization in Biomedical Microscopies, A. Kriete, VCH, 1992.

    Holmes, T., Blind Deconvolution of Quantum-Limited Noncoherent Imagery, JOSA-A, 9: 1052 - 1061, 1992.

    • Field Detail

      • m_afResolutions

        private float[] m_afResolutions
        DOCUMENT ME!
      • m_aiUnits

        private int[] m_aiUnits
        DOCUMENT ME!
      • m_bConstraintsInit

        private boolean m_bConstraintsInit
        DOCUMENT ME!
      • m_bUpdatePBar

        private boolean m_bUpdatePBar
        Flag indicating whether or not to update the progres bar:.
      • m_bUseMicroscopeConstraints

        private boolean m_bUseMicroscopeConstraints
        Boolean to use constraints:.
      • m_fAxialBandLimit

        private float m_fAxialBandLimit
        DOCUMENT ME!
      • m_fObjectiveNumericalAperature

        private float m_fObjectiveNumericalAperature
        numerical aperature of the imaging lens:.
      • m_fRadialBandLimit

        private float m_fRadialBandLimit
        3). Bandlimit and missing cone constraint:
      • m_fRadius

        private float m_fRadius
        DOCUMENT ME!
      • m_fRefractiveIndex

        private float m_fRefractiveIndex
        sample index of refraction:.
      • m_fTanTheta

        private float m_fTanTheta
        DOCUMENT ME!
      • m_fWavelength

        private float m_fWavelength
        wavelength of the reflected or fluorescing light:.
      • m_iArrayLength

        private int m_iArrayLength
        Original data size:.
      • m_iDimX

        private int m_iDimX
        Constraint parameters:.
      • m_iDimY

        private int m_iDimY
        DOCUMENT ME!
      • m_iDimZ

        private int m_iDimZ
        DOCUMENT ME!
      • m_iNumberIterations

        private int m_iNumberIterations
        Number of iterations for the deconvolution:.
      • m_iNumberProgress

        private int m_iNumberProgress
        Show the deconvolved image in progress every m_iNumberProgress steps:.
      • m_fNewRes

        private float[] m_fNewRes
        The new resolutions in each dimension if resample is true. Used only if resample is true.
      • m_kCalcResult1

        private ModelImage m_kCalcResult1
        DOCUMENT ME!
      • m_kCalcResult2

        private ModelImage m_kCalcResult2
        DOCUMENT ME!
      • m_kCalcResult3

        private ModelImage m_kCalcResult3
        DOCUMENT ME!
      • m_kEstimatedImage

        private ModelImage m_kEstimatedImage
        estimated of the reconstructed image:.
      • m_kImageSpectrum1

        private ModelImage m_kImageSpectrum1
        Images to store FFT and Calc results.
      • m_kImageSpectrum2

        private ModelImage m_kImageSpectrum2
        DOCUMENT ME!
      • m_kImageSpectrum3

        private ModelImage m_kImageSpectrum3
        DOCUMENT ME!
      • m_kMirrorImage

        private ModelImage m_kMirrorImage
        DOCUMENT ME!
      • m_kOriginalSourceImage

        private ModelImage m_kOriginalSourceImage
        source image to be reconstructed!
      • m_kPSFImage

        private ModelImage m_kPSFImage
        point spread function image:.
      • m_kPSFImageCopy

        private ModelImage m_kPSFImageCopy
        Used for color image.
      • m_kSourceBlue

        private ModelImage m_kSourceBlue
        DOCUMENT ME!
      • m_kSourceGreen

        private ModelImage m_kSourceGreen
        DOCUMENT ME!
      • m_kSourceImage

        private ModelImage m_kSourceImage
        source image to be reconstructed!
      • m_kSourceRed

        private ModelImage m_kSourceRed
        For color images: the source is converted to gray for the deconvolution. Once the estimate and psf are found, each component is reconstructed.
    • Constructor Detail

      • AlgorithmMaximumLikelihoodIteratedBlindDeconvolution

        public AlgorithmMaximumLikelihoodIteratedBlindDeconvolution​(ModelImage kSrcImg,
                                                                    int iIterations,
                                                                    int iProgress,
                                                                    float fObjectiveNumericalAperature,
                                                                    float fWavelength,
                                                                    float fRefractiveIndex,
                                                                    boolean bUseConstraints,
                                                                    int[] newExtents,
                                                                    boolean doResample)
        Creates a new AlgorithmMaximumLikelihoodIteratedBlindDeconvolution object.
        Parameters:
        kSrcImg - the input image to be reconstructed
        iIterations - the number of times to iterate in the deconvolution
        iProgress - Display deconvolved image every iProgress images
        fObjectiveNumericalAperature - the numerical aperature of the imaging lense
        fWavelength - the reflected or fluorescing light
        fRefractiveIndex - the index of refraction for the sample
        bUseConstraints - When true, the lens NA, wavelength, and refractive index are used in the deconvolution process
    • Method Detail

      • disposeLocal

        public void disposeLocal()
        Dispose of local variables that may be taking up lots of room.
      • finalize

        public void finalize()
        Prepares this class for destruction.
        Overrides:
        finalize in class AlgorithmBase
      • getPSFImage

        public ModelImage getPSFImage()
        Returns the point spread function image.
        Returns:
        m_kPSFImage
      • getReconstructedImage

        public ModelImage getReconstructedImage()
        Returns the reconstructed image:
        Returns:
        m_kEstimatedImage
      • calc

        private ModelImage calc​(ModelImage kReturn,
                                ModelImage kImage1,
                                ModelImage kImage2,
                                int iType)
        Performs a AlgorithmImageCalculator calculation on the two input images. Used here to either multiply or divide two images.
        Parameters:
        kReturn - DOCUMENT ME!
        kImage1 - the first input image
        kImage2 - the second input image
        iType - the type of calculation (multiply or divide)
        Returns:
        kReturn, the result of the image calculation
      • cleanUp

        private void cleanUp()
        Dispose of temporary images after the deconvolution process is completed:
      • constraints

        private ModelImage constraints​(ModelImage kImagePSF)
        Applies constraints to the input image kImage and writes the constrained values into the m_kPSFImage. Constraints are the following: 2). Hourglass constraint 3). Bandlimit and missing cone constraint 4). Nonnegativity constraint 1). Unit summation constraint
        Parameters:
        kImagePSF - the unconstrained PSFImage
        Returns:
        DOCUMENT ME!
      • convertFromGray

        private ModelImage convertFromGray​(ModelImage kRed,
                                           ModelImage kGreen,
                                           ModelImage kBlue)
        Called after the deconvolution algorithm is run. The deconvolution processes the grayscale image. Once the estimated and psf images are calculated, they are used to reconstruct the red, green, and blue channels separately, which are then recombined into a color image.
        Parameters:
        kRed - the reconstructed red image
        kGreen - the reconstructed green image
        kBlue - the reconstructed blue image
        Returns:
        the RGB image
      • convertToGray

        private ModelImage convertToGray​(ModelImage kImage)
        Convert the input image, kImage, to a grayscale image using the AlgorithmRGBtoGray. The deconvolution is done on the grayscale image, however after deconvolution, the original color values are reconstructed from the psf and grayscale estimate.
        Parameters:
        kImage - the color image to conver to grayscale:
        Returns:
        the converted grayscale image
      • convolve

        private ModelImage convolve​(ModelImage kImage1,
                                    ModelImage kImage2,
                                    float fNoise)
        Convolves two image by computing the fast fourier transforms of each image, multiplying the ffts and then computing the inverse fft of the result:
        Parameters:
        kImage1 - the first input image
        kImage2 - the second input image
        fNoise - amount of Noise to add when the result of the convolution is going to be the denominator in the next equation to avoid divide by zero errors.
        Returns:
        kResult, the result of convolving the two images
      • fft

        private ModelImage fft​(ModelImage kImageFFT,
                               ModelImage kImage,
                               int iDir)
        Computes the fft of the input image, returns the fft. Calls AlgorithmFFT.
        Parameters:
        kImageFFT - DOCUMENT ME!
        kImage - the input image
        iDir - forward fft when iDir = 1, inverse fft when iDir = -1
        Returns:
        kResult, the fft of kImage
      • initConstraints

        private void initConstraints()
        Initializes the constraint variables for the PSF deconvolution, based on the microscope parameters (numerical aperature, wavelength, and refractive index). The pixel resolutions are also converted to nanometers -- the units for wavelength.
      • initPSF

        private void initPSF​(int iNumberDimensions,
                             int[] aiExtents)
        Initialize the first PSF guess as a 3x3 Gaussian.
        Parameters:
        iNumberDimensions - iNumberDimensions, the dimensions of the data
        aiExtents - aiExtents, the ranges in each dimension
      • mirror

        private ModelImage mirror​(ModelImage kImage)
        Does a mirror operation on an image, so that x, y, and z values are mirrored Calls JDialogFlip.
        Parameters:
        kImage - the input image
        Returns:
        DOCUMENT ME!
      • runDeconvolution

        private ModelImage runDeconvolution​(ModelImage kSource,
                                            ModelImage kEstimate,
                                            ModelImage kPSF,
                                            boolean bCopy)
        Runs the deconvolution algorithm.
        Parameters:
        kSource - the original image data
        kEstimate - the initial estimated guess at the reconstructed image
        kPSF - the initial point spread function guess
        bCopy - when true the new estimates after interating are copied back into the data members.
        Returns:
        , the resulting estimated image