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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file debayer_ohweier-0.0.1.tar.gz.

File metadata

  • Download URL: debayer_ohweier-0.0.1.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.4.2 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for debayer_ohweier-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ea4c74a1129eb2b64d8119be7064eb196806a7ff88d822d618a9f159f567bcc8
MD5 d3cf4672b57ba83172be75f418ac5201
BLAKE2b-256 923ea890991b890f4d6c22af65c6daf22b8f1d06392b3e622ce1f4c1bed2520d

See more details on using hashes here.

File details

Details for the file debayer_ohweier-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: debayer_ohweier-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.4.2 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for debayer_ohweier-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f1d6c0a2c36c5d6f554b980734cd6a53deef2051d9401a3826beaa8b5013dab4
MD5 efddaedadaeccb3c8bb33b9d8bb0dce0
BLAKE2b-256 bc8f10d38b8bd007aade648a4a407f6b1647457ae0f55d06491e9b5930dcd580

See more details on using hashes here.

Supported by

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