SlideShare una empresa de Scribd logo
1 de 23
Descargar para leer sin conexión
Phase Unwrapping and Affine
Transformations using CUDA

    Perhaad Mistry, Sherman Braganza,
            David Kaeli, Miriam Leeser
                           ECE Department
                     Northeastern University
                                Boston, MA
Keck 3D Fusion Microscope
Motivation




                      Unwrapped Phase Image
Wrapped Phase Image
                                              3
Motivation
Phase Unwrapping used for research in In-Vitro
Fertilization (IVF) in Optical Quadrature Microscopy
Cell counts obtained after unwrapping determine viability
of embryos
Results required at close to real time to see changes in
sample
Improve cost-effectiveness of OQM and quality of
research




                                                        4
Outline
Optical Quadrature Microscopy
Affine Transformations
Minimum LP Norm Phase Unwrapping
MEX Interface Usage
Performance                                 Affine
                                                         Phase
                              OQM Frame
                                            Transforms
                                                         Unwrapping
                               Grabber
Future Work
Conclusion
                                     OQM Imaging System Layout




                                                                 5
OQM Imaging
                                                      Pattern determined by phase
                 Camera 0
                                           PBS
                                                      difference between laser beams
            Camera 1

                                           Camera 3
Mirror                                                Phase calculated using
                                                      magnitudes captured from four
                                                      cameras
            NPBS                      Camera 2


                                                      Mixed (M), signal only(S),
REF                                  SIG
                                                      reference(R) and dark (D) images
                                                      Phase difference measured by
                                Sample
                                                      angle(E) ranges from –π to π
                                                           1 n=3 n M n − S n − Rn
                                                       E = ∑i *
                                                           4 n=0          Rn
From                        Mirror
Laser
                                                      angle(E) yields phase that is
                                                      required for unwrapping
Optical Quadrature Microscopy Layout
                                                                                      6
Affine Transformation
Align images to fix sample’s
position in different images                                                Phase
                                                        Affine
                                  Microscope’s
                                                                            Unwrapping
                                                        Transforms
                                     Frame
2x2 and 2x1 matrices                Grabber

obtained from microscope
Image pixels divided among           Algorithm for Affine Transform [1]
blocks of threads                    (x,y) = f(BlockId, ThreadID)
Each thread calculates one           Load Data = Image[x][y]
pixel                                Includes - Rotation (θ), Scaling (s), Shearing (sh)
                                     ⎛ x' ⎞ ⎛ s(x)*cos(θ) sh(y)*sin(θ) ⎞ ⎛ x ⎞ ⎛ a ⎞
Implemented using CUDA               ⎜ ⎟=⎜                              ⎟⎜ ⎟+⎜ ⎟
                                       y' ⎠ ⎝ -sh(x)*sin(θ) s(y)*cos(θ) ⎠ ⎝ y ⎠ ⎝ b ⎠
                                     ⎝
since result needed for Phase        Store Image[x'][y'] = Data
Unwrapping                           (Uncoalesced W rites)

                                [1] A. K. Jain, Fundamentals of digital
                                image processing, Prentice Hall

                                                                                        7
Noise Removal & Phase Information
Separate “noise” only image available (Dark Image)
Dark voltage image subtracted from the mixed, signal
and reference images
Subtraction of signal image (Sn) and reference image
(Rn) due to fixed pattern levels of individual cameras
     Mn = Mn − Dn and so on for Sn and Rn
        1 n=3 n Mn − Sn − Rn
     E = ∑i *                    n: camera number
        4 n =0       Rn
     phase = angle(E )
Square root of Rn to balance intensities for detection
                                                         8
Example Images for Affine Transform




 Mixed Image      Signal only Image
                                      After Affine
                                      Transform and
                                      Noise Removal




                                                      9
                    Dark Image
Reference Image
Phase Unwrapping
Frame                       Phase
             Affine
Grabber                     Unwrapping
             Transforms

Optical phase difference from
interferometric image is shown
Parameter of interest is Optical
path difference which can be more
than π
Unwrapping along a line:
    Sum till a gradient of π then, add
    2π
In 2D if noise is present
    Path dependencies while
    summing
                                         Wrapped Image
    Causes accumulation errors           (note range of values)   10
