Skip to content

Commit bab6757

Browse files
authored
Merge branch 'main' into cupy-update-radway-65
2 parents f042d84 + e0a5808 commit bab6757

30 files changed

+500
-67
lines changed

docs/source/backends/templates.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ These are archived YAML templates that can be used with already released and tag
2121
:download:`HTTomo version 2.5 templates <../templates_archive/httomo_ver2_5_yaml_templates.zip>`
2222

2323
:download:`HTTomo version 2.6 templates <../templates_archive/httomo_ver2_6_yaml_templates.zip>`
24+
25+
:download:`HTTomo version 3.0 templates <../templates_archive/httomo_ver3_0_yaml_templates.zip>`
2426

2527
.. _latest_templates:
2628

docs/source/howto/run_httomo.rst

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,15 @@ directory created by HTTomo would be
235235
Options/flags
236236
#############
237237

238-
The :code:`run` command has 16 options/flags:
238+
The :code:`run` command has 17 options/flags:
239239

240240
- :code:`--output-folder-name`
241241
- :code:`--save-all`
242242
- :code:`--gpu-id`
243243
- :code:`--reslice-dir`
244244
- :code:`--max-cpu-slices`
245245
- :code:`--max-memory`
246+
- :code:`--save-snapshots`
246247
- :code:`--monitor`
247248
- :code:`--monitor-output`
248249
- :code:`--intermediate-format`
@@ -364,6 +365,22 @@ The :code:`--max-memory` flag is for telling HTTomo how much RAM the machine has
364365
so then it can switch to using a file during execution of the pipeline if
365366
necessary.
366367

368+
:code:`--save-snapshots`
369+
~~~~~~~~~~~~~~~~~~~~~~~~
370+
371+
When this flag is enabled, the pipeline saves image snapshots at specific execution points.
372+
These snapshots are captured during selected methods - typically when a section boundary
373+
is reached and data is transferred to the CPU. At which time a slice of the data is saved for
374+
inspection.
375+
376+
This feature is particularly useful for complex pipelines (e.g. 360 degrees with stitching and phase contrast),
377+
where intermediate processing steps involved in reconstruction may unintentionally alter
378+
the data. By reviewing these snapshot images (JPEGs), users can more easily pinpoint
379+
where issues are introduced in the pipeline.
380+
381+
Enabling snapshots incurs almost no additional computational cost, unlike the :code:`--save-all`
382+
flag, which requires saving the entire dataset into a file for each method.
383+
367384
:code:`--monitor`
368385
~~~~~~~~~~~~~~~~~
369386

docs/source/pipelines/yaml.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ These are archived full YAML pipelines that can be used with already released an
2222
:download:`HTTomo version 2.5 full YAML pipelines <../templates_archive/httomo_ver2_5_full_yaml_pipelines.zip>`
2323

2424
:download:`HTTomo version 2.6 full YAML pipelines <../templates_archive/httomo_ver2_6_full_yaml_pipelines.zip>`
25+
26+
:download:`HTTomo version 3.0 full YAML pipelines <../templates_archive/httomo_ver3_0_full_yaml_pipelines.zip>`
2527

2628

2729
.. warning:: At DLS, the templates below should work with the :code:`httomo/latest` module, however, for production please use :ref:`full_pipelines_archived`.
@@ -109,4 +111,4 @@ One can build CPU-only pipelines by using mostly TomoPy methods.
109111
.. dropdown:: CPU pipeline using auto-centering and the gridrec reconstruction method from TomoPy.
110112

111113
.. literalinclude:: ../pipelines_full/tomopy_gridrec.yaml
112-
:language: yaml
114+
:language: yaml
Binary file not shown.
54.6 KB
Binary file not shown.

docs/source/utilities/yaml_checker.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ other fields directly under the :code:`parameters` field.
9292
* We check methods exist for the given module path.
9393
* We check that the parameters for each method are valid. For example, :code:`find_center_vo` method from :code:`tomopy.recon.rotation` takes :code:`ratio` as a parameter with a float value. If you pass a string instead, it will raise an error. Again the trick is to refer the documentation always.
9494
* We check the required parameters for each method are present.
95+
* We check parameters that are omitted are not required (in particular, that omitted parameters
96+
have a default value that can be assumed)
9597
* If you pass :code:`IN_DATA` (path to the data) along with the yaml config, as:
9698

