Tutorial inhomogenous cylinder¶
import¶
In [7]:
import os
import sys
import numpy as np
root_folder = os.path.dirname(os.getcwd())
sys.path.insert(0, root_folder)
from cgc.geometry_correction import GeometryCorrection
import glob
import matplotlib.pyplot as plt
%matplotlib notebook
from ipywidgets import widgets, interact
initialize object¶
In [8]:
list_tiff = glob.glob('data/tiff/inhomogeneous*.tif')
o_cgc = GeometryCorrection(list_files=list_tiff)
o_cgc.load_files(notebook=True)
Display Images¶
In [9]:
list_images = o_cgc.list_data
fig1, (ax1, ax2) = plt.subplots(1, 2)
def plot(index):
ax1.clear()
ax1.imshow(list_images[index])
ax2.clear()
ax2.plot(list_images[index][0,:])
interact(plot,
index = widgets.IntSlider(value=0,
max=len(list_images)-1),
continuous_update=False)
Out[9]:
<function __main__.plot>
define parameters¶
In [10]:
# center of cylinder
pixel_center = 256
# radius of cylinder
outer_radius = 200
inner_radius= 150
# define the parameters
o_cgc.define_parameters(inner_radius=inner_radius,
outer_radius=outer_radius,
pixel_center=pixel_center)
Display data corrected¶
In [12]:
list_images_corrected = o_cgc.list_data_corrected
fig2, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(8,3))
def plot(index):
ax1.clear()
ax1.imshow(list_images_corrected[index])
ax2.clear()
max_y_value = np.nanmax(list_images_corrected[index][0, 1:])
ax2.plot(list_images_corrected[index][0,:])
ax2.set_ylim(0,max_y_value+1)
ax3.clear()
ax3.plot(list_images_corrected[index][0,:])
plt.tight_layout()
interact(plot,
index = widgets.IntSlider(value=0,
max=len(list_images_corrected)-1),
continuous_update=False)
Out[12]:
<function __main__.plot>