Copyright 2014-2017, All rights reserved
Technical University of Denmark, Kongens Lyngby, Denmark
Code written by A. Cereser and S. Schmidt
Welcome to TiGraMa, a software suite to analyze Time-of-flight Grain Mapping data collected using time-of-flight 3D neutron diffraction (ToF 3DND)1,2.
All software was developed analyzing software collected at J-PARC, beamline ID06 (SENJU).
TiGraMa can analyze data collected using the two ToF 3DND methodologies:
-
Methodology 1, with which data are collected by an imaging detector with high spatial and temporal resolution, mounted in transmission
-
Methodology 2, with which data are collected by both an imaging detector mounted in transmission and by diffraction detector banks
In the current version, only Methodology 1 is supported
All TiGraMa scripts were developed during proof-of-principle data analyses. As such, the code is not optimized for speed. To speed up calculations, it is recommended to run the TiGraMa scripts on a high performance computer.
The reconstruction steps are described in details in 2. The scripts were tested for the Malab versions R2015a to R2017a.
❗ Before running a script, change the folder paths ❗
Grain shape reconstruction
-
Preprocess the collected frames. The aim is to reduce the noise and enhance the signal.
0.1. Perform using a dead-time correction algorithm.
The code to perform the overlap correction was originally developed by A. Tremsin for the Windows platform, and has been ported to Unix by P.M. Larsen. To run it on a Mac, you need to
-
On a terminal, launch
brew install cfitsio
-
From the
Overlap_correction/linux_correction
folder, compile the code usingmake clean && make
-
Run
./fits_correction source_folder/example_file.fits destination_folder
To run the code on a Linux machine, change the path to
cfitsio
in theMakefile
and in the.h
files, andclang++
tog++
0.2. Calculate, from the open beam collected before and after the measurements, the open beam for the considered projection. Script:
Estimate_OB_no_median.m
0.3. Divide the collected dataset by the corresponding open beam. Script:
OB_correction.m
, which callsOB_correction_function.m
0.4. Normalise using a rolling median. Script:
Correction_background.m
, which callsCorrection_background_function.m
Step 0.1 should run on a laptop (with data on an external drive) before uploading data to a server, where the more computationally consuming steps (0.2 to 0.4) run using Matlab.
-
Filter the frames using a signal enhancement filter, such as Murofi 1 (not included in TiGraMa)
-
Isolate the extinction spots with the selected area. Script:
2_Blobs_detector.m
, which calls2_Blobs_detector_function.m
The next steps are computationally intensive. You should run them on an HPC machine
-
Divide the extinction spots by projection using
3_Divide_blobs_proj.sh
or something similar -
For each projection, calculate the similarity between different extinction spots
-
Scripts:
4_Blobs_similarity.m
, which calls4_Blobs_similarity_function.m
and4_Shape_comparison_function.m
-
Output: files in
Results_blobs_comp/
. The files inMap_blobs/
list the properties of the blobs and the files inList_minima/
list the parameters used to measure how similar two blobs are
-
-
Using the angular parameters in
List_minima/
combine similar extinction spots using5_Track_lambda.m
, which calls5_Track_lambda_function.m
. Output:Lambda_IM_before_HT.txt
, listing the properties of the combined images, and the combined images, stored inComb_blobs/
. Approximately, the number of extinction spots per projection should be the same -
Separate the combined extinction spots in folders (one per projection) using
6_commands_sim_diff_lambda.sh
-
Export the information relative to the spots in
Comb_blobs/
using7_Extract_data_Comb_blobs.m
. Output:Data_blobs.txt
-
Plot the distribution of extinction spots per projection. Script:
8_Plot_blobs_distr.m
-
Clean the set of combined extinction spots by considering their centre of mass. This is done by considering a series of cylinders, and for each cylinder combining the spots with centre of mass within it that have similar area, with condition A_min > 0.5*A_max. Additional operations are performed to avoid repetitions
-
Scripts:
9_IM_comb_2.m
, which calls9_Funct_im_comb_2.m
and9_Funct_clean_blobs.m
-
Output:
Data_blobs_final.txt
andImage_combination_before_HT.txt
-
-
Considering a rolling interval, group the extinction spots relative to the same grain using the Hough transform.
- Scripts:
10_Hough_trans_pol_rolling_final.m
,10_Funct_HT_pol_rolling_final.m
,10_Funct_HT_sec_Murofi_final.m
,10_Funct_Hough_split_final.m
,10_Min_max_fitting_function.m
. Structure:
-
At first, look at the point distribution using
10_Funct_HT_sec_Murofi_final.m
and tune the parameters. Then comment the figure option and run for all intervals -
Output:
CM_alpha_R.txt
- Clean the results of the Hough transform, grouping the centre of mass values , to avoid repetitions. In this way, for a given grain we determine its centre of mass and group the corresponding combined extinction spots.
-
Scripts:
Point_grouping_to_3D.m
, which callsPlot_and_group_CM_Murofi.m
,Clean_result_HT.m
andComb_im_before_reconstr.m
-
Output:
3D_reconstr_input.txt
,Cleaned_results_HT.txt
andCM_clusters_final.txt
-
Reconstruct the 3D shape of the grains. Script:
12_Voxels_tagging_final_P.m
-
Visualize the reconstructed volume using Paraview. For a quick introduction to how to visualize volumes using Paraview, see Sec. 1.4.4 of the Recon3D manual. Scripts:
13_Plot_3D_voxels.m
and13_Slides_to_vtk.m
. If you are using the matryoshka doll approach (multiple grain reconstructions), use13_Count_grains.m
instead.
Grain orientation
-
For all reconstructed grains, get (omega, lambda) values of the corresponding extinction spots. Scripts:
14_OL_curves_final.m
, which calls14_OL_curves_fnct.m
, and14_Unify_OL_values.m
. Final output:OL_final_cleared.txt
-
Calculate the centre of mass of the grains. Script:
15_HT_orientation_sections.m
, which calls15_F_count_points_cleaned.m
,15_Funct_acc_matrix.m
and15_Funct_fit_HT.m
. Output:Final_grains_CM.txt
-
Save the properties of the isolated extinction spots images. Script:
16_Isolated_images_properties.m
. Output:Properties_isolated_blobs.txt
-
Clean the (omega, lambda) list, keeping only the values relative to extinction spots which contain the projection of the centre of mass of the corresponding grain. Code:
17_OL_values_grain_CM.m
, output:OL_final_OK.txt
-
Calculate the grain orientation from the distribution of (omega, lambda) values. Script:
18_Save_omega_lambda_fit.m
, calling18_Plot_omega_lambda_single_grain.m
and18_indexToF.m
Feel free to download TiGraMa and use it to analyze your dataset. If you spot a bug, send an email to alberto.cereser@gmail.com or flag it here on GitHub.
To cite TiGraMa, please refer to the article presenting ToF 3DND1.
1: A. Cereser, M. Strobl, S. A. Hall, A. Steuwer, R. Kiyanagi, A. S. Tremsin, E. Bergbäck Knudsen, T. Shinohara, P. K. Willendrup, A. Bastos da Silva Fanta, S. Iyengar, P. M. Larsen, T. Hanashima, T. Moyoshi, P. M. Kadletz, P. Krooß, T. Niendorf, M. Sales, W. W. Schmahl & S. Schmidt (2017). “Time-of-Flight Three Dimensional Neutron Diffraction in Transmission Mode for Mapping Crystal Grain Structures.” Scientific Reports 7 (1): 9561, 9561. doi:10.1038/s41598-017-09717-w.
2: A. Cereser, S. A. Hall, A. Steuwer, M. Strobl & S. Schmidt (2016). Time-of-flight 3D Neutron Diffraction for Multigrain Crystallography. Department of Physics, Technical University of Denmark.
This software is covered by the GNU General Public License.