Code examples

Import experimental images

Import experimental images
Code to import an experimental interferogram, process it, and display the QLSI images
%% code to import an experimental interferogram, process it, and display the QLSI images

MI  = Microscope(OB,180,'Silios_mono');% Create the Microscope object
IL  = Illumination(532e-9);            % Create the Illumination object
Itf = imread('data/Itf.tiff');         % Import the main interferogram
Ref = imread('data/Ref.tiff');         % Import the reference interferogram
Im  = Interfero(Itf,MI);               % Make the interferogram object
Im0 = Interfero(Ref,MI);               % Make the reference interferogram object
Im.Reference(Im0);                     % Assign the reference to the interferogram
IM  = QLSIprocess(Im,IL);              % Process the QLSI images
IM.figure;                             % Display the images in a GUI (image below)
_images/cellEx.png

Auto import experimental images

Automatically import experimental images
Code to automatically import experimental interferograms
%% code to import an experimental interferogra

MI = Microscope(OB,180,'Silios_mono','PhaseLIVE'); % Create the Microscope object
                                                   % and tell the imaging software
IL = Illumination(532e-9);          % Create the Illumination object
Itf = imread('data/Itf.tif');       % Import the main interferogram
Ref = imread('data/Ref.tif');       % Import the reference interferogram
Im = importItfRef('data', MI);      % Import the interferogram and their references

This code knows how to import the images, and where to find the reference images, because the imaging software was indicated (here 'PhaseLIVE', our personal Matlab toobox for live imaging, not included in PhaseLAB).

Image simulation

Image simulation
Code that simulates the image of a gold nanoparticle
%% code that simulates the image of a gold nanoparticle

lambda = 530e-9;                    % Illumination wavelength
Npx = 300;                          % Final image with Npx*Npx pixels
n = 1.33;                           % Refractive index of the surrounding medium

ME = Medium(n);
OB = Objective(200,1.3,'Olympus');
CGcam = CGcamera('Silios_mono');
MI = Microscope(OB,180,CGcam);
IL = Illumination(lambda,ME);

radius = 50e-9;                     % Nanoparticle radius
DI = Dipole('Au',radius);
DI = DI.shine(IL);

IM0 = imaging(DI,IL,MI,Npx);

IM0.figure
_images/NPinSilico_Ex2.png

Image postprocessing

Image postprocessing
Examples of QLSI images postprocessing
%% code that performs successive image processings

% crop of the image
IM0.crop('Size', 300, 'Center', 'Manual')

% flattening of the background
IM0.flatten(3)

% numerical refocusing by 0.5 µm
IM0.propagation(0.5e-6)

% flip the image upside down
IM0.flipud()

% high-pass filter
IM0.highPassFilter(20)

%image diplay
dynamicFigure('ph',IM0,'bw',{IM0.T})

Make a movie

Making a movie
Animating the image of nanoparticles as a function of the focus.
%% code that animates the image of a ring of nanoparticles
clear
lambda = 530e-9;                    % Illumination wavelength
Npx = 1200;                          % Final image with Npx*Npx pixels
n = 1.33;                           % Refractive index of the surrounding medium

ME = Medium(n);
OB = Objective(100,1.3,'Olympus');
CGcam = CGcamera('Silios_mono');
MI = Microscope(OB,180,CGcam);
IL = Illumination(lambda,ME,1,[1 1i]); % circularly polarized illumination

radius = 50e-9;           % Nanoparticle radius
DI0 = Dipole('Au',radius);

DI = repmat(DI0,12,1);

R=3e-6;                   % radius of the ring

for ii=1:12
    DI(ii)=DI(ii).moveTo('x',R*cos(2*pi*ii/12),'y',R*sin(2*pi*ii/12));
end

DI = DI.shine(IL);

Nf = 21;                  % number of nanoparticles over the ring
focus = linspace(-2,2,Nf)*1e-6;  % various focus distances

IM = ImageEM(Nf);
for iz = 1:Nf             % positioning of the Nf nanoparticles
    MI.zo = focus(iz);
    IM(iz) = imaging(DI,IL,MI,Npx);
end

IM.crop(Size=300);

IM.makeMoviedx('IM.avi','theta',0,'phi',0,'rate',2,'zrange',[-10 10])

In Silico simulation

In Silico simulation
Code that simulates the image of a gold nanoparticle including shot noise
%% code that simulates the image of a gold nanoparticle including shot noise

lambda = 530e-9;            % Illumination wavelength
Npx = 120;                  % Final image with Npx*Npx pixels

% model the setup
ME = Medium('water', 'glass');
OB = Objective(100,1.0,'Olympus');
CGcam = CGcamera('sC8-944');
MI = Microscope(OB,'Olympus',CGcam);
IL = Illumination(lambda,ME);