9799
.. code-block:: console

httomo/cli.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from httomo.runner.task_runner import TaskRunner
2222
from httomo.ui_layer import UiLayer, PipelineFormat
2323

24-
2524
try:
2625
from . import __version__
2726
except:
@@ -137,6 +136,11 @@ def check(pipeline: Union[Path, str], in_data_file: Optional[Path] = None):
137136
default="0",
138137
help="Limit the amount of memory used by the pipeline to the given memory (supports strings like 3.2G or bytes)",
139138
)
139+
@click.option(
140+
"--save-snapshots",
141+
is_flag=True,
142+
help="Save intermediate images (snapshots) from some methods in the pipeline.",
143+
)
140144
@click.option(
141145
"--monitor",
142146
type=click.STRING,
@@ -212,6 +216,7 @@ def run(
212216
reslice_dir: Union[Path, None],
213217
max_cpu_slices: int,
214218
max_memory: str,
219+
save_snapshots: bool,
215220
monitor: List[str],
216221
pipeline_format: str,
217222
monitor_output: TextIO,
@@ -265,6 +270,7 @@ def run(
265270
monitor,
266271
monitor_output,
267272
reslice_dir,
273+
save_snapshots,
268274
)
269275
else:
270276
execute_sweep_run(pipeline, global_comm)
@@ -398,6 +404,7 @@ def execute_high_throughput_run(
398404
monitor: List[str],
399405
monitor_output: TextIO,
400406
reslice_dir: Union[Path, None],
407+
save_snapshots: bool,
401408
) -> None:
402409
# we use half the memory for blocks since we typically have inputs/output
403410
memory_limit = transform_limit_str_to_bytes(max_memory) // 2
@@ -416,6 +423,7 @@ def execute_high_throughput_run(
416423
global_comm,
417424
monitor=mon,
418425
memory_limit_bytes=memory_limit,
426+
save_snapshots=save_snapshots,
419427
)
420428
runner.execute()
421429
if mon is not None:

httomo/data/dataset_store.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ def aux_data(self) -> AuxiliaryData:
117117
def write_block(self, block: DataSetBlock):
118118
if self._readonly:
119119
raise ValueError("Cannot write after creating a reader")
120-
block.to_cpu()
121120
start = max(block.chunk_index_unpadded)
122121
if self._data is None:
123122
# if non-slice dims in block are different, update the shapes here
@@ -284,7 +283,19 @@ def __init__(
284283
self._slicing_dim = source.slicing_dim
285284
self._data = source_data
286285
else:
286+
start = time.perf_counter()
287287
self._data = self._reslice(source.slicing_dim, slicing_dim, source_data)
288+
end = time.perf_counter()
289+
if slicing_dim == 1:
290+
log_once(
291+
f"Slicing axis change (reslice) from projection to sinogram took {(end - start):.9f}s.",
292+
level=logging.INFO,
293+
)
294+
else:
295+
log_once(
296+
f"Slicing axis change (reslice) from sinogram to projection took {(end - start):.9f}s.",
297+
level=logging.INFO,
298+
)
288299
self._slicing_dim = slicing_dim
289300

290301
self._padding = (0, 0) if padding is None else padding
@@ -343,7 +354,7 @@ def _reslice(
343354
array, newdim, startidx = reslice(
344355
data, old_slicing_dim + 1, new_slicing_dim + 1, self._comm
345356
)
346-
self._chunk_shape = array.shape # type: ignore
357+
self._chunk_shape = array.shape # type: ignore
347358
assert newdim == new_slicing_dim + 1
348359
idx = [0, 0, 0]
349360
idx[new_slicing_dim] = startidx

httomo/data/mpiutil.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from httomo.utils import log_once
99

10-
1110
__all__ = ["alltoall", "alltoall_ring"]
1211

1312

httomo/data/padding.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
from httomo.preview import PreviewConfig
77

8-
98
DIMS = [0, 1, 2]
109

1110

0 commit comments

Comments
 (0)