MATLAB’s Unwrap v/s Minimum LP Norm




                                               Unwrap Using Minimum Lp
 Unwrap Using MATLAB’s
 unwrap() function                             Norm Algorithm [1]
                                                                                       11
                         [1] Dennis C. Ghiglia, Mark D. Pritt: Two-Dimensional Phase
                         Unwrapping: Theory, Algorithms, and Software
P
    Minimum             L     Norm Algorithm
Minimize difference                = (φi +1, j − φi , j )Ui , j + (φi +1, j − φi , j )Vi , j
                          ci , j
between gradients of                −(φi , j − φi −1, j )Ui −1, j − (φi , j − φi , j −1 )Vi , j
wrapped and unwrapped
                                   = ∆ ix, j U (i , j ) − ∆ ix−1, j U (i − 1, j ) +
                          ci , j
data [1]
                                    ∆ iy, jV (i , j ) − ∆ iy−1, jV (i − 1 j )
                                                                         ,
Nonlinear PDE since U and
                                   where
V are data dependant
                                   φx ,y is the unwrapped phase at (x,y)
weights
                                    ∆ x ,y and ∆ y ,y denote the wrapped phase in the
PDE solved iteratively                x          x

                                    x and y direction respectively
using the Preconditioned
Conjugate Gradient Method                      Can be expressed as Qφ = c


                             [1] Dennis C. Ghiglia, Mark D. Pritt. Two-
                             Dimensional Phase Unwrapping: Theory,                                12
                             Algorithms, and Software, Wiley New York
Preconditioned Conjugate Gradient
Solve un-weighted least ε 2 = M −2 N−2 (φ − φ − ∆x )2
                               ∑ ∑ i +1, j i , j i , j
square phase unwrapping        i =0   j =0

problem                       M − 2 N −2
                             + ∑ ∑ (φi +1, j − φi , j − ∆iy, j )2
Minimize ε2                    i =0   j =0

                             where φi , j is the wrapped phase at (i,j) and
Preconditioning using a
DCT needed                   ∆ix, j is the unwrapped phase at (i,j)
                            After discretizing the equation
Conjugate gradient
                            and taking the 2D Fourier Transform
method called after DCT
                                                       Ρ m,n
preconditioning             Φ=
                                          2cos(π m ) + 2cos(π n ) − 4
                                    m,n

                                                 M             N
                                   where Φ and Ρ are the Fourier Transformed
                                   versions of φ and ∆ respectively
                                                                        13
