The x-ray projection simulator offers hardware accelerated projections for triangle meshed surface data. It enables simulation of x-ray projections with a straight raytracing. The simulator can be embedded in Matlab via a mex-interfaces <br>

The x-ray projection simulator offers hardware accelerated projections for triangle meshed surface data. It enables simulation of x-ray projections with a straight raytracing according to the Beer-Lambert law [1]. The simulator can be embedded in Matlab via a mex-interfaces <br>

Please report bugs and requests for features in the gitlab issue tracker!

...

...

@@ -45,14 +45,15 @@ MATLAB interface:

-**attenuationCoefficentValues**: Attenuation coefficents for regions. The first value will be mapped to region 1 of faces, second value will be mapped with region 2. etc. Format: (1,n) where n needs to be at least the number of regions contained in the faces structure (every attenuation coefficient above the number of regions in faces has no effect)<br/>

- Output:

-**attenuationValues**: the attenuation of the X-rays in format `detectorSizeUint(1)*detectorSizeUint(2)`. <br>

-**attenuationValues**: the summation of attenuation values of the X-rays in format `detectorSizeUint(1)*detectorSizeUint(2)`. <br>

-**profiling**: Output of internal time profiling. It's not necessary for calculation but it does not effect the calculation time much, espacially for big problems.<br/>

//debug

//debugMiss would be possible

Please refer to the easyExample script for explanation of usage of the profiling output.

Should be called for proper Beer-Lambert-calculation, because kernel does not execute exponantiell function, because it just offers single precision.

Since `nv_ray_tracing_basic` provides a summation of the attenuation coefficients along the ray path, only, the resulting values have to be converted according to the Beer-Lambert-law. This is done in the function `attenuationCalculationWrapper`. It performs the exponential function of the beer-lamber law in double precision, in contrast to the `nv_ray_tracing_basic` function, which offers single precision only for fast calculation on GPU.

@@ -63,23 +64,24 @@ Should be called for proper Beer-Lambert-calculation, because kernel does not ex

-**source**: equal to kernel nv_ray_tracing_basic<br/>

-**detectorSizeUint**: equal to kernel nv_ray_tracing_basic<br/>

-**attenuationCoefficentValues**: equal to kernel nv_ray_tracing_basic<br/>

-**photons**: initial photon number. Photon= 1 => result = attenuation value Photon != 1 => result = x-ray strength on detector<br/>

-**photons**: initial photon number. If `photons` == 1 the result is the attenuation value itself. If `photons` != 1 the result is scaled by this value, representingthe x-ray intensity acquired on the detector<br/>

- Output:

-**attenuationValues**: equal to kernel<br/>

-**attenuationPicture**: attenuation values in format of picutre. Picture has the same size as defined with detectorSizeUint<br/>

-**attenuationValues**: equal to kernel nv_ray_tracing_basic<br/>

-**attenuationPicture**: attenuation values re-formated to a 2D image. The image has the same size as defined in input variable detectorSizeUint<br/>

### easyExample

Small example with projection image as result. It shows the process from voxel data to image.

This function represent a small demo resulting in a projection image which is displayed in a new MATLAB figure. It considers the use case in which a polygon mesh is available according to the output format of the iso2mesh toolbox.

```matlab

easyExample("easy",1)

```

- Input:

-**exampleType**: string which example should be shown. "test", "easy", "real"<br/>

-**buildDefault**: is a build needed before? 0 = no build, 1 = build with default settings, see raytracingBuilderWrapper.<br/>

-**exampleType**: represents the string which pre-defined example should be used. Allowed values are "test", "easy" and "real". <br/>

-**buildDefault**: flag whether a build is needed before executing the example. Allowed values are 0 = no build, 1 = build with default settings, see raytracingBuilderWrapper.<br/>

- Output: figure with projection pops up<br/>

- Output: none<br/>

## <a name="howToBuild">How to build it

### raytracingBuilder

...

...

@@ -176,3 +178,6 @@ The debug data from _debugGen_ is already implemented, comes as a linear buffer

The variable _debugMiss_ can be filled by own needs. You implement some comments in the miss shader, e.g. _debug.values[rayPayload.outputId] = n;_ (in this case n shows the number of hits). <br>

It has the same size then _debugGen_ so for each ray, but it has a depth of 200 by default. so the command would be _debugMiss = reshape(debugMiss, [200 detectorSizeUint]);_ to get proper results. Overall it can be used to see which triangles got hit or with which distances.