|
73 | 73 | # name of the material for the reconstruction |
74 | 74 | mat_name = 'MAT_NAME' |
75 | 75 |
|
76 | | -#reconstruction with misorientation included, for many grains, this will quickly |
77 | | -#make the reconstruction size unmanagable |
78 | | -misorientation_bnd=0.0 #degrees |
79 | | -misorientation_spacing=0.25 #degress |
| 76 | +# reconstruction with misorientation included, for many grains, |
| 77 | +# this will quickly make the reconstruction size unmanagable |
| 78 | +misorientation_bnd = 0.0 # degrees |
| 79 | +misorientation_spacing = 0.25 # degrees |
80 | 80 |
|
81 | | -beam_stop_width=0.55#mm, assumed to be in the center of the detector |
| 81 | +beam_stop_width = 0.55 # mm, assumed to be in the center of the detector |
82 | 82 |
|
| 83 | +ome_range_deg = [(0., 360.), ] # degrees |
83 | 84 |
|
84 | | -ome_range_deg=[(0.,360.)] #degrees |
| 85 | +# maximu bragg angle 2theta in degrees |
| 86 | +# if -1, all peaks that will hit the detector are calculated |
| 87 | +max_tth = -1. |
85 | 88 |
|
| 89 | +# image processing |
| 90 | +num_for_dark = 250 # num images to use for median data |
| 91 | +threshold = 3. |
86 | 92 |
|
87 | | -max_tth=-1. #degrees, if a negative number is input, all peaks that will hit the detector are calculated |
| 93 | +# !!! DO NOT CHANGE ANY OF THESE UNLESS YOU KNOW WHAT YOU ARE DOING |
| 94 | +num_erosions = 3 # num iterations of images erosion |
| 95 | +num_dilations = 2 # num iterations of images erosion |
| 96 | +ome_dilation_iter = 1 # num iterations of 3d image stack dilations |
| 97 | +chunk_size = 500 # chunksize for multiprocessing |
88 | 98 |
|
89 | | -#image processing |
90 | | -num_for_dark=250#num images to use for median data |
91 | | -threshold=3. |
92 | | -num_erosions=3 #num iterations of images erosion, don't mess with unless you know what you're doing |
93 | | -num_dilations=2 #num iterations of images erosion, don't mess with unless you know what you're doing |
94 | | -ome_dilation_iter=1 #num iterations of 3d image stack dilations, don't mess with unless you know what you're doing |
| 99 | +# thresholds for accepting FF grains in NF reconstruction |
| 100 | +min_completeness = 0.5 |
| 101 | +max_chisq = 0.05 |
95 | 102 |
|
96 | | -chunk_size=500#chunksize for multiprocessing, don't mess with unless you know what you're doing |
| 103 | +# tomography options |
| 104 | +layer_row = 1024 # row of layer to use to find the specimen cross section |
97 | 105 |
|
98 | | -#thresholds for grains in reconstructions |
99 | | -comp_thresh=0.5 #only use orientations from grains with completnesses ABOVE this threshold |
100 | | -chi2_thresh=0.05 #only use orientations from grains BELOW this chi^2 |
| 106 | +# TOMO OPTIONS |
| 107 | +# !!! Don't change these unless you know what you are doing |
| 108 | +# this will close small holes and remove noise |
| 109 | +recon_thresh = 0.00006 # usually varies between 0.0001 and 0.0005 |
| 110 | +noise_obj_size = 5000 |
| 111 | +min_hole_size = 5000 |
101 | 112 |
|
| 113 | +# cross sectional to reconstruct (should be at least 20%-30% over sample width) |
| 114 | +cross_sectional_dim = 1.00 |
102 | 115 |
|
103 | | -#tomography options |
104 | | -layer_row=1024 # row of layer to use to find the cross sectional specimen shape |
| 116 | +voxel_spacing = 0.005 # voxel spacing for the near field reconstruction in mm |
| 117 | +v_bnds = [-0.005, 0.005] # vertical (y) reconstruction voxel bounds in mm |
105 | 118 |
|
106 | | -#Don't change these unless you know what you are doing, this will close small holes |
107 | | -#and remove noise |
108 | | -recon_thresh=0.00006#usually varies between 0.0001 and 0.0005 |
109 | | -noise_obj_size=5000 |
110 | | -min_hole_size=5000 |
111 | | - |
112 | | - |
113 | | -cross_sectional_dim=1.35 #cross sectional to reconstruct (should be at least 20%-30% over sample width) |
114 | | -#voxel spacing for the near field reconstruction |
115 | | -voxel_spacing=0.005#in mm |
116 | | -##vertical (y) reconstruction voxel bounds in mm |
117 | | -v_bnds=[-0.005,0.005] |
118 | | - |
119 | | - |
120 | | - |
121 | | - |
122 | | -#============================================================================== |
| 119 | +# ============================================================================= |
123 | 120 | # %% LOAD GRAIN DATA |
124 | | -#============================================================================== |
| 121 | +# ============================================================================= |
125 | 122 |
|
126 | | -experiment, nf_to_ff_id_map = nfutil.gen_trial_exp_data(grain_out_file,det_file,mat_file, x_ray_energy, mat_name, max_tth, comp_thresh, chi2_thresh, misorientation_bnd, \ |
127 | | - misorientation_spacing,ome_range_deg, num_imgs, beam_stop_width) |
| 123 | +experiment, nf_to_ff_id_map = nfutil.gen_trial_exp_data( |
| 124 | + grain_out_file, det_file, mat_file, x_ray_energy, mat_name, |
| 125 | + max_tth, min_completeness, max_chisq, misorientation_bnd, |
| 126 | + misorientation_spacing, ome_range_deg, num_imgs, beam_stop_width |
| 127 | +) |
128 | 128 |
|
129 | | -#============================================================================== |
| 129 | +# ============================================================================= |
130 | 130 | # %% TOMO PROCESSING - GENERATE BRIGHT FIELD |
131 | | -#============================================================================== |
| 131 | +# ============================================================================= |
132 | 132 |
|
133 | | -tbf=tomoutil.gen_bright_field(tbf_data_folder,tbf_img_start,tbf_num_imgs,experiment.nrows,experiment.ncols) |
| 133 | +tbf = tomoutil.gen_bright_field( |
| 134 | + tbf_data_folder, tbf_img_start, tbf_num_imgs, |
| 135 | + experiment.nrows, experiment.ncols |
| 136 | +) |
134 | 137 |
|
135 | | -#============================================================================== |
| 138 | +# ============================================================================= |
136 | 139 | # %% TOMO PROCESSING - BUILD RADIOGRAPHS |
137 | | -#============================================================================== |
138 | | - |
139 | | - |
140 | | -rad_stack=tomoutil.gen_attenuation_rads(tomo_data_folder,tbf,tomo_img_start,tomo_num_imgs,experiment.nrows,experiment.ncols) |
| 140 | +# ============================================================================= |
141 | 141 |
|
| 142 | +rad_stack = tomoutil.gen_attenuation_rads( |
| 143 | + tomo_data_folder, tbf, tomo_img_start, tomo_num_imgs, |
| 144 | + experiment.nrows, experiment.ncols |
| 145 | +) |
142 | 146 |
|
143 | | -#============================================================================== |
| 147 | +# ============================================================================= |
144 | 148 | # %% TOMO PROCESSING - INVERT SINOGRAM |
145 | | -#============================================================================== |
| 149 | +# ============================================================================= |
146 | 150 |
|
147 | | -reconstruction_fbp=tomoutil.tomo_reconstruct_layer(rad_stack,cross_sectional_dim,layer_row=layer_row,\ |
148 | | - start_tomo_ang=ome_range_deg[0][0],end_tomo_ang=ome_range_deg[0][1],\ |
149 | | - tomo_num_imgs=tomo_num_imgs, center=experiment.detector_params[3]) |
| 151 | +reconstruction_fbp = tomoutil.tomo_reconstruct_layer( |
| 152 | + rad_stack, cross_sectional_dim, layer_row=layer_row, |
| 153 | + start_tomo_ang=ome_range_deg[0][0], end_tomo_ang=ome_range_deg[0][1], |
| 154 | + tomo_num_imgs=tomo_num_imgs, center=experiment.detector_params[3] |
| 155 | +) |
150 | 156 |
|
151 | | -#============================================================================== |
| 157 | +# ============================================================================= |
152 | 158 | # %% TOMO PROCESSING - VIEW RAW FILTERED BACK PROJECTION |
153 | | -#============================================================================== |
| 159 | +# ============================================================================= |
154 | 160 |
|
155 | 161 | plt.close('all') |
156 | | -plt.imshow(reconstruction_fbp,vmin=0.75e-4,vmax=2e-4) |
157 | | -#Use this image to view the raw reconstruction, estimate threshold levels. and |
158 | | -#figure out if the rotation axis position needs to be corrected |
| 162 | +plt.imshow(reconstruction_fbp, vmin=0.75e-4, vmax=2e-4) |
| 163 | +# Use this image to view the raw reconstruction, estimate threshold levels. and |
| 164 | +# figure out if the rotation axis position needs to be corrected |
159 | 165 |
|
160 | 166 |
|
161 | | -#============================================================================== |
| 167 | +# ============================================================================= |
162 | 168 | # %% TOMO PROCESSING - CLEAN TOMO RECONSTRUCTION |
163 | | -#============================================================================== |
| 169 | +# ============================================================================= |
164 | 170 |
|
165 | 171 | binary_recon = tomoutil.threshold_and_clean_tomo_layer( |
166 | 172 | reconstruction_fbp, |
|
0 commit comments