Better DCT Implementation
Implementing N point DCT using DFT uses 2N point DFT
Another method seen in [1]
   Rearrange x(n) into v(n) such that
                                         ⎡ N − 1⎤
   v ( n ) = x (2 n )            0≤n≤⎢          ⎥
                                         ⎣2⎦
                                ⎡ N + 1⎤
          = x (2 N − 2 n − 1)   ⎢ 2 ⎥ ≤ n ≤ N −1
                                ⎣      ⎦

                     W4kN * Real(v(n)))
   DCT(x(n)) = 2*DFT(
For 2D DCT: 4x less work since N*N instead of 2N*2N
PCG is ~ 90% of LP Norm Execution time
Shuffle kernel before CUFFT call
                                           [1] Makhoul J. A fast cosine transform
                                           in one and two dimensions.               14
Minimum                  L      Norm Algorithm
                              P

for k ← 0 to LP Norm Count
   Calculate Data Derived Weights                           Preconditioning
   for j ← 0 to PCG Iteration Count                         before CG
          DCT To DFT Steps (Shuffle Kernel)
          Execute CUFFT Call
          Point-Wise Complex Multiplication to Get DCT Result
                                                                 PCG
          Scaling Step                                           Algorithm
          Execute CUFFT Call to do iDCT
          Conjugate Gradient (Point Wise Matrix Operations)
   end for
   if Convergence exit
end for

                                                                          15
Example Images – Phase Unwrapping




Wrapped Phase Data                   Unwrapped Phase Data
                Images of Glass Bead and water
                                                            16
Example Images – Mouse Embryo




  Wrapped Phase Data   Unwrapped Phase Data
                                              17
MATLAB External Interface (MEX)
MEX produces linked         Frame Grabber
objects from C code             Image
                            Acquisition Tool
                                 Box
MATLAB present in our
system due to the frame
                                                               MATLAB Legacy
grabbers                   MATLAB Legacy
                                                                 Interfaces
                             Interface

Gateway function in C
                                                    Yes
makes MATLAB data
(mxArray) visible to our   Affine Transform                       Phase
                           Wrapper(C) Using                     Unwrapping
                                                Save
linked C code                    MEX                            Wrapper (C)
                                               Affine ?
                                                                Using MEX
                                                          No



                           Affine Transform                       Phase
                           & Noise Removal                      Unwrapping
                                 GPU                            GPU code
                             Code(CUDA)                          (CUDA)

                                                                              18
                              OQM Processing Control Flow
Performance (Phase Unwrapping)
                       Baseline                  GPU      MEX and GPU   Mex & GPU
                                   GPU Time
                        Time                    Speedup    Time(sec)     Speedup

   Preconditioning      11.17            1.2     9.3X         1.2         9.3X

   Conjugate Grad.       2.89            0.55    5.25X        0.55        5.25X

     IO Activity         0.7             0.7      1X          0.02         NA

    Miscellaneous        0.79            0.51    1.53X        0.41        1.92X

                                                                         7.20X
  Total for Unwrap      15.55            2.97    5.24X        2.16
Baseline : Serial implementation using
FFTW for the Fourier Transform


                                                                                  19
Performance Results
Future Work
Study implementation of Conjugate Gradient
Study scatter operations in CUDA
   Present literature shows improvements only for larger data
   sizes (may be better on G200)
Multi-Gpu version for imaging scenarios where images
may be grabbed at faster rates
   Presently only one image at a time acquired.
Phase Unwrapping also required for applications like
Synthetic Aperture Radar (SAR)


                                                                21
Conclusions
Implemented the computationally intensive Minimum Lp
Norm Phase Unwrapping and Affine Transforms on the
GPU
Not a batch-oriented process
   Latency was critical, single image used at a time
Reducing latency throughout the system improves quality
of research and time to discovery in Optical Science
Laboratory




                                                       22
Thank You

  Questions?

Perhaad Mistry
(pmistry@ece.neu.edu)

Más contenido relacionado

La actualidad más candente

Impulse noise removal in digital images
Impulse noise removal in digital imagesImpulse noise removal in digital images
Impulse noise removal in digital imagesMohan Raj
 
SAL3D presentation - AQSENSE's 3D machine vision library
SAL3D presentation - AQSENSE's 3D machine vision librarySAL3D presentation - AQSENSE's 3D machine vision library
SAL3D presentation - AQSENSE's 3D machine vision libraryAQSENSE S.L.
 
Edge detection using evolutionary algorithms new
Edge detection using evolutionary algorithms newEdge detection using evolutionary algorithms new
Edge detection using evolutionary algorithms newPriyanka Sharma
 
1989 optical measurement of the refractive index, layer thickness, and volume...
1989 optical measurement of the refractive index, layer thickness, and volume...1989 optical measurement of the refractive index, layer thickness, and volume...
1989 optical measurement of the refractive index, layer thickness, and volume...pmloscholte
 
Modern features-part-2-descriptors
Modern features-part-2-descriptorsModern features-part-2-descriptors
Modern features-part-2-descriptorszukun
 
Ph.D. Thesis Presentation: A Study of Priors and Algorithms for Signal Recove...
Ph.D. Thesis Presentation: A Study of Priors and Algorithms for Signal Recove...Ph.D. Thesis Presentation: A Study of Priors and Algorithms for Signal Recove...
Ph.D. Thesis Presentation: A Study of Priors and Algorithms for Signal Recove...Shunsuke Ono
 
Fast Structure From Motion in Planar Image Sequences
Fast Structure From Motion in Planar Image SequencesFast Structure From Motion in Planar Image Sequences
Fast Structure From Motion in Planar Image SequencesLuigi Bagnato
 
Random Valued Impulse Noise Removal in Colour Images using Adaptive Threshold...
Random Valued Impulse Noise Removal in Colour Images using Adaptive Threshold...Random Valued Impulse Noise Removal in Colour Images using Adaptive Threshold...
Random Valued Impulse Noise Removal in Colour Images using Adaptive Threshold...IDES Editor
 
Applications for high speed Raman Microscopy
Applications for high speed Raman  MicroscopyApplications for high speed Raman  Microscopy
Applications for high speed Raman Microscopynweavers
 
Exploring Methods to Improve Edge Detection with Canny Algorithm
Exploring Methods to Improve Edge Detection with Canny AlgorithmExploring Methods to Improve Edge Detection with Canny Algorithm
Exploring Methods to Improve Edge Detection with Canny AlgorithmPrasad Thakur
 
Modern features-part-1-detectors
Modern features-part-1-detectorsModern features-part-1-detectors
Modern features-part-1-detectorszukun
 
study Image and video abstraction by multi scale anisotropic kuwahara
study  Image and video abstraction by multi scale anisotropic kuwaharastudy  Image and video abstraction by multi scale anisotropic kuwahara
study Image and video abstraction by multi scale anisotropic kuwaharaChiamin Hsu
 
Land Cover Feature Extraction using Hybrid Swarm Intelligence Techniques - A ...
Land Cover Feature Extraction using Hybrid Swarm Intelligence Techniques - A ...Land Cover Feature Extraction using Hybrid Swarm Intelligence Techniques - A ...
Land Cover Feature Extraction using Hybrid Swarm Intelligence Techniques - A ...IDES Editor
 
Robust wavelet denoising
Robust wavelet denoisingRobust wavelet denoising
Robust wavelet denoisinggulanglhs
 

La actualidad más candente (20)

Impulse noise removal in digital images
Impulse noise removal in digital imagesImpulse noise removal in digital images
Impulse noise removal in digital images
 
De24686692
De24686692De24686692
De24686692
 
671 679
671 679671 679
671 679
 
SAL3D presentation - AQSENSE's 3D machine vision library
SAL3D presentation - AQSENSE's 3D machine vision librarySAL3D presentation - AQSENSE's 3D machine vision library
SAL3D presentation - AQSENSE's 3D machine vision library
 
Edge detection using evolutionary algorithms new
Edge detection using evolutionary algorithms newEdge detection using evolutionary algorithms new
Edge detection using evolutionary algorithms new
 
1989 optical measurement of the refractive index, layer thickness, and volume...
1989 optical measurement of the refractive index, layer thickness, and volume...1989 optical measurement of the refractive index, layer thickness, and volume...
1989 optical measurement of the refractive index, layer thickness, and volume...
 
Modern features-part-2-descriptors
Modern features-part-2-descriptorsModern features-part-2-descriptors
Modern features-part-2-descriptors
 
Ph.D. Thesis Presentation: A Study of Priors and Algorithms for Signal Recove...
Ph.D. Thesis Presentation: A Study of Priors and Algorithms for Signal Recove...Ph.D. Thesis Presentation: A Study of Priors and Algorithms for Signal Recove...
Ph.D. Thesis Presentation: A Study of Priors and Algorithms for Signal Recove...
 
Fast Structure From Motion in Planar Image Sequences
Fast Structure From Motion in Planar Image SequencesFast Structure From Motion in Planar Image Sequences
Fast Structure From Motion in Planar Image Sequences
 
Random Valued Impulse Noise Removal in Colour Images using Adaptive Threshold...
Random Valued Impulse Noise Removal in Colour Images using Adaptive Threshold...Random Valued Impulse Noise Removal in Colour Images using Adaptive Threshold...
Random Valued Impulse Noise Removal in Colour Images using Adaptive Threshold...
 
Undergraduate Thesis
Undergraduate ThesisUndergraduate Thesis
Undergraduate Thesis
 
Applications for high speed Raman Microscopy
Applications for high speed Raman  MicroscopyApplications for high speed Raman  Microscopy
Applications for high speed Raman Microscopy
 
Exploring Methods to Improve Edge Detection with Canny Algorithm
Exploring Methods to Improve Edge Detection with Canny AlgorithmExploring Methods to Improve Edge Detection with Canny Algorithm
Exploring Methods to Improve Edge Detection with Canny Algorithm
 
Modern features-part-1-detectors
Modern features-part-1-detectorsModern features-part-1-detectors
Modern features-part-1-detectors
 
Lm342080283
Lm342080283Lm342080283
Lm342080283
 
study Image and video abstraction by multi scale anisotropic kuwahara
study  Image and video abstraction by multi scale anisotropic kuwaharastudy  Image and video abstraction by multi scale anisotropic kuwahara
study Image and video abstraction by multi scale anisotropic kuwahara
 
Land Cover Feature Extraction using Hybrid Swarm Intelligence Techniques - A ...
Land Cover Feature Extraction using Hybrid Swarm Intelligence Techniques - A ...Land Cover Feature Extraction using Hybrid Swarm Intelligence Techniques - A ...
Land Cover Feature Extraction using Hybrid Swarm Intelligence Techniques - A ...
 
Cp31608611
Cp31608611Cp31608611
Cp31608611
 
Structlight
StructlightStructlight
Structlight
 
Robust wavelet denoising
Robust wavelet denoisingRobust wavelet denoising
Robust wavelet denoising
 

Similar a Accelarating Optical Quadrature Microscopy Using GPUs

Image Splicing Detection involving Moment-based Feature Extraction and Classi...
Image Splicing Detection involving Moment-based Feature Extraction and Classi...Image Splicing Detection involving Moment-based Feature Extraction and Classi...
Image Splicing Detection involving Moment-based Feature Extraction and Classi...IDES Editor
 
Fingerprint High Level Classification
Fingerprint High Level ClassificationFingerprint High Level Classification
Fingerprint High Level ClassificationReza Rahimi
 
>A Switchable Light Field Camera Architecture with Angle SEnsitive Pixels and...
>A Switchable Light Field Camera Architecture with Angle SEnsitive Pixels and...>A Switchable Light Field Camera Architecture with Angle SEnsitive Pixels and...
>A Switchable Light Field Camera Architecture with Angle SEnsitive Pixels and...Matt Hirsch - MIT Media Lab
 
SIGGRAPH 2014 Course on Computational Cameras and Displays (part 4)
SIGGRAPH 2014 Course on Computational Cameras and Displays (part 4)SIGGRAPH 2014 Course on Computational Cameras and Displays (part 4)
SIGGRAPH 2014 Course on Computational Cameras and Displays (part 4)Matthew O'Toole
 
2015-06-17 FEKO Based ISAR Analysis for 3D Object Reconstruction
2015-06-17 FEKO Based ISAR Analysis for 3D Object Reconstruction2015-06-17 FEKO Based ISAR Analysis for 3D Object Reconstruction
2015-06-17 FEKO Based ISAR Analysis for 3D Object ReconstructionDr. Ali Nassib
 
Sensor modeling and Photometry: an application to Astrophotography
Sensor modeling and Photometry: an application to AstrophotographySensor modeling and Photometry: an application to Astrophotography
Sensor modeling and Photometry: an application to AstrophotographyLaurent Devineau
 
[DL輪読会]Neural Radiance Flow for 4D View Synthesis and Video Processing (NeRF...
[DL輪読会]Neural Radiance Flow for 4D View Synthesis and Video  Processing (NeRF...[DL輪読会]Neural Radiance Flow for 4D View Synthesis and Video  Processing (NeRF...
[DL輪読会]Neural Radiance Flow for 4D View Synthesis and Video Processing (NeRF...Deep Learning JP
 
Neural Radiance Fields & Neural Rendering.pdf
Neural Radiance Fields & Neural Rendering.pdfNeural Radiance Fields & Neural Rendering.pdf
Neural Radiance Fields & Neural Rendering.pdfNavneetPaul2
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image ProcessingAzharo7
 
Meroli Grazing Angle Techinique Pixel2010
Meroli Grazing Angle Techinique Pixel2010Meroli Grazing Angle Techinique Pixel2010
Meroli Grazing Angle Techinique Pixel2010stefanome
 
Recovering high dynamic range radiance maps from photographs
Recovering high dynamic range radiance maps from photographsRecovering high dynamic range radiance maps from photographs
Recovering high dynamic range radiance maps from photographsPrashanth Kannan
 
CS 354 Acceleration Structures
CS 354 Acceleration StructuresCS 354 Acceleration Structures
CS 354 Acceleration StructuresMark Kilgard
 
Digital Image Processing Fundamental
Digital Image Processing FundamentalDigital Image Processing Fundamental
Digital Image Processing FundamentalThuong Nguyen Canh
 
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...ijceronline
 
image segmentation by ppres.pptx
image segmentation by ppres.pptximage segmentation by ppres.pptx
image segmentation by ppres.pptxmohan134666
 
The International Journal of Engineering and Science (The IJES)
The International Journal of Engineering and Science (The IJES)The International Journal of Engineering and Science (The IJES)
The International Journal of Engineering and Science (The IJES)theijes
 
WAVELET DECOMPOSITION AND ALPHA STABLE FUSION
WAVELET DECOMPOSITION AND ALPHA STABLE FUSIONWAVELET DECOMPOSITION AND ALPHA STABLE FUSION
WAVELET DECOMPOSITION AND ALPHA STABLE FUSIONsipij
 
Image pre processing
Image pre processingImage pre processing
Image pre processingAshish Kumar
 

Similar a Accelarating Optical Quadrature Microscopy Using GPUs (20)

Image Splicing Detection involving Moment-based Feature Extraction and Classi...
Image Splicing Detection involving Moment-based Feature Extraction and Classi...Image Splicing Detection involving Moment-based Feature Extraction and Classi...
Image Splicing Detection involving Moment-based Feature Extraction and Classi...
 
Fingerprint High Level Classification
Fingerprint High Level ClassificationFingerprint High Level Classification
Fingerprint High Level Classification
 
>A Switchable Light Field Camera Architecture with Angle SEnsitive Pixels and...
>A Switchable Light Field Camera Architecture with Angle SEnsitive Pixels and...>A Switchable Light Field Camera Architecture with Angle SEnsitive Pixels and...
>A Switchable Light Field Camera Architecture with Angle SEnsitive Pixels and...
 
SIGGRAPH 2014 Course on Computational Cameras and Displays (part 4)
SIGGRAPH 2014 Course on Computational Cameras and Displays (part 4)SIGGRAPH 2014 Course on Computational Cameras and Displays (part 4)
SIGGRAPH 2014 Course on Computational Cameras and Displays (part 4)
 
2015-06-17 FEKO Based ISAR Analysis for 3D Object Reconstruction
2015-06-17 FEKO Based ISAR Analysis for 3D Object Reconstruction2015-06-17 FEKO Based ISAR Analysis for 3D Object Reconstruction
2015-06-17 FEKO Based ISAR Analysis for 3D Object Reconstruction
 
Sensor modeling and Photometry: an application to Astrophotography
Sensor modeling and Photometry: an application to AstrophotographySensor modeling and Photometry: an application to Astrophotography
Sensor modeling and Photometry: an application to Astrophotography
 
[DL輪読会]Neural Radiance Flow for 4D View Synthesis and Video Processing (NeRF...
[DL輪読会]Neural Radiance Flow for 4D View Synthesis and Video  Processing (NeRF...[DL輪読会]Neural Radiance Flow for 4D View Synthesis and Video  Processing (NeRF...
[DL輪読会]Neural Radiance Flow for 4D View Synthesis and Video Processing (NeRF...
 
Neural Radiance Fields & Neural Rendering.pdf
Neural Radiance Fields & Neural Rendering.pdfNeural Radiance Fields & Neural Rendering.pdf
Neural Radiance Fields & Neural Rendering.pdf
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 
Meroli Grazing Angle Techinique Pixel2010
Meroli Grazing Angle Techinique Pixel2010Meroli Grazing Angle Techinique Pixel2010
Meroli Grazing Angle Techinique Pixel2010
 
Dual photography
Dual photographyDual photography
Dual photography
 
Recovering high dynamic range radiance maps from photographs
Recovering high dynamic range radiance maps from photographsRecovering high dynamic range radiance maps from photographs
Recovering high dynamic range radiance maps from photographs
 
CS 354 Acceleration Structures
CS 354 Acceleration StructuresCS 354 Acceleration Structures
CS 354 Acceleration Structures
 
Digital Image Processing Fundamental
Digital Image Processing FundamentalDigital Image Processing Fundamental
Digital Image Processing Fundamental
 
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
 
image segmentation by ppres.pptx
image segmentation by ppres.pptximage segmentation by ppres.pptx
image segmentation by ppres.pptx
 
The International Journal of Engineering and Science (The IJES)
The International Journal of Engineering and Science (The IJES)The International Journal of Engineering and Science (The IJES)
The International Journal of Engineering and Science (The IJES)
 
TransNeRF
TransNeRFTransNeRF
TransNeRF
 
WAVELET DECOMPOSITION AND ALPHA STABLE FUSION
WAVELET DECOMPOSITION AND ALPHA STABLE FUSIONWAVELET DECOMPOSITION AND ALPHA STABLE FUSION
WAVELET DECOMPOSITION AND ALPHA STABLE FUSION
 
Image pre processing
Image pre processingImage pre processing
Image pre processing
 

Accelarating Optical Quadrature Microscopy Using GPUs

  • 1. Phase Unwrapping and Affine Transformations using CUDA Perhaad Mistry, Sherman Braganza, David Kaeli, Miriam Leeser ECE Department Northeastern University Boston, MA
  • 2. Keck 3D Fusion Microscope
  • 3. Motivation Unwrapped Phase Image Wrapped Phase Image 3
  • 4. Motivation Phase Unwrapping used for research in In-Vitro Fertilization (IVF) in Optical Quadrature Microscopy Cell counts obtained after unwrapping determine viability of embryos Results required at close to real time to see changes in sample Improve cost-effectiveness of OQM and quality of research 4
  • 5. Outline Optical Quadrature Microscopy Affine Transformations Minimum LP Norm Phase Unwrapping MEX Interface Usage Performance Affine Phase OQM Frame Transforms Unwrapping Grabber Future Work Conclusion OQM Imaging System Layout 5
  • 6. OQM Imaging Pattern determined by phase Camera 0 PBS difference between laser beams Camera 1 Camera 3 Mirror Phase calculated using magnitudes captured from four cameras NPBS Camera 2 Mixed (M), signal only(S), REF SIG reference(R) and dark (D) images Phase difference measured by Sample angle(E) ranges from –π to π 1 n=3 n M n − S n − Rn E = ∑i * 4 n=0 Rn From Mirror Laser angle(E) yields phase that is required for unwrapping Optical Quadrature Microscopy Layout 6
  • 7. Affine Transformation Align images to fix sample’s position in different images Phase Affine Microscope’s Unwrapping Transforms Frame 2x2 and 2x1 matrices Grabber obtained from microscope Image pixels divided among Algorithm for Affine Transform [1] blocks of threads (x,y) = f(BlockId, ThreadID) Each thread calculates one Load Data = Image[x][y] pixel Includes - Rotation (θ), Scaling (s), Shearing (sh) ⎛ x' ⎞ ⎛ s(x)*cos(θ) sh(y)*sin(θ) ⎞ ⎛ x ⎞ ⎛ a ⎞ Implemented using CUDA ⎜ ⎟=⎜ ⎟⎜ ⎟+⎜ ⎟ y' ⎠ ⎝ -sh(x)*sin(θ) s(y)*cos(θ) ⎠ ⎝ y ⎠ ⎝ b ⎠ ⎝ since result needed for Phase Store Image[x'][y'] = Data Unwrapping (Uncoalesced W rites) [1] A. K. Jain, Fundamentals of digital image processing, Prentice Hall 7
  • 8. Noise Removal & Phase Information Separate “noise” only image available (Dark Image) Dark voltage image subtracted from the mixed, signal and reference images Subtraction of signal image (Sn) and reference image (Rn) due to fixed pattern levels of individual cameras Mn = Mn − Dn and so on for Sn and Rn 1 n=3 n Mn − Sn − Rn E = ∑i * n: camera number 4 n =0 Rn phase = angle(E ) Square root of Rn to balance intensities for detection 8
  • 9. Example Images for Affine Transform Mixed Image Signal only Image After Affine Transform and Noise Removal 9 Dark Image Reference Image
  • 10. Phase Unwrapping Frame Phase Affine Grabber Unwrapping Transforms Optical phase difference from interferometric image is shown Parameter of interest is Optical path difference which can be more than π Unwrapping along a line: Sum till a gradient of π then, add 2π In 2D if noise is present Path dependencies while summing Wrapped Image Causes accumulation errors (note range of values) 10
  • 11. MATLAB’s Unwrap v/s Minimum LP Norm Unwrap Using Minimum Lp Unwrap Using MATLAB’s unwrap() function Norm Algorithm [1] 11 [1] Dennis C. Ghiglia, Mark D. Pritt: Two-Dimensional Phase Unwrapping: Theory, Algorithms, and Software
  • 12. P Minimum L Norm Algorithm Minimize difference = (φi +1, j − φi , j )Ui , j + (φi +1, j − φi , j )Vi , j ci , j between gradients of −(φi , j − φi −1, j )Ui −1, j − (φi , j − φi , j −1 )Vi , j wrapped and unwrapped = ∆ ix, j U (i , j ) − ∆ ix−1, j U (i − 1, j ) + ci , j data [1] ∆ iy, jV (i , j ) − ∆ iy−1, jV (i − 1 j ) , Nonlinear PDE since U and where V are data dependant φx ,y is the unwrapped phase at (x,y) weights ∆ x ,y and ∆ y ,y denote the wrapped phase in the PDE solved iteratively x x x and y direction respectively using the Preconditioned Conjugate Gradient Method Can be expressed as Qφ = c [1] Dennis C. Ghiglia, Mark D. Pritt. Two- Dimensional Phase Unwrapping: Theory, 12 Algorithms, and Software, Wiley New York
  • 13. Preconditioned Conjugate Gradient Solve un-weighted least ε 2 = M −2 N−2 (φ − φ − ∆x )2 ∑ ∑ i +1, j i , j i , j square phase unwrapping i =0 j =0 problem M − 2 N −2 + ∑ ∑ (φi +1, j − φi , j − ∆iy, j )2 Minimize ε2 i =0 j =0 where φi , j is the wrapped phase at (i,j) and Preconditioning using a DCT needed ∆ix, j is the unwrapped phase at (i,j) After discretizing the equation Conjugate gradient and taking the 2D Fourier Transform method called after DCT Ρ m,n preconditioning Φ= 2cos(π m ) + 2cos(π n ) − 4 m,n M N where Φ and Ρ are the Fourier Transformed versions of φ and ∆ respectively 13
  • 14. Better DCT Implementation Implementing N point DCT using DFT uses 2N point DFT Another method seen in [1] Rearrange x(n) into v(n) such that ⎡ N − 1⎤ v ( n ) = x (2 n ) 0≤n≤⎢ ⎥ ⎣2⎦ ⎡ N + 1⎤ = x (2 N − 2 n − 1) ⎢ 2 ⎥ ≤ n ≤ N −1 ⎣ ⎦ W4kN * Real(v(n))) DCT(x(n)) = 2*DFT( For 2D DCT: 4x less work since N*N instead of 2N*2N PCG is ~ 90% of LP Norm Execution time Shuffle kernel before CUFFT call [1] Makhoul J. A fast cosine transform in one and two dimensions. 14
  • 15. Minimum L Norm Algorithm P for k ← 0 to LP Norm Count Calculate Data Derived Weights Preconditioning for j ← 0 to PCG Iteration Count before CG DCT To DFT Steps (Shuffle Kernel) Execute CUFFT Call Point-Wise Complex Multiplication to Get DCT Result PCG Scaling Step Algorithm Execute CUFFT Call to do iDCT Conjugate Gradient (Point Wise Matrix Operations) end for if Convergence exit end for 15
  • 16. Example Images – Phase Unwrapping Wrapped Phase Data Unwrapped Phase Data Images of Glass Bead and water 16
  • 17. Example Images – Mouse Embryo Wrapped Phase Data Unwrapped Phase Data 17
  • 18. MATLAB External Interface (MEX) MEX produces linked Frame Grabber objects from C code Image Acquisition Tool Box MATLAB present in our system due to the frame MATLAB Legacy grabbers MATLAB Legacy Interfaces Interface Gateway function in C Yes makes MATLAB data (mxArray) visible to our Affine Transform Phase Wrapper(C) Using Unwrapping Save linked C code MEX Wrapper (C) Affine ? Using MEX No Affine Transform Phase & Noise Removal Unwrapping GPU GPU code Code(CUDA) (CUDA) 18 OQM Processing Control Flow
  • 19. Performance (Phase Unwrapping) Baseline GPU MEX and GPU Mex & GPU GPU Time Time Speedup Time(sec) Speedup Preconditioning 11.17 1.2 9.3X 1.2 9.3X Conjugate Grad. 2.89 0.55 5.25X 0.55 5.25X IO Activity 0.7 0.7 1X 0.02 NA Miscellaneous 0.79 0.51 1.53X 0.41 1.92X 7.20X Total for Unwrap 15.55 2.97 5.24X 2.16 Baseline : Serial implementation using FFTW for the Fourier Transform 19
  • 21. Future Work Study implementation of Conjugate Gradient Study scatter operations in CUDA Present literature shows improvements only for larger data sizes (may be better on G200) Multi-Gpu version for imaging scenarios where images may be grabbed at faster rates Presently only one image at a time acquired. Phase Unwrapping also required for applications like Synthetic Aperture Radar (SAR) 21
  • 22. Conclusions Implemented the computationally intensive Minimum Lp Norm Phase Unwrapping and Affine Transforms on the GPU Not a batch-oriented process Latency was critical, single image used at a time Reducing latency throughout the system improves quality of research and time to discovery in Optical Science Laboratory 22
  • 23. Thank You Questions? Perhaad Mistry (pmistry@ece.neu.edu)