From 93549b4c8ac43fcd8c47d7c51c0df1725a56df61 Mon Sep 17 00:00:00 2001 From: nghia-vo Date: Sat, 10 Jul 2021 17:49:14 +0100 Subject: [PATCH] Update doc --- algotom/io/converter.py | 4 +- algotom/io/loadersaver.py | 12 +- algotom/post/postprocessing.py | 10 +- algotom/prep/calculation.py | 20 +-- algotom/prep/conversion.py | 16 +-- algotom/prep/correction.py | 16 +-- algotom/prep/filtering.py | 4 +- algotom/prep/removal.py | 8 +- algotom/rec/reconstruction.py | 8 +- algotom/util/calibration.py | 8 +- algotom/util/config.py | 44 +++--- algotom/util/log.py | 6 +- algotom/util/simulation.py | 8 +- algotom/util/utility.py | 48 +++---- docs/source/api.rst | 34 ++++- docs/source/api/algotom.prep.calculation.rst | 19 ++- docs/source/api/algotom.prep.conversion.rst | 12 +- docs/source/api/algotom.prep.correction.rst | 12 ++ docs/source/api/algotom.prep.filtering.rst | 6 +- docs/source/api/algotom.prep.removal.rst | 19 +++ .../source/api/algotom.rec.reconstruction.rst | 10 ++ docs/source/api/algotom.util.calibration.rst | 11 +- docs/source/api/algotom.util.simulation.rst | 12 +- docs/source/api/algotom.util.utility.rst | 30 +++- docs/source/conf.py | 128 +++++++++--------- docs/source/demo.rst | 9 -- docs/source/demo/doc.examples.rst | 22 --- docs/source/features.rst | 28 ++-- docs/source/highlights.rst | 2 +- docs/source/index.rst | 3 +- docs/source/install.rst | 4 +- docs/source/usage.rst | 42 ++++-- 32 files changed, 365 insertions(+), 250 deletions(-) delete mode 100644 docs/source/demo.rst delete mode 100644 docs/source/demo/doc.examples.rst diff --git a/algotom/io/converter.py b/algotom/io/converter.py index 4e9e5b0..5696725 100644 --- a/algotom/io/converter.py +++ b/algotom/io/converter.py @@ -22,8 +22,8 @@ """ Module for converting data type: -- Convert a list of tif files to a hdf/nxs file. -- Extract tif images from a hdf/nxs file. + - Convert a list of tif files to a hdf/nxs file. + - Extract tif images from a hdf/nxs file. """ import os diff --git a/algotom/io/loadersaver.py b/algotom/io/loadersaver.py index 1c5345e..f89a4c0 100644 --- a/algotom/io/loadersaver.py +++ b/algotom/io/loadersaver.py @@ -22,12 +22,12 @@ """ Module for I/O tasks: -- Load data from an image file (tif, png, jpeg) or a hdf/nxs file. -- Get dataset information in a hdf/nxs file. -- Search for datasets in a hdf/nxs file. -- Save a 2D array as a tif image or 2D, 3D array to a hdf/nxs file. -- Search file names, make a file/folder name. -- Load distortion coefficients from a txt file. + - Load data from an image file (tif, png, jpeg) or a hdf/nxs file. + - Get dataset information in a hdf/nxs file. + - Search for datasets in a hdf/nxs file. + - Save a 2D array as a tif image or 2D, 3D array to a hdf/nxs file. + - Search file names, make a file/folder name. + - Load distortion coefficients from a txt file. """ import os diff --git a/algotom/post/postprocessing.py b/algotom/post/postprocessing.py index a542748..92a15b3 100644 --- a/algotom/post/postprocessing.py +++ b/algotom/post/postprocessing.py @@ -22,11 +22,11 @@ """ Module of methods in the postprocessing stage: -- Get statistical information of reconstructed images or a dataset. -- Downsample 2D, 3D array, or a dataset. -- Rescale 2D, 3D array or a dataset to 8-bit or 16-bit data-type. -- Removing ring artifacts in a reconstructed image by transform back and forth -between the polar coordinates and the Cartesian coordinates. + - Get statistical information of reconstructed images or a dataset. + - Downsample 2D, 3D array, or a dataset. + - Rescale 2D, 3D array or a dataset to 8-bit or 16-bit data-type. + - Removing ring artifacts in a reconstructed image by transform back and + forth between the polar coordinates and the Cartesian coordinates. """ import os diff --git a/algotom/prep/calculation.py b/algotom/prep/calculation.py index 8ec06e9..25d249b 100644 --- a/algotom/prep/calculation.py +++ b/algotom/prep/calculation.py @@ -22,16 +22,16 @@ """ Module of calculation methods in the preprocessing stage: -- Calculating the center-of-rotation (COR) in a 180-degree scan using a - sinogram. -- Determining the overlap-side and overlap-area between images. -- Calculating the COR in a half-acquisition scan (360-degree scan with offset - COR). -- Using the similar technique as above to calculate the COR in a 180-degree scan - from two projections. -- Determining the relative translations between images using phase-correlation - technique. -- Calculating the COR in a 180-degree scan using phase-correlation technique. + - Calculating the center-of-rotation (COR) in a 180-degree scan using a + sinogram. + - Determining the overlap-side and overlap-area between images. + - Calculating the COR in a half-acquisition scan (360-degree scan with + offset COR). + - Using the similar technique as above to calculate the COR in a 180-degree + scan from two projections. + - Determining the relative translations between images using + phase-correlation technique. + - Calculating the COR in a 180-degree scan using phase-correlation technique. """ import numpy as np diff --git a/algotom/prep/conversion.py b/algotom/prep/conversion.py index 6cd7652..c4fde26 100644 --- a/algotom/prep/conversion.py +++ b/algotom/prep/conversion.py @@ -22,14 +22,14 @@ """ Module of conversion methods in the preprocessing stage: -- Stitching images. -- Joining images if there is no overlapping. -- Converting a 360-degree sinogram with offset center-of-rotation (COR) to - a 180-degree sinogram. -- Extending a 360-degree sinogram with offset COR for direct reconstruction - instead of converting it to a 180-degree sinogram. -- Converting a 180-degree sinogram to a 360-sinogram. -- Generating a sinogram from a helical data. + - Stitching images. + - Joining images if there is no overlapping. + - Converting a 360-degree sinogram with offset center-of-rotation (COR) to + a 180-degree sinogram. + - Extending a 360-degree sinogram with offset COR for direct reconstruction + instead of converting it to a 180-degree sinogram. + - Converting a 180-degree sinogram to a 360-sinogram. + - Generating a sinogram from a helical data. """ import numpy as np diff --git a/algotom/prep/correction.py b/algotom/prep/correction.py index d3b0b8f..4feb4a9 100644 --- a/algotom/prep/correction.py +++ b/algotom/prep/correction.py @@ -22,12 +22,12 @@ """ Module of correction methods in the preprocessing stage: -- Flat-field correction. -- Distortion correction. -- MTF deconvolution. -- Tilted sinogram generation. -- Tilted 1D intensity-profile generation. -- Beam hardening correction. + - Flat-field correction. + - Distortion correction. + - MTF deconvolution. + - Tilted sinogram generation. + - Tilted 1D intensity-profile generation. + - Beam hardening correction. """ import numpy as np @@ -60,8 +60,8 @@ def flat_field_correction(proj, flat, dark, ratio=1.0, use_dark=True, options : dict, optional Apply a zinger removal method and/or ring removal methods. E.g option1={"method": "dezinger", "para1": 0.001, "para2": 1}, - option2={"method": "remove_stripe_based_sorting", - "para1": 15, "para2": 1} + option2={"method": "remove_stripe_based_sorting", "para1": 15, + "para2": 1} Returns ------- diff --git a/algotom/prep/filtering.py b/algotom/prep/filtering.py index e0c316d..909d4e8 100644 --- a/algotom/prep/filtering.py +++ b/algotom/prep/filtering.py @@ -22,8 +22,8 @@ """ Module of filtering methods in the preprocessing stage: -- Fresnel filter (denoising or low-pass filter). -- Double-wedge filter. + - Fresnel filter (denoising or low-pass filter). + - Double-wedge filter. """ import numpy as np diff --git a/algotom/prep/removal.py b/algotom/prep/removal.py index c0a3cc0..314de52 100644 --- a/algotom/prep/removal.py +++ b/algotom/prep/removal.py @@ -22,10 +22,10 @@ """ Module of removal methods in the preprocessing stage: -- Many methods for removing stripe artifact in a sinogram (<-> ring artifact -in a reconstructed image). -- A zinger removal method. -- Blob removal methods. + - Many methods for removing stripe artifact in a sinogram (<-> ring artifact + in a reconstructed image). + - A zinger removal method. + - Blob removal methods. """ import numpy as np diff --git a/algotom/rec/reconstruction.py b/algotom/rec/reconstruction.py index a1bc6b2..0086c13 100644 --- a/algotom/rec/reconstruction.py +++ b/algotom/rec/reconstruction.py @@ -22,10 +22,10 @@ """ Module of FFT-based reconstruction methods in the reconstruction stage: -- Filtered back-projection (FBP) method for GPU (using numba and cuda) and CPU. -- Direct Fourier inversion (DFI) method. -- Wrapper for Astra Toolbox reconstruction (optional) -- Wrapper for Tomopy-gridrec reconstruction (optional) + - Filtered back-projection (FBP) method for GPU (using numba and cuda) and CPU. + - Direct Fourier inversion (DFI) method. + - Wrapper for Astra Toolbox reconstruction (optional) + - Wrapper for Tomopy-gridrec reconstruction (optional) """ import math diff --git a/algotom/util/calibration.py b/algotom/util/calibration.py index 726d4b4..04933d5 100644 --- a/algotom/util/calibration.py +++ b/algotom/util/calibration.py @@ -22,10 +22,10 @@ """ Module of calibration methods: -- Correcting the non-uniform background of an image. -- Binarizing an image. -- Calculating the distance between two point-like objects segmented from - two images. Useful for determining pixel-size in helical scans. + - Correcting the non-uniform background of an image. + - Binarizing an image. + - Calculating the distance between two point-like objects segmented from + two images. Useful for determining pixel-size in helical scans. """ import numpy as np diff --git a/algotom/util/config.py b/algotom/util/config.py index b8b4579..1fe2cb4 100644 --- a/algotom/util/config.py +++ b/algotom/util/config.py @@ -1,19 +1,21 @@ +# ============================================================================ +# Author: Francesco De Carlo +# Description: Configuration module +# Contributors: +# ============================================================================ + import os import sys import pathlib import argparse import configparser -import numpy as np from collections import OrderedDict from pathlib import Path - from algotom.util import log -LOGS_HOME = Path.home()/'logs' +LOGS_HOME = Path.home() / 'logs' CONFIG_FILE_NAME = os.path.join(str(pathlib.Path.home()), 'algotom.conf') - SECTIONS = OrderedDict() - SECTIONS['general'] = { 'config': { 'default': CONFIG_FILE_NAME, @@ -39,13 +41,11 @@ 'type': str, 'default': "D:/output/", 'help': "string"}, - } - - -EXPLORE_PARAMS = ('explore', ) - +} +EXPLORE_PARAMS = ('explore',) NICE_NAMES = ('General', 'Explore') + def get_config_name(): """Get the command line --config option.""" name = CONFIG_FILE_NAME @@ -58,7 +58,6 @@ def get_config_name(): if name[0] == '=': name = name[1:] return name - return name @@ -72,10 +71,9 @@ def parse_known_args(parser, subparser=False): subparser_value = [sys.argv[1]] if subparser else [] config_values = config_to_list(config_name=get_config_name()) values = subparser_value + config_values + sys.argv[1:] - #print(subparser_value, config_values, values) + # print(subparser_value, config_values, values) else: values = "" - return parser.parse_known_args(values)[0] @@ -87,34 +85,30 @@ def config_to_list(config_name=CONFIG_FILE_NAME): """ result = [] config = configparser.ConfigParser() - if not config.read([config_name]): return [] for section in SECTIONS: - for name, opts in ((n, o) for n, o in SECTIONS[section].items() if config.has_option(section, n)): + for name, opts in ((n, o) for n, o in SECTIONS[section].items() if + config.has_option(section, n)): value = config.get(section, name) - if value != '' and value != 'None': action = opts.get('action', None) - if action == 'store_true' and value == 'True': # Only the key is on the command line for this action result.append('--{}'.format(name)) - if not action == 'store_true': if opts.get('nargs', None) == '+': result.append('--{}'.format(name)) result.extend((v.strip() for v in value.split(','))) else: result.append('--{}={}'.format(name, value)) - return result class Params(object): def __init__(self, sections=()): - self.sections = sections + ('general', ) + self.sections = sections + ('general',) def add_parser_args(self, parser): for section in self.sections: @@ -129,7 +123,6 @@ def add_arguments(self, parser): def get_defaults(self): parser = argparse.ArgumentParser() self.add_arguments(parser) - return parser.parse_args('') @@ -144,16 +137,15 @@ def write(config_file, args=None, sections=None): for section in SECTIONS: config.add_section(section) for name, opts in SECTIONS[section].items(): - if args and sections and section in sections and hasattr(args, name.replace('-', '_')): + if (args and sections and section in sections) \ + and hasattr(args, name.replace('-', '_')): value = getattr(args, name.replace('-', '_')) if isinstance(value, list): # print(type(value), value) value = ', '.join(value) else: value = opts['default'] if opts['default'] is not None else '' - prefix = '# ' if value == '' else '' - if name != 'config': config.set(section, prefix + name, str(value)) with open(config_file, 'w') as f: @@ -187,11 +179,11 @@ def show_config(args): log.warning('algotom status start') for section, name in zip(SECTIONS, NICE_NAMES): - entries = sorted((k for k in args.keys() if k.replace('_', '-') in SECTIONS[section])) + entries = sorted((k for k in args.keys() if + k.replace('_', '-') in SECTIONS[section])) if entries: for entry in entries: value = args[entry] if args[entry] != None else "-" log.info(" {:<16} {}".format(entry, value)) log.warning('algotom status end') - diff --git a/algotom/util/log.py b/algotom/util/log.py index e388f6b..26eaa29 100644 --- a/algotom/util/log.py +++ b/algotom/util/log.py @@ -1,6 +1,5 @@ ''' - tomoscan custom logger - +Logger ''' import logging @@ -24,7 +23,8 @@ def setup_custom_logger(lfname=None, stream_to_console=True): if (lfname != None): fHandler = logging.FileHandler(lfname) - file_formatter = logging.Formatter('%(asctime)s - %(levelname)s: %(message)s') + file_formatter = logging.Formatter('%(asctime)s - %(levelname)s:' + ' %(message)s') fHandler.setFormatter(file_formatter) logger.addHandler(fHandler) if stream_to_console: diff --git a/algotom/util/simulation.py b/algotom/util/simulation.py index d81abaa..dc685d3 100644 --- a/algotom/util/simulation.py +++ b/algotom/util/simulation.py @@ -23,10 +23,10 @@ """ Module of simulation methods: -1- Methods for designing a customized 2D phantom. -2- Method for calculating a sinogram of a phantom based on the Fourier - slice theorem. -3- Methods for adding artifacts to a simulated sinogram. + - Methods for designing a customized 2D phantom. + - Method for calculating a sinogram of a phantom based on the Fourier + slice theorem. + - Methods for adding artifacts to a simulated sinogram. """ import numpy as np diff --git a/algotom/util/utility.py b/algotom/util/utility.py index 93cd7ea..0bb7ef0 100644 --- a/algotom/util/utility.py +++ b/algotom/util/utility.py @@ -22,30 +22,30 @@ """ Module of utility methods: -1- Methods for parallel computing, geometric transformation, masking. -2- Methods for customizing stripe/ring removal methods - 2.1 - sort_forward - 2.2 - sort_backward - 2.3 - separate_frequency_component - 2.4 - generate_fitted_image - 2.5 - detect_stripe - 2.6 - calculate_regularization_coefficient - 2.7 - make_2d_butterworth_window - 2.8 - make_2d_damping_window - 2.9 - apply_wavelet_decomposition - 2.10 - apply_wavelet_reconstruction - 2.11 - apply_filter_to_wavelet_component - 2.12 - interpolate_inside_stripe - 2.13 - transform_slice_forward - 2.14 - transform_slice_backward -3- Customized smoothing filters: - 3.1 - apply_gaussian_filter (in the Fourier space) - 3.2 - apply_regularization_filter -4- Methods for grid scans: - 4.1 - detect_sample - 4.2 - fix_non_sample_areas - 4.3 - locate_slice - 4.4 - locate_slice_chunk + - Methods for parallel computing, geometric transformation, masking. + - Methods for customizing stripe/ring removal methods + + sort_forward + + sort_backward + + separate_frequency_component + + generate_fitted_image + + detect_stripe + + calculate_regularization_coefficient + + make_2d_butterworth_window + + make_2d_damping_window + + apply_wavelet_decomposition + + apply_wavelet_reconstruction + + apply_filter_to_wavelet_component + + interpolate_inside_stripe + + transform_slice_forward + + transform_slice_backward + - Customized smoothing filters: + + apply_gaussian_filter (in the Fourier space) + + apply_regularization_filter + - Methods for grid scans: + + detect_sample + + fix_non_sample_areas + + locate_slice + + locate_slice_chunk """ import sys diff --git a/docs/source/api.rst b/docs/source/api.rst index 347a656..025f7fb 100644 --- a/docs/source/api.rst +++ b/docs/source/api.rst @@ -1,21 +1,41 @@ -=== -API -=== +============= +API reference +============= - -.. rubric:: **algotom Modules:** +1. Input-output +--------------- .. toctree:: - api/algotom.io.converter api/algotom.io.loadersaver - api/algotom.post.postprocessing + +2. Pre-processing +----------------- + +.. toctree:: + api/algotom.prep.calculation api/algotom.prep.conversion api/algotom.prep.correction api/algotom.prep.filtering api/algotom.prep.removal + +3. Reconstruction +----------------- + +.. toctree:: api/algotom.rec.reconstruction + +4. Post-processing +------------------ + +.. toctree:: + api/algotom.post.postprocessing + +5. Utility +---------- + +.. toctree:: api/algotom.util.calibration api/algotom.util.config api/algotom.util.log diff --git a/docs/source/api/algotom.prep.calculation.rst b/docs/source/api/algotom.prep.calculation.rst index 2890e3b..40cf7b7 100644 --- a/docs/source/api/algotom.prep.calculation.rst +++ b/docs/source/api/algotom.prep.calculation.rst @@ -10,4 +10,21 @@ .. autosummary:: - + make_inverse_double_wedge_mask + calculate_center_metric + coarse_search_cor + fine_search_cor + downsample_cor + find_center_vo + calculate_curvature + correlation_metric + search_overlap + find_overlap + find_overlap_multiple + find_center_360 + complex_gradient + find_shift_based_phase_correlation + find_center_based_phase_correlation + find_center_projection + calculate_reconstructable_height + calculate_maximum_index diff --git a/docs/source/api/algotom.prep.conversion.rst b/docs/source/api/algotom.prep.conversion.rst index 13478cc..d5815ac 100644 --- a/docs/source/api/algotom.prep.conversion.rst +++ b/docs/source/api/algotom.prep.conversion.rst @@ -9,5 +9,15 @@ .. rubric:: **Functions:** .. autosummary:: - + + make_weight_matrix + stitch_image + join_image + stitch_image_multiple + join_image_multiple + convert_sinogram_360_to_180 + convert_sinogram_180_to_360 + extend_sinogram + generate_sinogram_helical_scan + generate_full_sinogram_helical_scan diff --git a/docs/source/api/algotom.prep.correction.rst b/docs/source/api/algotom.prep.correction.rst index b137a2e..a4e4d66 100644 --- a/docs/source/api/algotom.prep.correction.rst +++ b/docs/source/api/algotom.prep.correction.rst @@ -9,5 +9,17 @@ .. rubric:: **Functions:** .. autosummary:: + + flat_field_correction + unwarp_projection + unwarp_sinogram + unwarp_sinogram_chunk + mtf_deconvolution + generate_tilted_sinogram + generate_tilted_sinogram_chunk + generate_tilted_profile_line + generate_tilted_profile_chunk + non_linear_function + beam_hardening_correction diff --git a/docs/source/api/algotom.prep.filtering.rst b/docs/source/api/algotom.prep.filtering.rst index 7f6bd14..e3a1077 100644 --- a/docs/source/api/algotom.prep.filtering.rst +++ b/docs/source/api/algotom.prep.filtering.rst @@ -9,5 +9,9 @@ .. rubric:: **Functions:** .. autosummary:: - + + make_fresnel_window + fresnel_filter + make_double_wedge_mask + double_wedge_filter diff --git a/docs/source/api/algotom.prep.removal.rst b/docs/source/api/algotom.prep.removal.rst index bba956d..6f3e75c 100644 --- a/docs/source/api/algotom.prep.removal.rst +++ b/docs/source/api/algotom.prep.removal.rst @@ -9,5 +9,24 @@ .. rubric:: **Functions:** .. autosummary:: + + remove_stripe_based_sorting + remove_stripe_based_filtering + remove_stripe_based_fitting + remove_large_stripe + remove_dead_stripe + remove_all_stripe + remove_stripe_based_2d_filtering_sorting + remove_stripe_based_normalization + remove_stripe_based_regularization + remove_stripe_based_fft + remove_stripe_based_wavelet_fft + remove_stripe_based_interpolation + check_zinger_size + select_zinger + remove_zinger + generate_blob_mask + remove_blob_1d + remove_blob diff --git a/docs/source/api/algotom.rec.reconstruction.rst b/docs/source/api/algotom.rec.reconstruction.rst index 0ece1ea..7e4accb 100644 --- a/docs/source/api/algotom.rec.reconstruction.rst +++ b/docs/source/api/algotom.rec.reconstruction.rst @@ -10,4 +10,14 @@ .. autosummary:: + make_smoothing_window + make_2d_ramp_window + apply_ramp_filter + back_projection_gpu + back_projection_cpu + fbp_reconstruction + generate_mapping_coordinate + dfi_reconstruction + gridrec_reconstruction + astra_reconstruction diff --git a/docs/source/api/algotom.util.calibration.rst b/docs/source/api/algotom.util.calibration.rst index 78573c7..9659eaa 100644 --- a/docs/source/api/algotom.util.calibration.rst +++ b/docs/source/api/algotom.util.calibration.rst @@ -9,5 +9,14 @@ .. rubric:: **Functions:** .. autosummary:: - + + normalize_background + normalize_background_based_fft + invert_dot_contrast + calculate_threshold + binarize_image + get_dot_size + check_dot_size + select_dot_based_size + calculate_distance diff --git a/docs/source/api/algotom.util.simulation.rst b/docs/source/api/algotom.util.simulation.rst index d39e6c4..0bda592 100644 --- a/docs/source/api/algotom.util.simulation.rst +++ b/docs/source/api/algotom.util.simulation.rst @@ -9,5 +9,15 @@ .. rubric:: **Functions:** .. autosummary:: - + + make_elliptic_mask + make_rectangular_mask + make_triangular_mask + make_line_target + make_face_phantom + make_sinogram + add_noise + add_stripe_artifact + convert_to_Xray_image + add_background_fluctuation diff --git a/docs/source/api/algotom.util.utility.rst b/docs/source/api/algotom.util.utility.rst index 84d9294..a36097e 100644 --- a/docs/source/api/algotom.util.utility.rst +++ b/docs/source/api/algotom.util.utility.rst @@ -9,5 +9,33 @@ .. rubric:: **Functions:** .. autosummary:: - + apply_method_to_multiple_sinograms + mapping + make_circle_mask + sort_forward + sort_backward + separate_frequency_component + generate_fitted_image + detect_stripe + calculate_regularization_coefficient + make_2d_butterworth_window + make_2d_damping_window + apply_wavelet_decomposition + apply_wavelet_reconstruction + check_level + apply_filter_to_wavelet_component + interpolate_inside_stripe + rectangular_from_polar + polar_from_rectangular + transform_slice_forward + transform_slice_backward + make_2d_gaussian_window + apply_gaussian_filter + apply_1d_regularizer + apply_regularization_filter + transform_1d_window_to_2d + detect_sample + fix_non_sample_areas + locate_slice + locate_slice_chunk \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index 529e153..f810024 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -24,7 +24,7 @@ # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '3.0.3' +# needs_sphinx = '3.0.3' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom @@ -43,7 +43,7 @@ bibtex_bibfiles = [ 'bibtex/ref.bib', 'bibtex/cite.bib' - ] +] # Napoleon settings napoleon_google_docstring = True @@ -57,7 +57,7 @@ napoleon_use_param = False napoleon_use_rtype = False -todo_include_todos=True +todo_include_todos = True # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -66,7 +66,7 @@ source_suffix = '.rst' # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' @@ -87,13 +87,13 @@ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +# language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -101,14 +101,14 @@ # The reST default role (used for this markup: `text`) to use for all # documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. @@ -118,10 +118,10 @@ pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. -#keep_warnings = False +# keep_warnings = False # -- Options for HTML output ---------------------------------------------- @@ -135,33 +135,34 @@ if not on_rtd: # only import and set the theme if we're building docs locally import sphinx_rtd_theme + html_theme = 'sphinx_rtd_theme' html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +# html_theme_options = {} html_theme_options = {'includehidden': False} # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +# html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -#html_title = None +# html_title = None # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +# html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +# html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, @@ -177,95 +178,94 @@ # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. -#html_extra_path = [] +# html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = project+'doc' - +htmlhelp_basename = project + 'doc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { -# The paper size ('letterpaper' or 'a4paper'). -#'papersize': 'letterpaper', + # The paper size ('letterpaper' or 'a4paper'). + # 'papersize': 'letterpaper', -# The font size ('10pt', '11pt' or '12pt'). -#'pointsize': '10pt', + # The font size ('10pt', '11pt' or '12pt'). + # 'pointsize': '10pt', -# Additional stuff for the LaTeX preamble. -#'preamble': '', + # Additional stuff for the LaTeX preamble. + # 'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ('index', - project+'.tex', - project+u' Documentation', - Affiliation,'manual'), + ('index', + project + '.tex', + project + u' Documentation', + Affiliation, 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +# latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_domain_indices = True +# latex_domain_indices = True # -- Options for manual page output --------------------------------------- @@ -273,14 +273,13 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index',project, - project+u' Documentation', - [Affiliation,], - 1) + ('index', project, + project + u' Documentation', + [Affiliation, ], 1) ] # If true, show URL addresses after external links. -#man_show_urls = False +# man_show_urls = False # -- Options for Texinfo output ------------------------------------------- @@ -289,25 +288,25 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', - project, - project+u' Documentation', - Affiliation, - project, - 'Algotom'), + ('index', + project, + project + u' Documentation', + Affiliation, + project, + 'Algotom'), ] # Documents to append as an appendix to all manuals. -#texinfo_appendices = [] +# texinfo_appendices = [] # If false, no module index is generated. -#texinfo_domain_indices = True +# texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. -#texinfo_show_urls = 'footnote' +# texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. -#ztexinfo_no_detailmenu = False +# ztexinfo_no_detailmenu = False # -- Options for Texinfo output ------------------------------------------- # http://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autodoc_mock_imports @@ -321,3 +320,4 @@ 'numpy', 'scipy' ] +autodoc_member_order = 'bysource' \ No newline at end of file diff --git a/docs/source/demo.rst b/docs/source/demo.rst deleted file mode 100644 index c6c1c3d..0000000 --- a/docs/source/demo.rst +++ /dev/null @@ -1,9 +0,0 @@ -======== -Examples -======== - -This section contains python code examples on how to use Algotom. - -.. toctree:: - - demo/doc.examples \ No newline at end of file diff --git a/docs/source/demo/doc.examples.rst b/docs/source/demo/doc.examples.rst deleted file mode 100644 index e2a33b8..0000000 --- a/docs/source/demo/doc.examples.rst +++ /dev/null @@ -1,22 +0,0 @@ -Utility -======= - -This section contains links to python code examples. - -* :download:`explore_hdf_tomo_data.py <../../../docs/demo/example_01_explore_hdf_tomo_data.py>` -* :download:`reconstruct_360_degree_scan_with_offset_center.py <../../../docs/demo/example_02_reconstruct_360_degree_scan_with_offset_center.py>` -* :download:`reconstruct_few_slices_grid_scan_with_offset_center.py <../../../docs/demo/example_03_reconstruct_few_slices_grid_scan_with_offset_center.py>` -* :download:`reconstruct_helical_scan_with_offset_center.py <../../../docs/demo/example_04_reconstruct_helical_scan_with_offset_center.py>` -* :download:`reconstruct_std_scan_full_size.py <../../../docs/demo/example_05_reconstruct_std_scan_full_size.py>` -* :download:`reconstruct_std_scan.py <../../../docs/demo/example_05_reconstruct_std_scan.py>` -* :download:`reconstruct_std_scan_with_distortion_correction.py <../../../docs/demo/example_06_reconstruct_std_scan_with_distortion_correction.py>` -* :download:`full_reconstruction_a_grid_scan_step_01.py <../../../docs/demo/example_07_full_reconstruction_a_grid_scan_step_01.py>` -* :download:`full_reconstruction_a_grid_scan_step_02.py <../../../docs/demo/example_07_full_reconstruction_a_grid_scan_step_02.py>` -* :download:`full_reconstruction_a_grid_scan_step_03_downsample.py <../../../docs/demo/example_07_full_reconstruction_a_grid_scan_step_03_downsample.py>` -* :download:`generate_simulation_data.py <../../../docs/demo/example_08_generate_simulation_data.py>` -* :download:`generate_tilted_sinogram.py <../../../docs/demo/example_09_generate_tilted_sinogram.py>` -* :download:`pre_process_data_in_the_projection_space.py <../../../docs/demo/example_10_pre_process_data_in_the_projection_space.py>` - - - - diff --git a/docs/source/features.rst b/docs/source/features.rst index 9c54693..1fc5f5b 100644 --- a/docs/source/features.rst +++ b/docs/source/features.rst @@ -17,19 +17,21 @@ follows: - Methods for processing grid scans (or tiled scans) with the offset rotation-axis to multiply double the field-of-view (FOV) of a parallel-beam tomography system. - .. image:: img/grid_scan.jpg - :width: 480px + .. figure:: img/grid_scan.jpg + :figwidth: 100 % :alt: grid_scan - .. image:: img/thumbnail.png - :width: 480px - :alt: grid_scan + + .. figure:: img/thumbnail.png + :figwidth: 100% + :alt: grid_scan_animation + :target: https://www.youtube.com/watch?v=CNRGutasp0c - Methods for processing helical scans (with/without the offset rotation-axis). - .. image:: img/helical_scan.jpg - :width: 480px + .. figure:: img/helical_scan.jpg + :figwidth: 100% :alt: helical_scan - Methods for determining the center-of-rotation (COR) and auto-stitching images @@ -38,8 +40,8 @@ follows: - Methods in a full data processing pipeline: reading-writing data, pre-processing, tomographic reconstruction, and post-processing. - .. image:: img/data_processing_space.png - :width: 480px + .. figure:: img/data_processing_space.png + :figwidth: 100% :alt: data_processing_space - Some practical methods developed and implemented for the package: @@ -48,8 +50,8 @@ follows: and double-wedge filter for removing sample parts larger than the FOV in a sinogram. - .. image:: img/double_wedge_filter.jpg - :width: 480px + .. figure:: img/double_wedge_filter.jpg + :figwidth: 100% :alt: double_wedge_filter - Utility methods for customizing ring/stripe artifact removal methods and @@ -59,8 +61,8 @@ follows: - Methods for generating simulation data: phantom creation, sinogram calculation based on the Fourier slice theorem, and artifact generation. - .. image:: img/simulation.png - :width: 480px + .. figure:: img/simulation.png + :figwidth: 100% :alt: simulation .. contents:: Contents: diff --git a/docs/source/highlights.rst b/docs/source/highlights.rst index 12e5c36..cd19bd0 100644 --- a/docs/source/highlights.rst +++ b/docs/source/highlights.rst @@ -5,7 +5,7 @@ Highlights Algotom was used for some experiments featured on media: * Scanning `Moon rocks and Martian meteorites `_ - using helical scans with offset rotation-axis. Featured on `Reuters `_. + using helical scans with offset rotation-axis. Featured on `Reuters `_. * Scanning `Herculaneum Scrolls `_ using grid scans with offset rotation-axis respect to the grid's FOV. Featured on `BBC `_. * Scanning `Little Foot fossil `_ diff --git a/docs/source/index.rst b/docs/source/index.rst index d3e0e1a..95050c1 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -5,7 +5,7 @@ Algotom Data processing (**ALGO**)rithms for (**TOM**)ography .. image:: img/logo.png - :width: 320px + :width: 50% :alt: logo **Algotom** is a Python package implementing methods for processing tomographic @@ -51,7 +51,6 @@ Content features install usage - demo api highlights credits diff --git a/docs/source/install.rst b/docs/source/install.rst index 382d906..dc5adbe 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -9,7 +9,7 @@ From source ----------- Clone the `Algotom `_ -from `GitHub `_ repository:: +from Github repository:: git clone https://github.com/algotom/algotom.git algotom @@ -44,7 +44,7 @@ Install Miniconda as instructed above. If install to an existing environment:: - pip install algotom` + pip install algotom If install to a new environment:: diff --git a/docs/source/usage.rst b/docs/source/usage.rst index 588ba51..730e9cb 100644 --- a/docs/source/usage.rst +++ b/docs/source/usage.rst @@ -1,21 +1,35 @@ +===== Usage ------ +===== -* Examples of how to use the package are in the examples folder of `Algotom `_. They cover most of use-cases which users can adapt to process their own data. +- Examples of how to use the package are in the examples folder of `Algotom `_. They cover most of use-cases which users can adapt to process their own data. + + :download:`explore_hdf_tomo_data.py <../../docs/demo/example_01_explore_hdf_tomo_data.py>` + + :download:`reconstruct_360_degree_scan_with_offset_center.py <../../docs/demo/example_02_reconstruct_360_degree_scan_with_offset_center.py>` + + :download:`reconstruct_few_slices_grid_scan_with_offset_center.py <../../docs/demo/example_03_reconstruct_few_slices_grid_scan_with_offset_center.py>` + + :download:`reconstruct_helical_scan_with_offset_center.py <../../docs/demo/example_04_reconstruct_helical_scan_with_offset_center.py>` + + :download:`reconstruct_std_scan_full_size.py <../../docs/demo/example_05_reconstruct_std_scan_full_size.py>` + + :download:`reconstruct_std_scan.py <../../docs/demo/example_05_reconstruct_std_scan.py>` + + :download:`reconstruct_std_scan_with_distortion_correction.py <../../docs/demo/example_06_reconstruct_std_scan_with_distortion_correction.py>` + + :download:`full_reconstruction_a_grid_scan_step_01.py <../../docs/demo/example_07_full_reconstruction_a_grid_scan_step_01.py>` + + :download:`full_reconstruction_a_grid_scan_step_02.py <../../docs/demo/example_07_full_reconstruction_a_grid_scan_step_02.py>` + + :download:`full_reconstruction_a_grid_scan_step_03_downsample.py <../../docs/demo/example_07_full_reconstruction_a_grid_scan_step_03_downsample.py>` + + :download:`generate_simulation_data.py <../../docs/demo/example_08_generate_simulation_data.py>` + + :download:`generate_tilted_sinogram.py <../../docs/demo/example_09_generate_tilted_sinogram.py>` + + :download:`pre_process_data_in_the_projection_space.py <../../docs/demo/example_10_pre_process_data_in_the_projection_space.py>` -* Real tomographic data for testing methods can be downloaded from `zenodo `_. +- Real tomographic data for testing methods can be downloaded from `zenodo `_. -* Methods can also be tested using simulation data as shown in "examples/example_08*.py" +- Methods can also be tested using simulation data as shown in "examples/example_08*.py" -* Users can use `Algotom `_ to re-process some old data collected at synchrotron facilities suffering from: +- Users can use Algotom to re-process some old data collected at synchrotron facilities suffering from: + + Various types of `ring artifacts `_ + + Cupping artifacts (also known as beam hardening artifacts) which are caused by using: + FFT-based reconstruction methods without proper padding; polychromatic X-ray sources; + or low-dynamic-range detectors to record high-dynamic-range projection-images. - * Various types of `ring artifacts `_. - * Cupping artifacts (also known as beam hardening artifacts) which are caused by using: FFT-based reconstruction methods without proper padding; polychromatic X-ray sources; or low-dynamic-range detectors to record high-dynamic-range projection-images. - -Methods distributed in Algotom can run on a normal computer which enable users to process these data locally. +- Methods distributed in Algotom can run on a normal computer which enable users to process these data locally. -* There are tools and `methods `_ users can use to customize their own algorithms: - - * Methods to transform images back-and-forth between the polar coordinate system and the Cartesian coordinate system. - * Methods to separate stripe artifacts. - * Methods to transform back-and-forth between reconstruction images and sinogram images. +- There are tools and `methods `_ users can use to customize their own algorithms: + + Methods to transform images back-and-forth between the polar coordinate system and the Cartesian coordinate system. + + Methods to separate stripe artifacts. + + Methods to transform back-and-forth between reconstruction images and sinogram images.