diff --git a/httomo_backends/methods_database/packages/backends/httomolibgpu/httomolibgpu.yaml b/httomo_backends/methods_database/packages/backends/httomolibgpu/httomolibgpu.yaml index 1dbe824d..2e96a663 100644 --- a/httomo_backends/methods_database/packages/backends/httomolibgpu/httomolibgpu.yaml +++ b/httomo_backends/methods_database/packages/backends/httomolibgpu/httomolibgpu.yaml @@ -66,6 +66,15 @@ misc: memory_gpu: multiplier: None method: module + average_projection_frames: + pattern: sinogram + output_dims_change: True + implementation: gpu_cupy + save_result_default: False + padding: False + memory_gpu: + multiplier: 2.1 + method: direct rescale: rescale_to_int: pattern: all diff --git a/httomo_backends/methods_database/packages/backends/httomolibgpu/supporting_funcs/misc/morph.py b/httomo_backends/methods_database/packages/backends/httomolibgpu/supporting_funcs/misc/morph.py index 9b78eb27..20c95b39 100644 --- a/httomo_backends/methods_database/packages/backends/httomolibgpu/supporting_funcs/misc/morph.py +++ b/httomo_backends/methods_database/packages/backends/httomolibgpu/supporting_funcs/misc/morph.py @@ -25,13 +25,18 @@ from typing import Tuple import numpy as np -from httomolibgpu.misc.morph import data_resampler, sino_360_to_180 +from httomolibgpu.misc.morph import ( + data_resampler, + sino_360_to_180, + average_projection_frames, +) __all__ = [ "_calc_memory_bytes_data_resampler", "_calc_output_dim_data_resampler", "_calc_memory_bytes_sino_360_to_180", "_calc_output_dim_sino_360_to_180", + "_calc_output_dim_average_projection_frames", ] @@ -39,6 +44,16 @@ def _calc_output_dim_data_resampler(non_slice_dims_shape, **kwargs): return kwargs["newshape"] +def _calc_output_dim_average_projection_frames(non_slice_dims_shape, **kwargs): + k: float = kwargs["projection_averaging_factor"] + + n_proj = non_slice_dims_shape[0] + n_full = n_proj // k + remainder = n_proj % k + n_out = n_full + (remainder > 0) + return n_out, non_slice_dims_shape[1] + + def _calc_memory_bytes_data_resampler( non_slice_dims_shape: Tuple[int, int], dtype: np.dtype, diff --git a/httomo_backends/pipelines_full/angles_averaging_directive.yaml b/httomo_backends/pipelines_full/angles_averaging_directive.yaml new file mode 100644 index 00000000..bfe4df51 --- /dev/null +++ b/httomo_backends/pipelines_full/angles_averaging_directive.yaml @@ -0,0 +1,20 @@ +- method: standard_tomo + module_path: httomo.data.hdf.loaders +- method: remove_outlier + module_path: httomolibgpu.misc.corr +- method: dark_flat_field_correction + module_path: httomolibgpu.prep.normalize +- method: find_center_vo + module_path: httomolibgpu.recon.rotation +- method: average_projection_frames + module_path: httomolibgpu.misc.morph +- method: minus_log + module_path: httomolibgpu.prep.normalize +- method: LPRec3d_tomobar + module_path: httomolibgpu.recon.algorithm +- method: calculate_stats + module_path: httomo.methods +- method: rescale_to_int + module_path: httomolib.misc.rescale +- method: save_to_images + module_path: httomolib.misc.images diff --git a/httomo_backends/scripts/yaml_pipelines_generator.py b/httomo_backends/scripts/yaml_pipelines_generator.py index ecf6f43f..efe059d5 100644 --- a/httomo_backends/scripts/yaml_pipelines_generator.py +++ b/httomo_backends/scripts/yaml_pipelines_generator.py @@ -221,6 +221,13 @@ def yaml_pipelines_generator( key="path_to_stiched_params_file", comment="Provide an absolute path to the text file with seam index and blending width.", ) + elif "average_projection_frames" in method_name: + pipeline_full.yaml_set_comment_before_after_key( + i, + "--- Apply averaging of projection data in the angular dimension. --- ", + indent=0, + ) + pipeline_full += yaml_template_method elif "data_resampler" in method_name: pipeline_full.yaml_set_comment_before_after_key( i,