Skip to main content

Small toolkit to debayer and stack images.

Project description

Debayer Ohweier

Small toolkit to debayer and stack images.

How to capture images

Use the setting (Bayer) for taking the images.

Example

from debayer_ohweier import debayer,get_gradient_stack,get_argmax, zstack,save_image,save_plot
import matplotlib.pyplot as plt
import numpy as np
import os
import glob


path='sample data' #Path to the tif-files from Microscope
im_paths=sorted(glob.glob(os.path.join(path,'*.tif')))

# load and debayer all files
ims=[]
for p in im_paths:
    im=debayer(path=p)
    ims.append(im)
    dirname,filename=os.path.split(p)
    save_image(im,os.path.join(dirname,'debayered',filename))
print('debayered')

# calc the gradient of all images. the gradient is highest for sharb edges in the image, hence, areas in Focus
a_grad_stack,a_grad_b_stack=get_gradient_stack(ims)
print('gradient')

# chose the image with the higest gradient per location to get height information
a_max_b=get_argmax(a_grad_b_stack)
a_max=get_argmax(a_grad_stack)
save_image(a_max,os.path.join(path,'stack','height.tif'))
save_plot(a_max,os.path.join(path,'stack','height.pdf'),pixelsize=800/60,s_unit='$\mu m$')
save_plot(a_max,os.path.join(path,'stack','height.svg'),pixelsize=800/60,s_unit='$\mu m$')
save_plot(a_max,os.path.join(path,'stack','height.png'),pixelsize=800/60,s_unit='$\mu m$')
print('argmax')

# Stack debayered images acording to height information
a_neu=zstack(ims,a_max_b,blur=True, blursize=30)
save_image(a_neu,os.path.join(path,'stack','stack.tif'))
save_image(a_neu,os.path.join(path,'stack','stack.jpg'))
print('zstack')

Developer: Jan Paschen
jan.paschen@ise.fraunhofer.de

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

debayer_ohweier-0.0.1.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

debayer_ohweier-0.0.1-py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page