Repository: DiamondLightSource/httomo (language: python)

Issue:
Add more documentation on Padding
Padding should be a part of [HTTomo Features](https://diamondlightsource.github.io/httomo/howto/httomo_features.html). 


Discussion / hints:

Fix patch:
diff --git a/docs/source/_static/padding/denoising2d.jpg b/docs/source/_static/padding/denoising2d.jpg
new file mode 100644
index 000000000..8432f90f1
Binary files /dev/null and b/docs/source/_static/padding/denoising2d.jpg differ
diff --git a/docs/source/_static/padding/denoising3d_pad5.jpg b/docs/source/_static/padding/denoising3d_pad5.jpg
new file mode 100644
index 000000000..9d0db1202
Binary files /dev/null and b/docs/source/_static/padding/denoising3d_pad5.jpg differ
diff --git a/docs/source/_static/wrappers/wrappers.png b/docs/source/_static/wrappers/wrappers.png
new file mode 100644
index 000000000..20e29e8af
Binary files /dev/null and b/docs/source/_static/wrappers/wrappers.png differ
diff --git a/docs/source/howto/httomo_features.rst b/docs/source/howto/httomo_features.rst
index dd49427bb..f5a8fb03b 100644
--- a/docs/source/howto/httomo_features.rst
+++ b/docs/source/howto/httomo_features.rst
@@ -7,5 +7,6 @@ HTTomo Features
    httomo_features/previewing
    httomo_features/centering
    httomo_features/parameter_sweeping
+   httomo_features/padding
 
 
diff --git a/docs/source/howto/httomo_features/centering.rst b/docs/source/howto/httomo_features/centering.rst
index 991dde21c..f26467c08 100644
--- a/docs/source/howto/httomo_features/centering.rst
+++ b/docs/source/howto/httomo_features/centering.rst
@@ -81,7 +81,7 @@ Here are the steps to enable the auto-centering and then use the estimated value
     module_path: httomolibgpu.recon.algorithm
     parameters:
       center: ${{centering.side_outputs.centre_of_rotation}}
-      filter_freq_cutoff: 0.6
+      filter_freq_cutoff: 1.1
       recon_size: null
       recon_mask_radius: null
 
diff --git a/docs/source/howto/httomo_features/padding.rst b/docs/source/howto/httomo_features/padding.rst
new file mode 100644
index 000000000..e4dc67fbd
--- /dev/null
+++ b/docs/source/howto/httomo_features/padding.rst
@@ -0,0 +1,31 @@
+.. default-role:: math
+.. _padding:
+
+Padding
+^^^^^^^
+
+Padding is an important feature of HTTomo when performing computations on :ref:`chunks_data` and :ref:`blocks_data`.
+If the method is a 2D method (work with 2D frames), e.g., a denoising filter, then the data does not require any padding as 
+the boundary conditions between blocks will not be violated. However, when the method is a 3D method and it works 
+with 3D volumes, then in order to satisfy boundary conditions and avoid artefacts, one needs to pad blocks. 
+
+How this can be useful?
+=======================
+
+It is useful because when padding feature exists one can use true fully 3D methods which provide a consistent resolution in
+all three dimensions, see the image below. Because of the access to 3D data, one can perform better in removing artefacts,
+improving contrast, etc. 
+
+.. list-table:: 
+
+    * - .. figure:: ../../_static/padding/denoising2d.jpg
+           :scale: 20 %
+
+           2D denoising applied to 3D data, note the resolution inconsistency in the vertical direction.
+
+      - .. figure:: ../../_static/padding/denoising3d_pad5.jpg 
+           :scale: 20 %
+
+           3D denoising applied to 3D data. The resolution is consistent in all three dimensions.
+
+.. note:: With padding enabled, HTTomo can perform more state-of-the-art filtering techniques as well as advanced iterative reconstruction in 3D.
\ No newline at end of file
diff --git a/docs/source/howto/process_lists/side_outputs/side_out.rst b/docs/source/howto/process_lists/side_outputs/side_out.rst
index f20f7d4e0..e5ad105e8 100644
--- a/docs/source/howto/process_lists/side_outputs/side_out.rst
+++ b/docs/source/howto/process_lists/side_outputs/side_out.rst
@@ -58,7 +58,7 @@ information of :ref:`centering` is stored in the reference
     module_path: httomolibgpu.recon.algorithm
     parameters:
       center: ${{centering.side_outputs.centre_of_rotation}}
-      filter_freq_cutoff: 0.6
+      filter_freq_cutoff: 1.1
       recon_size: null
       recon_mask_radius: null
 
@@ -103,16 +103,16 @@ extract the global statistics for normalisation of the data using the
 
 .. literalinclude:: ../../../../../tests/samples/pipeline_template_examples/pipeline_360deg_gpu2.yaml
   :language: yaml
-  :lines: 1-71
-  :emphasize-lines: 18,19,20,21,22,23,45,50,58,59,60,71
+  :lines: 1-79
+  :emphasize-lines: 18,19,20,21,22,23,44,49,63,64,65,72
   :caption: Pipeline for 360 degrees scan, a double field of view (DFoV) data.
 
 Please see below for a concise description of how each of the individual side
 outputs of methods are connected to the method using them:
 
 1. :code:`find_center_360` produces a side output called :code:`overlap` that the
-   :code:`sino_360_to_180` method uses
+   :code:`sino_360_to_180` method uses.
 2. :code:`find_center_360` produces another side output called
-   :code:`centre_of_rotation` that the :code:`FBP` method uses
+   :code:`centre_of_rotation` that the :code:`FBP` method uses.
 3. :code:`calculate_stats` produces a side output called :code:`glob_stats` that
-   the :code:`save_to_images` method uses
+   the :code:`rescale_to_int` method uses.
diff --git a/docs/source/introduction/indepth/wrappers.rst b/docs/source/introduction/indepth/wrappers.rst
index 6c07cc529..9a102cb56 100644
--- a/docs/source/introduction/indepth/wrappers.rst
+++ b/docs/source/introduction/indepth/wrappers.rst
@@ -18,3 +18,9 @@ HTTomo currently has the following wrappers:
 
 5. Image Saving wrapper. This wrapper is needed because no output in HTTomo is produced, we just save images to the disk.
 
+.. _fig_wrappers:
+.. figure::  ../../_static/wrappers/wrappers.png
+    :scale: 40 %
+    :alt: Different wrappers of HTTomo
+
+    Wrappers of HTTomo deal with the i/o differences in methods from the external libraries.
diff --git a/docs/source/pipelines/yaml.rst b/docs/source/pipelines/yaml.rst
index e56ce2078..5a74296ed 100644
--- a/docs/source/pipelines/yaml.rst
+++ b/docs/source/pipelines/yaml.rst
@@ -21,7 +21,7 @@ CPU Pipeline templates
 
 .. dropdown:: This pipeline shows how "calculate_stats" module extracts global statistics in order to be passed to "save_to_images" function which uses it to rescale data for saving images
 
-    .. literalinclude:: ../../../tests/samples/pipeline_template_examples/pipeline_cpu2.yaml
+    .. literalinclude:: ../../../tests/samples/pipeline_template_examples/pipeline_cpu3.yaml
 
 .. _tutorials_pl_templates_gpu:
 


Test patch:
diff --git a/tests/samples/pipeline_template_examples/DLS/01_diad_pipeline_gpu.yaml b/tests/samples/pipeline_template_examples/DLS/01_diad_pipeline_gpu.yaml
index f453f81d0..fc3bbc3e9 100644
--- a/tests/samples/pipeline_template_examples/DLS/01_diad_pipeline_gpu.yaml
+++ b/tests/samples/pipeline_template_examples/DLS/01_diad_pipeline_gpu.yaml
@@ -6,12 +6,10 @@
     image_key_path: /entry/instrument/imaging/image_key
     rotation_angles:
         data_path: /entry/imaging_sum/gts_theta_value
-    dimension: 1
     preview:
       detector_y:
         start: 8
         stop: 15
-    pad: 0
 - method: find_center_vo
   module_path: httomolibgpu.recon.rotation
   parameters:
diff --git a/tests/samples/pipeline_template_examples/pipeline_360deg_iterative_gpu3.yaml b/tests/samples/pipeline_template_examples/pipeline_360deg_iterative_gpu3.yaml
index 6978b5730..24a3ed878 100644
--- a/tests/samples/pipeline_template_examples/pipeline_360deg_iterative_gpu3.yaml
+++ b/tests/samples/pipeline_template_examples/pipeline_360deg_iterative_gpu3.yaml
@@ -6,13 +6,10 @@
     image_key_path: entry1/tomo_entry/instrument/detector/image_key
     rotation_angles:
       data_path: /entry1/tomo_entry/data/rotation_angle
-    dimension: 1
     preview:
-      -
-      - start: 1000
+      detector_y:
+        start: 1000
         stop: 1005
-      -
-    pad: 0
 - method: find_center_360
   module_path: httomolibgpu.recon.rotation
   parameters:
@@ -67,14 +64,17 @@
   id: statistics
   side_outputs:
     glob_stats: glob_stats
+- method: rescale_to_int
+  module_path: httomolibgpu.misc.rescale
+  parameters:
+    perc_range_min: 0.0
+    perc_range_max: 100.0
+    bits: 8
+    glob_stats: ${{statistics.side_outputs.glob_stats}}
 - method: save_to_images
   module_path: httomolib.misc.images
   parameters:
     subfolder_name: images
     axis: auto
     file_format: tif
-    bits: 8
-    perc_range_min: 0.0
-    perc_range_max: 90.0
     jpeg_quality: 95
-    glob_stats: ${{statistics.side_outputs.glob_stats}}