pytrip.util module

Module with auxilliary functions (mostly internal use).

pytrip.util.evaluator(funct, name='funct')[source]

Wrapper for evaluating a function.

Params str funct:
 string which will be parsed
Params str name:
 name which will be assigned to created function.
Returns:function f build from ‘funct’ input.
pytrip.util.get_class_name(item)[source]
Returns:name of class of ‘item’ object.
pytrip.util.volume_histogram(cube, voi=None, bins=256)[source]

Generic volume histogram calculator, useful for DVH and LVH or similar.

Params cube:a data cube of any shape, e.g. Dos.cube
Params voi:optional voi where histogramming will happen.
Returns [x],[y]:
 coordinates ready for plotting. Dose (or LET) along x, Normalized volume along y in %.

If VOI is not given, it will calculate the histogram for the entire dose cube.

Providing voi will slow down this function a lot, so if in a loop, it is recommended to do masking i.e. only provide Dos.cube[mask] instead.