% model the nanoparticle
radius = 60e-9;             % Nanoparticle radius
DI = Dipole('Au',radius);   % creation of the Dipole object
DI = DI.shine(IL);          % illumination of the dipole

% compute the images
IM0 = imaging(DI,IL,MI,Npx);

% model the experimental interferogram
Itf = CGMinSilico(IM0,'shotNoise',true);

% processing the in Silico images
IM = QLSIprocess(Itf,IL);

% display the theoretical and in Silico images
dynamicFigure('gb',IM0,'gb',IM)
_images/NPinSilico.png

Numerical refocusing

Numerical refocusing
Code to numerically modify the focus of the image
%% Code that imports one experimental image (of long Geobacillus bacteria)
%% and creates a series of images at different focuses from this single image

ME = Medium('water','glass');
OB = Objective(100,0.7,'Olympus');
MI = Microscope(OB,200,'sC8-944','PhaseLIVE');
lambda = 531e-9;
IL = Illumination(lambda,ME);

%% IMPORT THE IMAGES
folder = 'GeobLongFilaments';
Im = importItfRef(folder,MI);

%% INTERFEROGRAM PROCESSING
IM = Im.QLSIprocess(IL);

%% list of defocus values in µm
zList = -20:10;
No = length(zList);

IMlist = ImageQLSI(No);

for io = 1:No
    IMlist(io) = copy(IM(1));
    IMlist(io) = IMlist(io).propagation(zList(io)*1e-6);
    IMlist(io).comment = [num2str(zList(io)) ' µm'];
end

% select the area supposed to correspond to a zero wavfront value
IMlist.level0(Center="Manual", Size="Manual");

% crop the image
IMlist.crop(Size=2000);

% build a movie from the series of images:
IMlist.makeMoviedx('/Users/perseus/Documents/im.avi', ...
    persp=0,theta=0, phi=0, ...
    zrange = [-80, 100])

Color imaging

Color imaging
Code to process QLSI data acquired with a color-camera
%% MICROSCOPE
ME = Medium('water','glass');
OB = Objective(60,0.7,'Olympus');
Cam = Camera('Silios');
Gr = CrossGrating('Gamma',39e-6);
CGcam = CGcamera(Cam,Gr,1.1931);
MI = Microscope(OB,200,CGcam,'PhaseLIVE');

CGcam.setDistance(0.8e-3);

lambda = 680e-9;
IL = Illumination(lambda,ME);

folder = 'GeobColor';

%% Import interferos

Itf = importItfRef(folder,MI,"nickname","geobSyto9");
Bkg = importItfRef(folder,MI,"nickname","geobSyto9Bkg");
Ref = importItfRef(folder,MI,"nickname","geobSyto9Ref");

Itf.Reference(Ref.mean())

%% Process interferos

Itf.removeOffset(Bkg.mean());

Itf.crop(Size=1200)

%% color images processing

Itfs = Itf.splitColors();
Itfsc = crosstalkCorrection(Itfs);

%% process fluo and OPD images
IMG = QLSIprocess(Itfsc(:,1),IL,"Tnormalisation",'subtraction');
IMR = QLSIprocess(Itfsc(:,2),IL);

dynamicFigure('fl',{IMG.T}, 'ph', {IMR.OPD})

%% merge green and red channels to be displayed with the figure method

IM = [IMG, IMR];

IM.figure
_images/fluoCGM.png

Left: fluorescence image of bacteria. Right: corresponding OPD image.

Temperature processing

Temperature processing
Code to convert a wavefront distorsion image into a temperature map
%% BUILDING OF THE MEDIUM -- ME = Medium(n,nS);
ME = Medium('water','glass');

%% BUILDING OF THE MICROSCOPE -- Microscope(OBJ,tl_f,Sid4model,software)
OB = Objective(60,1.3,'Olympus');
MI = Microscope(OB,180,'sC8-944','PhaseLIVE');
MI.refl = false;

%% BUILDING OF THE ILLUMINATION -- IL = Illumination(lambda);
lambda = 550e-9;
IL = Illumination(lambda,ME);

%% IMPORT THE DATA
folder = pwd;
Im = importItfRef(folder,MI);

%% INTERFEROGRAM PROCESSING -- Im.QLSIprocess(IL);
IM = Im.QLSIprocess(IL,'definition','low');

%% CREATION OF THE MICROSCOPE
clear Med
Med(1) = MediumT('BK7',  1e-3,'progressive');
Med(2) = MediumT('water',1e-3,'progressive');
%Med(3) = MediumT('water',0.01e-3,'progressive');

Med = mesher(Med,MI);

%% linear algorithm, for temperature increases < 30°C
[IMT, GreenW, GreenT] = IMs.TMPprocess(Med);

%% non linear algorithm
[IMT, GreenW, GreenT] = IMs.TMPprocess(Med,'g',0.4,'nLoop',10,'imExpander',true,'TO',22);

%% DISPLAY THE RESULTS
IMT.figureT