User manuals MuhRec BatchProcessing - neutronimaging/imagingsuite GitHub Wiki

Return to TOC

Reconstructing multiple volumes efficiently

Introduction

The script shown on the reconstruct from CLI page requires some thinking and coding to put it in order. Batch processing was developed to reduce the need for programming. Instead, you'll need to provide only a file describing the batches to reconstruct.

Prerequisites

You need the following to run the batch scripts:

The batch description file

The batches to process are described in a json formatted file with the following format

[{
        "name" : "Reconstruction 1",
        "config" : "path/to/template/reconconfig.xml",
        "arguments" : {
            "parameter 1" : "value 1",
            "parameter 2": "value 2",
            "parameter 3": "1 2 3 4 5"
        }
    }
]

As you can see a list of entries and it is important to use the opening and closing brackets [...] and each batch block must be separated by commas ,.

The elements of a batch file

name

The name element is only a label to describe the current batch. The value can be anything.

config

The config element is the path to the reconstruction configuration file you want to base the reconstruction upon. This file is generated by muhrec every time you reconstruct some data and stored in \your\home\folder\.imagingtools\CurrentRecon.xml. It is also saved in the same folder as your reconstructed slices when you save in the muhrec GUI.

arguments

The arguments are the parameters you want to change for the reconstruction batch. The arguments override the parameters in the reconconfig.xml file. It is often the projection data path, destination path, the first and last projection index, etc.

Currently, it is only possible to manipulate the parameters in the <system>, <projections>, and <matrix> blocks of the ReconConfig.xml file. The <processing> and <backprojector> blocks can't be manipulated.

There is a list of arguments on the CLI operation manual page.

A full batch file example

[{
        "name" : "recon1",
        "config" : "path/to/template/reconconfig.xml",
        "arguments" : {
            "projections:filemask" : "path/to/data/image_####.tif",
            "matrix:path": "path/to/matrix/destination",
            "matrix:matrixname": "slice_####.tif",
            "projections:firstindex": 1,
            "projections:lastindex" : 100,
            "projections:direction" : "CW",
            "projections:scanarc0" : 0.0,
            "projections:scanarc1" : 180.0          
        }
    },
    {
        "name" : "recon2",
        "config" : "path/to/template/reconconfig.xml",
        "arguments" : {
            "projections:filemask" : "path/to/data/image_####.tif",
            "matrix:path": "path/to/matrix/destination",
            "matrix:matrixname": "slice_####.tif",
            "projections:firstindex": 101,
            "projections:lastindex" : 200,
            "projections:direction" : "CW",
            "projections:scanarc0" : 180.0,
            "projections:scanarc1" : 360.0          
        }
    }
]

Starting the batch processing

The batch_runner script runs a set of reconstruction batches using MuhRec. The batches are specified in a JSON file using the format described above.

Usage

To run the batch_runner, you need a terminal window with an available Python installation.

python batch_runner.py [-h] [-b BATCHFILE] [-m MUHRECPATH]

Options

Short Long Description
-h --help Show a help message and exit
-b BATCHFILE --batchfile BATCHFILE A JSON file with batch descriptions.
-m MUHRECPATH --muhrecpath MUHRECPATH Path to the muhrec executable.

Generate a batches from longer series

Prepares a set of reconstruction batches for the batch_runner. The batches are created from a longer series of projections like a golden ratio or a multiple-turn scan. The script produces batches with a given number of projections. This script reduces the risk of typing error while creating the batch file for series.

Usage

python goldenbatch.py [-h] [-t TEMPLATE] [-s STEP] [-f FIRST] [-l LAST] [-o OUTPUT]

Options

Short Long Description
-h --help Show a help message and exit
-t TEMPLATE --template TEMPLATE A json file with batch descriptions. The first batch will be used as template for the generated sequence
-s STEP --step STEP Number of projections to reconstruct in a batch.
-f FIRST --first FIRST The index of the first projection.
-l LAST --last LAST The index of the last projection.
-o OUTPUT --output OUTPUT The name of the produced batch file.
⚠️ **GitHub.com Fallback** ⚠️