How to use the tifffile.imshow function in tifffile

To help you get started, we’ve selected a few tifffile examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tlambert03 / LLSpy / llspy / libcudawrapper.py View on Github external
angle = float(sys.argv[2]) if len(sys.argv) > 2 else 32.5
            dz = float(sys.argv[3]) if len(sys.argv) > 3 else 0.4
            dx = 0.1
            xzRatio = dx / (np.deg2rad(angle) * dz)
            rotated = rotateGPU(im, angle, xzRatio)
            tf.imshow(rotated, vmin=0, vmax=rotated.max() * 0.5)
            plt.show()

        elif (sys.argv[1] == "decon") or (sys.argv[1] == "deconv"):
            im = tf.imread(
                "/Users/talley/Dropbox (HMS)/CBMF/lattice_sample_data/lls_bidirectional/bidir_ch0_stack0000_488nm_0000000msec_0007232334msecAbs.tif"
            )
            otfpath = "/Users/talley/Dropbox (HMS)/CBMF/lattice_sample_data/lls_PSFs/488_otf.tif"
            RL_init(im.shape, otfpath, dzdata=0.4)
            decon = RL_decon(im, nIters=15)
            tf.imshow(decon, vmin=0, vmax=decon.max() * 0.5)
            plt.show()
            RL_cleanup()
        elif sys.argv[1] == "camcor":

            from llspy import llsdir
            from llspy import samples
            import time

            E = llsdir.LLSdir(samples.stickypix)

            # from llspy.util import util
            # from llspy.camera.camera import CameraParameters, CameraROI

            # camparams = CameraParameters()
            # camparams = camparams.get_subroi(CameraROI(E.settings.camera.roi))
github tlambert03 / LLSpy / llspy / libcudawrapper.py View on Github external
# for i in sys.argv[2:]:
            #   p = p = os.path.abspath(i).replace('\\', '')
            #   if os.path.isfile(p):
            #       tf.imshow(deskewGPU(tf.imread(p), float(zstep)))
            #       plt.show()

        elif sys.argv[1] == "rotate":
            im = tf.imread(
                "/Users/talley/Dropbox (HMS)/CBMF/lattice_sample_data/lls_registration_samp/reg_ex1/tspeck/GPUdecon/tspeck_ch0_stack0000_488nm_0000000msec_0001881189msecAbs_decon.tif"
            )
            angle = float(sys.argv[2]) if len(sys.argv) > 2 else 32.5
            dz = float(sys.argv[3]) if len(sys.argv) > 3 else 0.4
            dx = 0.1
            xzRatio = dx / (np.deg2rad(angle) * dz)
            rotated = rotateGPU(im, angle, xzRatio)
            tf.imshow(rotated, vmin=0, vmax=rotated.max() * 0.5)
            plt.show()

        elif (sys.argv[1] == "decon") or (sys.argv[1] == "deconv"):
            im = tf.imread(
                "/Users/talley/Dropbox (HMS)/CBMF/lattice_sample_data/lls_bidirectional/bidir_ch0_stack0000_488nm_0000000msec_0007232334msecAbs.tif"
            )
            otfpath = "/Users/talley/Dropbox (HMS)/CBMF/lattice_sample_data/lls_PSFs/488_otf.tif"
            RL_init(im.shape, otfpath, dzdata=0.4)
            decon = RL_decon(im, nIters=15)
            tf.imshow(decon, vmin=0, vmax=decon.max() * 0.5)
            plt.show()
            RL_cleanup()
        elif sys.argv[1] == "camcor":

            from llspy import llsdir
            from llspy import samples
