Z-stitching¶
Since nabu 2024.1.0 nabu provides an API to stitch volume and / or projections
nabu-stitching-config
will help you create a configuration for stitching (like nabu-config
for tomographic reconstruction
nabu-stitching
will execute the configuration
introduction¶
z-stitching can be done over:
- projections (in this case we will speak of pre-processing stitching)
- reconstructed volumes (in this case we will speak about post-processing stitching)
At nabu level most of the code is shared for those two use-case. Diversity comes mostly from getting and interpretting metadata of the scans or of the volumes.
overlaping¶
To process successfully a stitching frames must have an overlaping area
pre processing z-stitching (projections)¶
You can stitch together a z-serie in pre processing by using the PreProcessZStitcher
.
It requires as input a set of Nxtomo.
real life example of z-stitching projections¶
reference used for projection stitching¶
post processing z-stitching (reconstructed volumes)¶
You can stitch together a z-serie in pre processing by using the PostProcessZStitcher
.
It requires as input a set of (reconstructed) volumes.
real life example of z-stitching volumes¶
reference used for volume stitching¶
stitching using the GUI¶
A GUI exists to stitch volumes with a graphical user interface. It is embed with tomwer. See TODO: add link
stitching from the command line interface¶
You can apply stitching from CLI by:
- creating a configuration file
- editing the configuration
- calling
nabu-stitching
with the configuration file
creating a configuration file¶
To create a configuration file you can use the nabu-stitching-config
command
Please mind using the --datasets
options to speed up the configuration file creation
# ! nabu-stitching-config --help
Exercise A:¶
A.1 create a configuration file with NXtomos contained in /data/projects/tomo-sample-data/training/z-stitching/STYLO/PROCESSED_DATA/nxtomos
A.2: edit the configuration to stitch only one slice of the volume
[inputs]
slices = 200
A.3 provide the output path
txt
[z-preproc]
# output nxtomo file path
location = stitching/stitching.nx
# output nxtomo data path
data_path = my_entry
Executing a stitching¶
The processing of stitching configuration is done by calling nabu-stitching
over a stuitching configuration file like:
nabu-stitching [my_stitching_file]
Exercise B:
Execute the stitching configuration created in Exercise A
Warning: first execution execution time: During the first execution of the stitching of NXtomo it will create all reduced_darks
and reduced_flats
. So this calculation can take some time.
Then display the result using silx view
Stitching kernels¶
For the overlap area you can select between several kernels / strategies
You can define this parameter in
txt
[stitching]
# Policy to apply to compute the overlap area. Must be in ('mean', 'cosinus weights', 'linear weights', 'closest', 'image minimum divergence', 'higher signal').
stitching_strategy = cosinus weights
Exercise C: modify the stitching_strategy
of the configuration file and run it again
Distributing¶
When you have a large dataset in order to speed up the stitching you can distribute the stitching over several slurm job.
This distribution is defined in the [slurm]
section. If the slurm section is not present or if the partition
field is empty then the stitching will be done locally.
Else it will be split into n_jobs
. Each job will create is own part and once all job are finished a master file will be created linking all the sub part.
If you are quicked out before the master file could be created you can call nabu-stitching
with the --only-create-master-file
option to only process the master file creation.
Exercise D: distribute some stitching
- reconstruct 20 slices
txt
[inputs]
slices = 100:120
- with 2 jobs
txt
[slurm]
# section didicated to slurm. If you want to run locally avoid setting 'partition or remove this section'
# slurm partition to be used. If empty will run locally
partition = low
# number of job to launch (split computation on N parallel jobs). Once all are finished we will concatenate the result.
n_jobs = 2
- use the
module
tomotools/training_2024
txt
[slurm]
# module to load
modules = tomotools/training_2024