Skip to content

utilities

Neil Horner edited this page Oct 16, 2019 · 17 revisions

Utility scripts

There are a few scripts available with LAMA for doing various tasks

convert_16 bit images to 8 bit

The CT data can often be in 16bit format. You may way want to convert a folder of images to 8bit in order to reduce memory usage during registration.

# If -i and -o are the same, the inputs will be clobbered.
$ lama_convert_16_to_8 -i <input_dir> -oi <output_dir>

Padding multiple volumes to the same dimensions

The Lama pipeline requires that all input volumes have the same dimensions

# To pad a series of volumes in-place
# This will overwrite the input volumes with the padded volumes
# Multiple directories can be passed with the -i option
$ lama_pad_volumes -i dir1 dir2 --clobber

# To pad a series of volumes and write to new directory
$ lama_pad_volumes -i dir1 dir2 --outdir new_dir

# Instead of padding to the maximum size of each dimension across all images
# use the -d option to specify dimesion sizes (xyz)
$ lama_pad_volumes -i dir1 dir2 --outdir new_dir -d 100 200 300

Get basic information from multiple volumes

Get info from volumes in current working directory

lama_img_info.py

Get info from volumes in specified directory

lama_img_info.py -i volume directory

The output csv will be printed to screen

name, size, z, y, x, min, max, mean, spacing, origin, dtype, num 1s 1.nrrd, 410176, 116, 68, 52, 0, 193, 10.484, "(1.0, 1.0, 1.0)", "(0.0, 0.0, 0.0)", uint8, 62 2.nrrd, 410176, 116, 68, 52, 0, 184, 10.749, "(1.0, 1.0, 1.0)", "(0.0, 0.0, 0.0)", uint8, 3298 3.nrrd, 410176, 116, 68, 52, 0, 152, 15.184, "(1.0, 1.0, 1.0)", "(0.0, 0.0, 0.0)", uint8, 6066 or to save CSV to file: -o