github tlambert03 / LLSpy / llspy / libcudawrapper.py View on Github external
if len(sys.argv) >= 2:
        if sys.argv[1] == "affine":
            # affine test
            im = tf.imread(
                "/Users/talley/Dropbox (HMS)/CBMF/lattice_sample_data/lls_basic_samp/Deskewed/cell5_ch0_stack0001_488nm_0000000msec_0020931273msecAbs_deskewed.tif"
            )
            T = np.array([[1, 0, 0, -50], [0, 1, 0, -100], [0, 0, 1, 0], [0, 0, 0, 1]])
            q = affineGPU(im, T)
            tf.imshow(q, vmin=-10, vmax=150)
            plt.show()
        elif sys.argv[1] == "deskew":
            # deskew test
            im = tf.imread(
                "/Users/talley/Dropbox (HMS)/CBMF/lattice_sample_data/lls_basic_samp/cell5_ch0_stack0000_488nm_0000000msec_0020931273msecAbs.tif"
            )
            tf.imshow(deskewGPU(im, 0.3))
            plt.show()

            # zstep = sys.argv[1]
            # for i in sys.argv[2:]:
            #   p = p = os.path.abspath(i).replace('\\', '')
            #   if os.path.isfile(p):
            #       tf.imshow(deskewGPU(tf.imread(p), float(zstep)))
            #       plt.show()

        elif sys.argv[1] == "rotate":
            im = tf.imread(
                "/Users/talley/Dropbox (HMS)/CBMF/lattice_sample_data/lls_registration_samp/reg_ex1/tspeck/GPUdecon/tspeck_ch0_stack0000_488nm_0000000msec_0001881189msecAbs_decon.tif"
            )
            angle = float(sys.argv[2]) if len(sys.argv) > 2 else 32.5
            dz = float(sys.argv[3]) if len(sys.argv) > 3 else 0.4
            dx = 0.1
github tlambert03 / LLSpy / llspy / util.py View on Github external
def imshow(*args, **kwargs):
    return tifffile.imshow(*args, **kwargs)
github tlambert03 / LLSpy / llspy / libcudawrapper.py View on Github external
return decon_result


if __name__ == "__main__":
    import tifffile as tf
    import matplotlib.pyplot as plt

    if len(sys.argv) >= 2:
        if sys.argv[1] == "affine":
            # affine test
            im = tf.imread(
                "/Users/talley/Dropbox (HMS)/CBMF/lattice_sample_data/lls_basic_samp/Deskewed/cell5_ch0_stack0001_488nm_0000000msec_0020931273msecAbs_deskewed.tif"
            )
            T = np.array([[1, 0, 0, -50], [0, 1, 0, -100], [0, 0, 1, 0], [0, 0, 0, 1]])
            q = affineGPU(im, T)
            tf.imshow(q, vmin=-10, vmax=150)
            plt.show()
        elif sys.argv[1] == "deskew":
            # deskew test
            im = tf.imread(
                "/Users/talley/Dropbox (HMS)/CBMF/lattice_sample_data/lls_basic_samp/cell5_ch0_stack0000_488nm_0000000msec_0020931273msecAbs.tif"
            )
            tf.imshow(deskewGPU(im, 0.3))
            plt.show()

            # zstep = sys.argv[1]
            # for i in sys.argv[2:]:
            #   p = p = os.path.abspath(i).replace('\\', '')
            #   if os.path.isfile(p):
            #       tf.imshow(deskewGPU(tf.imread(p), float(zstep)))
            #       plt.show()
github sshuair / torchsat / torchsat / utils / visualizer.py View on Github external
def plot_img(img, channels=(1, 2, 3), **kwargs):
    """plot the ndarray images
    
    Args:
        img (ndarray): the ndarray image.
        channels (tuple, optional): target channel to show. Defaults to (1,2,3).
        kwargs (dict, optional): the plt.imshow kwargs.
    """
    plt.figure(figsize=(10, 8))
    channels = channels if isinstance(channels, int) else [x - 1 for x in channels]
    if img.ndim == 2:
        tifffile.imshow(img, cmap="gray", **kwargs)
    else:
        tifffile.imshow(img[..., channels], **kwargs)
github sshuair / torchsat / torchsat / utils / visualizer.py View on Github external
def plot_img(img, channels=(1, 2, 3), **kwargs):
    """plot the ndarray images
    
    Args:
        img (ndarray): the ndarray image.
        channels (tuple, optional): target channel to show. Defaults to (1,2,3).
        kwargs (dict, optional): the plt.imshow kwargs.
    """
    plt.figure(figsize=(10, 8))
    channels = channels if isinstance(channels, int) else [x - 1 for x in channels]
    if img.ndim == 2:
        tifffile.imshow(img, cmap="gray", **kwargs)
    else:
        tifffile.imshow(img[..., channels], **kwargs)