User manuals MuhRec CLI - neutronimaging/imagingsuite GitHub Wiki

Return to TOC

Reconstructing from the command line

In addition to the GUI you can also start MuhRec from the command line. This can done by typing

muhrec -f parameters.xml

The file parameters.xml contains all settings needed for the reconstruction. This is also the same type of files written by GUI. In appendix an example of the parameter file is given.

The command line option is useful for batch reconstructions. The parameter files for all reconstruction jobs can be prepared with the GUI. In some cases there are only a few parameters that change between the data sets. In this case you can add these parameters on the command line using the format:

muhrec -f parameters.xml block1:parameter1=value1 block2:parameter2=value2 

The block is the xml block in the parameter file (userinformation, system, projections, matrix) and parameter is the parameter you want to modify with value. Please note that each parameter argument must be a single string each space will be interpreted as delimiter for a new argument. Therefore if you want to change an array parameter you have to use "\ldots" to enclose the argument. Eg.

muhrec -f parameters.xml "projections:roi=10 10 100 100" 

Muhrec use less memory when it is operated in CLI mode.

Invoking Muhrec from a script

Sometimes it is convenient to use a script to run muhrec. Here is an example using python. The example uses the CLI interface, which may not be the best way but at least it solves the problem.

#!/usr/bin/env python

from subprocess import call
from math import fmod

projpath="/Volumes/DataDisk/P20140142"
destpath=projpath+"/04_evaluation/20141126"
# path to the application
muhrec="/Users/kaestner/Applications/muhrec.app/Contents/MacOS/muhrec"
cfgpath=projpath+"/04_evaluation/20141126/recon_roots.xml"

firstproj=1;
firstframe=0
lastframe=3
for i in range(firstframe,lastframe) :
	# select projection sub set
	firstindex="projections:firstindex="+str(firstproj+i*180)
	lastindex="projections:lastindex="+str(firstproj+(i+1)*180)
	# set file mask for the slices
	matrixname="matrix:matrixname=frame_"+("%04d" % i)+"-slice_####.tif"
	# adjust the reconstruction angles to alternating between 0-180 and 180-360
	angle=fmod(i,2)*180 
	scanarc="projections:scanarc="+str(angle)+" "+str(angle+180)
	# call the reconstruction
	call([muhrec, "-f", cfgpath, firstindex, lastindex, matrixname, scanarc])

This script assumes that you have a well configured Recon.xml file and that the data is acquired as a long sequence, e.g. a time series of CTs.

Parameter list

User information

userinformation:operator

userinformation:instrument

userinformation:projectnumber

userinformation:sample

userinformation:comment

System

system:memory

system:loglevel

system:validate

system:maxthreads

system:threadmethod

Projections

projections:dims

projections:resolution

projections:binning

projections:margin

projections:firstindex

projections:lastindex

projections:projectionstep

projections:repeatline

projections:scantype

projections:center

projections:translation

projections:tiltangle

projections:tiltpivot

projections:correcttilt

projections:filemask

projections:path

projections:referencepath

projections:obfilemask

projections:obfirstindex

projections:obcount

projections:dcfilemask

projections:dcfirstindex

projections:dccount

projections:roi

projections:projroi

projections:doseroi

projections:scanarc

projections:rotate

projections:flip

projections:direction

projections:sod

projections:sdd

projections:pPoint

projections:skiplistmode

Matrix

matrix:rotation

matrix:serialize

matrix:path

matrix:matrixname

matrix:filetype

matrix:firstindex

matrix:grayinterval

matrix:useroi

matrix:roi

Return to TOC