Volume Predicate

The Volume Predicate slang encapsulates the semantics of a logical query in subroutines. It is a procedural DSL for the specification of logical predicates that are executed in parallel and either yield true or false for each voxel. This slang is used to program queries that might be tailored to the application domain and the data sets under investigation. The result of a volume query is a binary volume, which is called vset in ViSlang.

Grammar

predicate pred-name [ voxel-declaration ] (arg-list) { statement-list }

The arg-list is a list of user specified arguments, and the statement-list is a list of statements including declarations, assignments, if statements, predicate calls, function calls, for loops, and return statements. The voxel-declaration is specified as follows:

voxel voxel-name in volume-name

Example

Volume Predicate
using VolumePredicate; predicate distanceLess[voxel vox in v] (float x, float y, float z, float dist) { float d = (vox.x-x)*(vox.x-x) + (vox.y-y)*(vox.y-y) + (vox.z-z)*(vox.z-z); return (sqrt(d) < dist); } predicate valueAbove[voxel vox in v] (float thresh) { return (vox.value>thresh); }

Copyright © 2015-2017 vislang.net