.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/flim/plot_rebin.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_flim_plot_rebin.py: =============== Image rebinning =============== .. GENERATED FROM PYTHON SOURCE LINES 8-13 .. code-block:: Python from __future__ import print_function import tttrlib import numpy as np import pylab as plt .. GENERATED FROM PYTHON SOURCE LINES 14-15 Read data of the CLSM image .. GENERATED FROM PYTHON SOURCE LINES 15-47 .. code-block:: Python data = tttrlib.TTTR('../../tttr-data/imaging/pq/ht3/crn_clv_img.ht3') # Read contents of file into new CLSMImage settings = { "channels": [0, 1], "fill": True, } image = tttrlib.CLSMImage(data, **settings) img_original = image.intensity.sum(axis=0) # do a 4x4 binning (uses internally CLSMImage.transform) bin_line = 4 bin_pixel = 4 n_frames, n_lines, n_pixel = image.shape image.rebin(bin_line, bin_pixel) img_transformed = image.intensity.sum(axis=0) # Plot the results fig, axs = plt.subplots(1, 2) axs[0].imshow(img_original) axs[1].imshow(img_transformed) plt.show() # After transforming the image can be cropped image.crop(0, n_frames, 0, n_lines // bin_line, 0, n_pixel // bin_pixel) img_transformed_cropped = image.intensity.sum(axis=0) # Plot the results fig, axs = plt.subplots(1, 2) axs[0].imshow(img_original) axs[1].imshow(img_transformed_cropped) plt.show() .. rst-class:: sphx-glr-horizontal * .. image-sg:: /auto_examples/flim/images/sphx_glr_plot_rebin_001.png :alt: plot rebin :srcset: /auto_examples/flim/images/sphx_glr_plot_rebin_001.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/flim/images/sphx_glr_plot_rebin_002.png :alt: plot rebin :srcset: /auto_examples/flim/images/sphx_glr_plot_rebin_002.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.351 seconds) .. _sphx_glr_download_auto_examples_flim_plot_rebin.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_rebin.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_rebin.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_