#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Examples of the geometry classes usage: initialiation of a circular, helical and linear orbits; import ASTRA geometries. """ #%% Imports: from flexdata import geometry from flexdata import display #%% Initialize a geometry record: # Initialization: geo = geometry.circular(src2obj=100, det2obj=50, det_pixel=0.1, img_pixel=0.05, ang_range=(0, 180), unit='mm') # Print geometry parameters: print('\n', geo) # Additional parameters: geo['axs_pitch'] = 30 # Plot the source orbit: orbit = geo.get_source_orbit(50) display.plot3d(orbit[:, 0], orbit[:, 1], orbit[:, 2], connected=True,
from flexdata import display from flextomo import phantom # Simulate from flextomo import model from flextomo import projector # Reconstruct from flexcalc import analyze from flexcalc import process import numpy #%% Short version of the spectral modeling: # Geomtery: geom = geometry.circular(src2obj=100, det2obj=100, det_pixel=0.2, ang_range=[0, 360]) # This is our phantom: vol = phantom.cuboid([1, 128, 128], geom, 8, 8, 8) display.slice(vol, title='Phantom') # Spectrum of the scanner: kv = 90 filtr = {'material': 'Cu', 'density': 8, 'thickness': 0.1} detector = {'material': 'Si', 'density': 5, 'thickness': 1} E, S = model.effective_spectrum(kv=kv, filtr=filtr, detector=detector) # Display: display.plot(E, S, title='Effective spectrum')
import numpy #%% Create volume and forward project: # Initialize images: h = 512 # volume size vol = numpy.zeros([32, h, h], dtype='float32') proj = numpy.zeros([32, 361, h], dtype='float32') # Define a simple projection geometry: src2obj = 100 # mm det2obj = 100 # mm det_pixel = 0.001 # mm (1 micron) geom = geometry.circular(src2obj, det2obj, det_pixel, ang_range=[0, 360]) # Create phantom (150 micron wide, 15 micron wall thickness): vol = phantom.sphere(vol.shape, geom, 0.08) vol -= phantom.sphere(vol.shape, geom, 0.07) # Project: projector.forwardproject(proj, vol, geom) # Show: display.slice(vol, title='Phantom') display.slice(proj, dim=0, title='Sinogram') #%% Get the material refraction index of calcium carbonate: c = model.find_nist_name('Calcium Carbonate')