Monte Carlo eXtreme (MCX)
|
MCX configuration header. More...
#include <stdio.h>
#include <vector_types.h>
#include "cjson/cJSON.h"
#include "float.h"
#include "nifti1.h"
Go to the source code of this file.
Classes | |
struct | MCXMedium |
struct | MCXPolarizeMedium |
struct | MCXHistoryHeader |
struct | PhotonReplay |
struct | MCXGPUInfo |
struct | MCXConfig |
Macros | |
#define | EPS FLT_EPSILON |
< use multi-threading for running simulation on multiple GPUs More... | |
#define | VERY_BIG (1.f/FLT_EPSILON) |
#define | MAX_FULL_PATH 2048 |
#define | MAX_PATH_LENGTH 1024 |
#define | MAX_SESSION_LENGTH 256 |
#define | MAX_DEVICE 256 |
#define | MCX_CUDA_ERROR_LAUNCH_FAILED 719 |
#define | MCX_CUDA_ARCH 100 |
#define | MCX_ERROR(id, msg) mcx_error(id,msg,__FILE__,__LINE__) |
#define | MIN(a, b) ((a)<(b)?(a):(b)) |
#define | MAX(a, b) ((a)>(b)?(a):(b)) |
#define | MCX_FPRINTF(fp, ...) fprintf(fp,__VA_ARGS__) |
Typedefs | |
typedef unsigned int | uint |
typedef unsigned short | ushort |
typedef struct MCXMedium | Medium |
typedef struct MCXPolarizeMedium | POLMedium |
typedef struct MCXHistoryHeader | History |
typedef struct PhotonReplay | Replay |
typedef struct MCXGPUInfo | GPUInfo |
typedef struct MCXConfig | Config |
Functions | |
void | mcx_savedata (float *dat, size_t len, Config *cfg) |
Save volumetric output (fluence etc) to mc2 format binary file. More... | |
void | mcx_savenii (float *dat, size_t len, char *name, int type32bit, int outputformatid, Config *cfg) |
Save volumetric output (fluence etc) to an Nifty format binary file. More... | |
void | mcx_error (const int id, const char *msg, const char *file, const int linenum) |
Error reporting function. More... | |
void | mcx_loadconfig (FILE *in, Config *cfg) |
Load user inputs from a .inp input file. More... | |
void | mcx_saveconfig (FILE *in, Config *cfg) |
Save simulation settings to an inp file. More... | |
void | mcx_readconfig (char *fname, Config *cfg) |
Read simulation settings from a configuration file (.inp or .json) More... | |
void | mcx_writeconfig (char *fname, Config *cfg) |
Write simulation settings to an inp file. More... | |
void | mcx_initcfg (Config *cfg) |
Initializing the simulation configuration with default values. More... | |
void | mcx_clearcfg (Config *cfg) |
Clearing the simulation configuration data structure. More... | |
void | mcx_preprocess (Config *cfg) |
Preprocess user input and prepare the cfg data structure. More... | |
void | mcx_parsecmd (int argc, char *argv[], Config *cfg) |
Main function to read user command line options. More... | |
void | mcx_usage (Config *cfg, char *exename) |
Print MCX help information. More... | |
void | mcx_printheader (Config *cfg) |
Print MCX output header. More... | |
void | mcx_loadvolume (char *filename, Config *cfg, int isbuf) |
Load media index data volume (.bin or .vol) to the memory. More... | |
void | mcx_normalize (float field[], float scale, int fieldlen, int option, int pidx, int srcnum) |
Normalize the solution by multiplying a scaling factor. More... | |
void | mcx_kahanSum (float *sum, float *kahanc, float input) |
Kahan summation: Add a sequence of finite precision floating point numbers. More... | |
int | mcx_readarg (int argc, char *argv[], int id, void *output, const char *type) |
Function to read a single parameter value followed by a command line option. More... | |
void | mcx_printlog (Config *cfg, char *str) |
Print a message to the console or a log file. More... | |
int | mcx_remap (char *opt) |
Test if a long command line option is supported. More... | |
void | mcx_maskdet (Config *cfg) |
Pre-label the voxel near a detector for easy photon detection. More... | |
void | mcx_dumpmask (Config *cfg) |
Save the pre-masked volume (with detector ID) to an nii file. More... | |
void | mcx_version (Config *cfg) |
Print MCX software version. More... | |
void | mcx_convertrow2col (unsigned int **vol, uint3 *dim) |
Convert a row-major (C/C++) array to a column-major (MATLAB/FORTRAN) array. More... | |
void | mcx_convertrow2col64 (size_t **vol, uint3 *dim) |
Convert a row-major (C/C++) array to a column-major (MATLAB/FORTRAN) array. More... | |
void | mcx_convertcol2row (unsigned int **vol, uint3 *dim) |
Convert a column-major (MATLAB/FORTRAN) array to a row-major (C/C++) array. More... | |
void | mcx_convertcol2row4d (unsigned int **vol, uint4 *dim) |
Convert a column-major (MATLAB/FORTRAN) array to a row-major (C/C++) array. More... | |
int | mcx_loadjson (cJSON *root, Config *cfg) |
Load user inputs from a .json input file. More... | |
int | mcx_keylookup (char *key, const char *table[]) |
Look up a string in a string list and return the index. More... | |
int | mcx_lookupindex (char *key, const char *index) |
Look up a single character in a string. More... | |
int | mcx_parsedebugopt (char *debugopt, const char *debugflag) |
Parse the debug flag in the letter format. More... | |
void | mcx_savedetphoton (float *ppath, void *seeds, int count, int seedbyte, Config *cfg) |
Save detected photon data to mch format binary file. More... | |
void | mcx_loadseedfile (Config *cfg) |
Load previously saved photon seeds from an .mch file for replay. More... | |
void | mcx_cleargpuinfo (GPUInfo **gpuinfo) |
Reset and clear the GPU information data structure. More... | |
int | mcx_isbinstr (const char *str) |
Test if a string contains only '0' and '1'. More... | |
void | mcx_progressbar (float percent, Config *cfg) |
Print a progress bar. More... | |
void | mcx_flush (Config *cfg) |
Force flush the command line to print the message. More... | |
int | mcx_run_from_json (char *jsonstr) |
Run MCX simulations from a JSON input in a persistent session. More... | |
float | mcx_updatemua (unsigned int mediaid, Config *cfg) |
Retrieve mua for different cfg.vol formats to convert fluence back to energy in post-processing. More... | |
void | mcx_savejdata (char *filename, Config *cfg) |
Save simulation settings to an inp file. More... | |
int | mcx_jdataencode (void *vol, int ndim, uint *dims, char *type, int byte, int zipid, void *obj, int isubj, Config *cfg) |
Export an ND volumetric image to JSON/JData encoded construct. More... | |
int | mcx_jdatadecode (void **vol, int *ndim, uint *dims, int maxdim, char **type, cJSON *obj, Config *cfg) |
Decode an ND array from JSON/JData construct and output to a volumetric array. More... | |
void | mcx_savejnii (float *vol, int ndim, uint *dims, float *voxelsize, char *name, int isfloat, Config *cfg) |
Save volumetric output (fluence etc) to a JNIfTI/JSON/JData format file. More... | |
void | mcx_savebnii (float *vol, int ndim, uint *dims, float *voxelsize, char *name, int isfloat, Config *cfg) |
Save volumetric output (fluence etc) to a binary JNIfTI/JSON/JData format file. More... | |
void | mcx_savejdet (float *ppath, void *seeds, uint count, int doappend, Config *cfg) |
Save detected photon data to mch format binary file. More... | |
int | mcx_svmc_bgvoxel (int vol) |
Check if a voxel contains background medium(0) More... | |
void | mcx_loadseedjdat (char *filename, Config *cfg) |
Load previously saved photon seeds from an .jdat file for replay. More... | |
void | mcx_prep_polarized (Config *cfg) |
Preprocess media to prepare polarized photon simulation. More... | |
void | mcx_replayinit (Config *cfg, float *detps, int dimdetps[2], int seedbyte) |
Initialize the replay data structure from detected photon data - in embedded mode (MATLAB/Python) More... | |
void | mcx_validatecfg (Config *cfg, float *detps, int dimdetps[2], int seedbyte) |
Validate all input fields, and warn incompatible inputs. More... | |
int | mexPrintf (const char *format,...) |
int | mexEvalString (const char *command) |
MCX configuration header.
#define EPS FLT_EPSILON |
< use multi-threading for running simulation on multiple GPUs
round-off limit
#define MAX | ( | a, | |
b | |||
) | ((a)>(b)?(a):(b)) |
macro to get the max values of two numbers
#define MAX_DEVICE 256 |
max number of GPUs to be used
#define MAX_FULL_PATH 2048 |
max characters in a full file name string
#define MAX_PATH_LENGTH 1024 |
max characters in a full file name string
#define MAX_SESSION_LENGTH 256 |
max session name length
#define MCX_CUDA_ARCH 100 |
fallback CUDA version
#define MCX_CUDA_ERROR_LAUNCH_FAILED 719 |
CUDA kernel launch error code
#define MCX_ERROR | ( | id, | |
msg | |||
) | mcx_error(id,msg,__FILE__,__LINE__) |
macro for error handling
#define MCX_FPRINTF | ( | fp, | |
... | |||
) | fprintf(fp,__VA_ARGS__) |
macro to print messages, calls fprintf in command line mode
#define MIN | ( | a, | |
b | |||
) | ((a)<(b)?(a):(b)) |
macro to get the min values of two numbers
#define VERY_BIG (1.f/FLT_EPSILON) |
a big number
typedef struct MCXGPUInfo GPUInfo |
Data structure for GPU information
typedef struct MCXHistoryHeader History |
Header data structure in .mch/.mct files to store detected photon data This header has a total of 256 bytes
The structure to store optical properties Four relevant optical properties are needed
typedef struct MCXPolarizeMedium POLMedium |
The stucture to store medium parameters for polarized photon simulations.
typedef struct PhotonReplay Replay |
Data structure for photon replay
typedef unsigned int uint |
use uint for unsigned int
typedef unsigned short ushort |
use ushort for unsigned short
void mcx_clearcfg | ( | Config * | cfg | ) |
Clearing the simulation configuration data structure.
Destructor of the simulation configuration, delete all dynamically allocated members
void mcx_cleargpuinfo | ( | GPUInfo ** | gpuinfo | ) |
Reset and clear the GPU information data structure.
Clearing the GPU information data structure
void mcx_convertcol2row | ( | unsigned int ** | vol, |
uint3 * | dim | ||
) |
Convert a column-major (MATLAB/FORTRAN) array to a row-major (C/C++) array.
[in,out] | vol | a 3D array (wrapped in 1D) to be converted |
[in] | dim | the dimensions of the 3D array |
void mcx_convertcol2row4d | ( | unsigned int ** | vol, |
uint4 * | dim | ||
) |
Convert a column-major (MATLAB/FORTRAN) array to a row-major (C/C++) array.
[in,out] | vol | a 3D array (wrapped in 1D) to be converted |
[in] | dim | the dimensions of the 3D array |
void mcx_convertrow2col | ( | unsigned int ** | vol, |
uint3 * | dim | ||
) |
Convert a row-major (C/C++) array to a column-major (MATLAB/FORTRAN) array.
[in,out] | vol | a 3D array (wrapped in 1D) to be converted |
[in] | dim | the dimensions of the 3D array |
void mcx_convertrow2col64 | ( | size_t ** | vol, |
uint3 * | dim | ||
) |
Convert a row-major (C/C++) array to a column-major (MATLAB/FORTRAN) array.
[in,out] | vol | a 3D array (wrapped in 1D) to be converted |
[in] | dim | the dimensions of the 3D array |
void mcx_dumpmask | ( | Config * | cfg | ) |
Save the pre-masked volume (with detector ID) to an nii file.
To test the results, you should use -M to dump the det-mask, load it in matlab, and plot the interface containing the detector with pcolor() (has the matching index), and then draw a circle with the radius and center set in the input file. the pixels should completely cover the circle.
[in] | cfg | simulation configuration |
void mcx_error | ( | const int | id, |
const char * | msg, | ||
const char * | file, | ||
const int | linenum | ||
) |
Error reporting function.
[in] | id | a single integer for the types of the error |
[in] | msg | the error message string |
[in] | file | the unit file name where this error is raised |
[in] | linenum | the line number in the file where this error is raised |
void mcx_flush | ( | Config * | cfg | ) |
Force flush the command line to print the message.
[in] | cfg | simulation configuration |
void mcx_initcfg | ( | Config * | cfg | ) |
Initializing the simulation configuration with default values.
Constructor of the simulation configuration, initializing all field to default values
expect 1-byte per medium index, use –mediabyte to set to 2 or 4
in theory, mcx can use min block size 32 because no communication between threads, but 64 seems to work the best
launch many threads to saturate the device to maximize throughput
default is Matlab array
output detected photon data by default, use -d 0 to disable
use pencil beam as default source type
default RNG seed, a big integer, with a hidden meaning :)
This format is only supported by C99
by default, honor anisotropy for all scattering, use –gscatter to reduce it
use the first GPU device by default
int mcx_isbinstr | ( | const char * | str | ) |
Test if a string contains only '0' and '1'.
[in] | str | string to be tested |
int mcx_jdatadecode | ( | void ** | vol, |
int * | ndim, | ||
uint * | dims, | ||
int | maxdim, | ||
char ** | type, | ||
cJSON * | obj, | ||
Config * | cfg | ||
) |
Decode an ND array from JSON/JData construct and output to a volumetric array.
The JData specification defines a portable way to encode and share volumetric ND arrays and other complex data structures, such as trees, graphs and tables. This function is capable of importing any ND numerical arrays in the JData construct in to a generic array, permitting data decompression and base64 decoding.
[in] | vol | a pointer that points to the ND array buffer |
[in] | ndim | the number of dimensions |
[in] | dims | an integer pointer that points to the dimensional vector |
[in] | type | a string of JData data types, such as "uint8" "float32", "int32" etc |
[in] | byte | number of byte per voxel |
[in] | zipid | zip method: 0:zlib,1:gzip,2:base64,3:lzma,4:lzip,5:lz4,6:lz4hc |
[in] | obj | a pre-created cJSON object to store the output JData fields |
int mcx_jdataencode | ( | void * | vol, |
int | ndim, | ||
uint * | dims, | ||
char * | type, | ||
int | byte, | ||
int | zipid, | ||
void * | obj, | ||
int | isubj, | ||
Config * | cfg | ||
) |
Export an ND volumetric image to JSON/JData encoded construct.
The JData specification defines a portable way to encode and share volumetric ND arrays and other complex data structures, such as trees, graphs and tables. This function is capable of exporting any ND numerical arrays into a JData construct, permitting data compression and base64 encoding.
[in] | vol | a pointer that points to the ND array buffer |
[in] | ndim | the number of dimensions |
[in] | dims | an integer pointer that points to the dimensional vector |
[in] | type | a string of JData data types, such as "uint8" "float32", "int32" etc |
[in] | byte | number of byte per voxel |
[in] | zipid | zip method: 0:zlib,1:gzip,2:base64,3:lzma,4:lzip,5:lz4,6:lz4hc |
[in] | obj | a pre-created cJSON object to store the output JData fields |
void mcx_kahanSum | ( | float * | sum, |
float * | kahanc, | ||
float | input | ||
) |
Kahan summation: Add a sequence of finite precision floating point numbers.
Source: https://en.wikipedia.org/wiki/Kahan_summation_algorithm
[in,out] | sum | sum of the squence before and after adding the next element |
[in,out] | kahanc | a running compensation for lost low-order bits |
[in] | input | the next element of the sequence |
int mcx_keylookup | ( | char * | origkey, |
const char * | table[] | ||
) |
Look up a string in a string list and return the index.
[in] | origkey | string to be looked up |
[out] | table | the dictionary where the string is searched |
void mcx_loadconfig | ( | FILE * | in, |
Config * | cfg | ||
) |
Load user inputs from a .inp input file.
This function loads user input from a simple text input format in a .inp extension
[in] | in | file handle to the .inp file |
[in] | cfg | simulation configuration |
int mcx_loadjson | ( | cJSON * | root, |
Config * | cfg | ||
) |
Load user inputs from a .json input file.
This function loads user input from a JSON format in a .json extension
[out] | root | json data structure pointer |
[in] | cfg | simulation configuration |
void mcx_loadseedfile | ( | Config * | cfg | ) |
Load previously saved photon seeds from an .mch file for replay.
[in,out] | cfg | simulation configuration |
void mcx_loadseedjdat | ( | char * | filename, |
Config * | cfg | ||
) |
Load previously saved photon seeds from an .jdat file for replay.
[in] | filename | the name/path of the .jdat file produced from the baseline simulation |
[in,out] | cfg | simulation configuration |
void mcx_loadvolume | ( | char * | filename, |
Config * | cfg, | ||
int | isbuf | ||
) |
Load media index data volume (.bin or .vol) to the memory.
[in] | filename | file name to the binary volume data (support 1,2 and 4 bytes per voxel) |
[in] | cfg | simulation configuration |
float to half conversion https://stackoverflow.com/questions/3026441/float32-to-float16/5587983#5587983 https://gamedev.stackexchange.com/a/17410 (for denorms)
int mcx_lookupindex | ( | char * | key, |
const char * | index | ||
) |
Look up a single character in a string.
[in] | key | character to be looked up |
[out] | index | the dictionary string where the char is searched |
void mcx_maskdet | ( | Config * | cfg | ) |
Pre-label the voxel near a detector for easy photon detection.
This function preprocess the volume and detector data and add the detector ID to the upper 16bits of the voxel that the detector encompasses. If two detectors cover the same voxel, the later one will overwrite the ID of the 1st one. In MCX kernel, the detector coverage is tested for all detectors despite the label written (only used as a binary mask)
[in] | cfg | simulation configuration |
The goal here is to find a set of voxels for each detector so that the intersection between a sphere of R=cfg->detradius,c0=cfg->detpos[d] and the object surface (or bounding box) is fully covered.
void mcx_normalize | ( | float | field[], |
float | scale, | ||
int | fieldlen, | ||
int | option, | ||
int | pidx, | ||
int | srcnum | ||
) |
Normalize the solution by multiplying a scaling factor.
[in,out] | field | volumetric data before normalization |
[in] | scale | the scaling factor (or normalization factor) to be applied |
[in] | fieldlen | the length (floating point) of elements in the volume |
[in] | option | if set to 2, only normalize positive values (negative values for diffuse reflectance calculations) |
void mcx_parsecmd | ( | int | argc, |
char * | argv[], | ||
Config * | cfg | ||
) |
Main function to read user command line options.
This function process user command line inputs and parse all short and long options.
[in] | argc | the number of total command line parameters |
[in] | argv | the pointer to all command line options |
[in] | cfg | simulation configuration |
int mcx_parsedebugopt | ( | char * | debugopt, |
const char * | debugflag | ||
) |
Parse the debug flag in the letter format.
The debug flag following the -D can be either a string format, or numerical format. This function converts the string debug flags into number format
[in] | debugopt | string following the -D parameter |
[out] | debugflag | the numerical format of the debug flag |
void mcx_prep_polarized | ( | Config * | cfg | ) |
Preprocess media to prepare polarized photon simulation.
This function precompute the scattering coefficent and smatrix for different sphere-medium combinations.
[in] | cfg | simulation configuration |
void mcx_preprocess | ( | Config * | cfg | ) |
Preprocess user input and prepare the cfg data structure.
This function preprocess the user input and prepare the domain for the simulation. It loads the media index array from file, add detector masks for easy detection, and check inconsistency between the user specified inputs.
[in] | cfg | simulation configuration |
void mcx_printheader | ( | Config * | cfg | ) |
Print MCX output header.
[in] | cfg | simulation configuration |
void mcx_printlog | ( | Config * | cfg, |
char * | str | ||
) |
Print a message to the console or a log file.
[in] | cfg | simulation configuration |
[in] | str | a string to be printed |
void mcx_progressbar | ( | float | percent, |
Config * | cfg | ||
) |
Print a progress bar.
When -D P is specified, this function prints and update a progress bar.
[in] | percent | the percentage value from 1 to 100 |
[in] | cfg | simulation configuration |
int mcx_readarg | ( | int | argc, |
char * | argv[], | ||
int | id, | ||
void * | output, | ||
const char * | type | ||
) |
Function to read a single parameter value followed by a command line option.
This function reads different types of parameter values following a command line option.
[in] | argc | the number of total command line parameters |
[in] | argv | the pointer to all command line options |
[in] | id | which parameter to be parsed |
[out] | output | the pointer to which the parsed value to be written |
[in] | type | the type of data support char, int, float, string, bytenumlist, floatlist |
void mcx_readconfig | ( | char * | fname, |
Config * | cfg | ||
) |
Read simulation settings from a configuration file (.inp or .json)
[in] | fname | the name of the input file (.inp or .json) |
[in] | cfg | simulation configuration |
int mcx_remap | ( | char * | opt | ) |
Test if a long command line option is supported.
This function returns 1 if a long option is found, and 0 otherwise
[in] | opt | the long command line option string |
void mcx_replayinit | ( | Config * | cfg, |
float * | detps, | ||
int | dimdetps[2], | ||
int | seedbyte | ||
) |
Initialize the replay data structure from detected photon data - in embedded mode (MATLAB/Python)
[in,out] | cfg | simulation configuration |
[in] | detps | detected photon data |
[in] | dimdetps | the dimension vector of the detected photon data |
[in] | seedbyte | the number of bytes per RNG seed |
int mcx_run_from_json | ( | char * | jsonstr | ) |
Run MCX simulations from a JSON input in a persistent session.
[in] | jsonstr | a string in the JSON format, the content of the .json input file |
mcxconfig: structure to store all simulation parameters
gpuinfo: structure to store GPU information
activedev: count of total active GPUs to be used
void mcx_savebnii | ( | float * | vol, |
int | ndim, | ||
uint * | dims, | ||
float * | voxelsize, | ||
char * | name, | ||
int | isfloat, | ||
Config * | cfg | ||
) |
Save volumetric output (fluence etc) to a binary JNIfTI/JSON/JData format file.
[in] | dat | volumetric data to be saved |
[in] | len | total byte length of the data to be saved |
[in] | name | output file name (will append '.nii') |
[in] | type32bit | type of the data, only support 32bit per record |
[in] | outputformatid | decide if save as nii or analyze format |
[in] | cfg | simulation configuration |
void mcx_saveconfig | ( | FILE * | out, |
Config * | cfg | ||
) |
Save simulation settings to an inp file.
[in] | out | handle to the output file |
[in] | cfg | simulation configuration |
void mcx_savedata | ( | float * | dat, |
size_t | len, | ||
Config * | cfg | ||
) |
Save volumetric output (fluence etc) to mc2 format binary file.
[in] | dat | volumetric data to be saved |
[in] | len | total byte length of the data to be saved |
[in] | cfg | simulation configuration |
void mcx_savedetphoton | ( | float * | ppath, |
void * | seeds, | ||
int | count, | ||
int | doappend, | ||
Config * | cfg | ||
) |
Save detected photon data to mch format binary file.
[in] | ppath | buffer pointing to the detected photon data (partial path etc) |
[in] | seeds | buffer pointing to the detected photon seed data |
[in] | count | number of detected photons |
[in] | doappend | flag if the new data is appended or write from the begining |
[in] | cfg | simulation configuration |
void mcx_savejdata | ( | char * | filename, |
Config * | cfg | ||
) |
Save simulation settings to an inp file.
[in] | out | handle to the output file |
[in] | cfg | simulation configuration |
Save detected photon data to mch format binary file.
[in] | ppath | buffer pointing to the detected photon data (partial path etc) |
[in] | seeds | buffer pointing to the detected photon seed data |
[in] | count | number of detected photons |
[in] | doappend | flag if the new data is appended or write from the begining |
[in] | cfg | simulation configuration |
void mcx_savejnii | ( | float * | vol, |
int | ndim, | ||
uint * | dims, | ||
float * | voxelsize, | ||
char * | name, | ||
int | isfloat, | ||
Config * | cfg | ||
) |
Save volumetric output (fluence etc) to a JNIfTI/JSON/JData format file.
[in] | dat | volumetric data to be saved |
[in] | len | total byte length of the data to be saved |
[in] | name | output file name (will append '.nii') |
[in] | type32bit | type of the data, only support 32bit per record |
[in] | outputformatid | decide if save as nii or analyze format |
[in] | cfg | simulation configuration |
void mcx_savenii | ( | float * | dat, |
size_t | len, | ||
char * | name, | ||
int | type32bit, | ||
int | outputformatid, | ||
Config * | cfg | ||
) |
Save volumetric output (fluence etc) to an Nifty format binary file.
[in] | dat | volumetric data to be saved |
[in] | len | total byte length of the data to be saved |
[in] | name | output file name (will append '.nii') |
[in] | type32bit | type of the data, only support 32bit per record |
[in] | outputformatid | decide if save as nii or analyze format |
[in] | cfg | simulation configuration |
int mcx_svmc_bgvoxel | ( | int | vol | ) |
Check if a voxel contains background medium(0)
This function check if a voxel contains background medium, under SVMC mode
[in] | vol | high 32 bit of the input volume under SVMC mdoe |
float mcx_updatemua | ( | unsigned int | mediaid, |
Config * | cfg | ||
) |
Retrieve mua for different cfg.vol formats to convert fluence back to energy in post-processing.
[out] | output | medium absorption coefficient for the current voxel |
[in] | mediaid | medium index of the current voxel |
[in] | cfg | simulation configuration |
void mcx_usage | ( | Config * | cfg, |
char * | exename | ||
) |
Print MCX help information.
[in] | cfg | simulation configuration structure |
[in] | exename | path and name of the mcx executable |
void mcx_validatecfg | ( | Config * | cfg, |
float * | detps, | ||
int | dimdetps[2], | ||
int | seedbyte | ||
) |
Validate all input fields, and warn incompatible inputs.
Perform self-checking and raise exceptions or warnings when input error is detected
[in,out] | cfg | simulation configuration |
[in] | detps | detected photon data |
[in] | dimdetps | the dimension vector of the detected photon data |
[in] | seedbyte | the number of bytes per RNG seed |
void mcx_version | ( | Config * | cfg | ) |
Print MCX software version.
[in] | cfg | simulation configuration |
void mcx_writeconfig | ( | char * | fname, |
Config * | cfg | ||
) |
Write simulation settings to an inp file.
[in] | fname | the name of the output file |
[in] | cfg | simulation configuration |