KipTool manual: CLI - neutronimaging/imagingsuite GitHub Wiki

The CLI interface

KipTool can also be operated from the command line. This is convenient when you want to process many images of the same type or to save memory when you work with large images. The CLI version doesn't have to keep the original image for comparison as in the GUI. CLI processing requires that you have a process script file. The process script file is saved with the processed images or you can also get the last used settings in the folder .imagingtools in your home folder, e.g. /Users/<username>/.imagingtools. The typical workflow is that you tune your processing using the GUI and then save the configuration to file. Once you have this file you can start KipTool with kiptool -f <configfile.xml>

Invoking KipTool from a python script

You can also call KipTool from a pythhon script. Just adapt the example below by replacing the placeholders between <...> in the script.

import os
from subprocess import call

kiptool = "<path to the kiptool folder>\\KipToolCLI.exe"
cfgpath = "<path to config file>/kiptoolcfg.xml"

# Data paths
srcdatapath = <full path to the data root folder>
dstdatapath = <full path to the processed data root folder>

first = 0    # index of first data folder 
last  = 15   # index of the last data folder

for idx in range(first,last+1) : 
    # define the file mask
    srcfilemask = "image:srcfilemask={0}\frame_{1:04}\slice_####.tif".format(srcdatapath,idx)
    dstpath     = "outimage:dstpath={0}\frame_{1:04}\".format(dstdatapath,idx)

    # you may also want to reformat the out file name "dstfilemask", do this in the same manner.

    # set file mask for the slices
    call([kiptool, "-f", cfgpath, srcfilemask, dstpath])

Return to TOC

⚠️ **GitHub.com Fallback** ⚠️