Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into latest_master
Browse files Browse the repository at this point in the history
- contains fix for github.com/fangq/issues/191
lkeegan committed Oct 4, 2023

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
2 parents e6148c5 + 2ad9307 commit 0234613
Showing 14 changed files with 310 additions and 737 deletions.
13 changes: 7 additions & 6 deletions inno/MCXStudio.iss
Original file line number Diff line number Diff line change
@@ -3,16 +3,16 @@
;;
;; Author: Qianqian Fang <q.fang at neu.edu>
;; Initially added on Jun. 28, 2020
;; URL: http://mcx.space
;; Github: http://github.com/fangq/mcx
;; URL: https://mcx.space
;; Github: https://github.com/fangq/mcx
;;
;;======================================================================

#define MyAppName "MCX Studio"
#define MyAppDir "MCXStudio"
#define MyAppVersion "v2023"
#define MyAppPublisher "COTILab"
#define MyAppURL "http://mcx.space"
#define MyAppURL "https://mcx.space"
#define MyAppExeName "mcxstudio.exe"

;;----------------------------------------------------------------------
@@ -44,6 +44,7 @@ ArchitecturesInstallIn64BitMode=x64
DefaultGroupName="{#MyAppName} {#MyAppVersion}"
VersionInfoCompany={#MyAppPublisher}
VersionInfoCopyRight="(C) {#MyAppPublisher}"
UninstallDisplayIcon={app}\{#MyAppExeName}

;;----------------------------------------------------------------------

@@ -82,8 +83,8 @@ Source: "..\MCXSuite\mmc\matlab\*"; DestDir: "{code:GetMatlabToolboxLocalPath}\m
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Parameters: "--user"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Parameters: "--user"; Tasks: desktopicon
Name: "{group}\MCX Website"; Filename: "http://mcx.space/"
Name: "{group}\MCX Wiki"; Filename: "http://mcx.space/wiki/"
Name: "{group}\MCX Website"; Filename: "https://mcx.space/"
Name: "{group}\MCX Wiki"; Filename: "https://mcx.space/wiki/"
Name: "{group}\MCX Forum"; Filename: "https://groups.google.com/forum/?hl=en#!forum/mcx-users"

;;----------------------------------------------------------------------
@@ -119,7 +120,7 @@ Root: HKLM; Subkey: "System\CurrentControlSet\Control\GraphicsDrivers"; ValueTyp
;;----------------------------------------------------------------------

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
Filename: "{app}\{#MyAppExeName}"; Parameters: "--user"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

;;----------------------------------------------------------------------

5 changes: 5 additions & 0 deletions mcxlab/PKG_ADD
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if(exist(file_in_loadpath('mcx.mex')))
autoload('mcx',file_in_loadpath('mcx.mex'))
else
autoload('mcx',file_in_loadpath(['octave' filesep regexprep(computer('arch'), 'darwin[0-9.]+-', 'darwin-') filesep 'mcx.mex']))
end
2 changes: 1 addition & 1 deletion mcxlab/mcxlab.m
Original file line number Diff line number Diff line change
@@ -224,7 +224,7 @@
% light (-1 <= Q <= 1)
% cfg.lambda: source light wavelength (nm) for polarized MC
% cfg.issrcfrom0: 1-first voxel is [0 0 0], [0]- first voxel is [1 1 1]
% cfg.replaydet: only works when cfg.outputtype is 'jacobian', 'wl', 'nscat', or 'wp' and cfg.seed is an array
% cfg.replaydet: only works when cfg.outputtype is 'jacobian', 'wl', 'nscat', 'wp' or 'rf' and cfg.seed is an array
% -1 replay all detectors and save in separate volumes (output has 5 dimensions)
% 0 replay all detectors and sum all Jacobians into one volume
% a positive number: the index of the detector to replay and obtain Jacobians
902 changes: 207 additions & 695 deletions mcxlab/tutorials/mcxlab_getting_started.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/mcx_core.h
Original file line number Diff line number Diff line change
@@ -182,7 +182,7 @@ typedef struct __align__(16) KernelParams {
unsigned int srcnum; /**< total number of source patterns */
unsigned int nphase; /**< number of samples for inverse-cdf, will be added by 2 to include -1 and 1 on the two ends */
float omega; /**< modulation angular frequency (2*pi*f), in rad/s, for FD/RF replay */
unsigned char bc[12]; /**< boundary conditions */
unsigned char bc[12]; /**< boundary condition flags, copy the first 12 chars from cfg->bc without the terminating NULL */
} MCXParam;

void mcx_run_simulation(Config* cfg, GPUInfo* gpu);
4 changes: 2 additions & 2 deletions src/mcx_utils.c
Original file line number Diff line number Diff line change
@@ -332,7 +332,7 @@ void mcx_initcfg(Config* cfg) {
cfg->nphase = 0;
cfg->invcdf = NULL;
memset(cfg->jsonfile, 0, MAX_PATH_LENGTH);
memset(cfg->bc, 0, 12);
memset(cfg->bc, 0, 13);
memset(&(cfg->srcparam1), 0, sizeof(float4));
memset(&(cfg->srcparam2), 0, sizeof(float4));
memset(cfg->deviceid, 0, MAX_DEVICE);
@@ -2773,7 +2773,7 @@ int mcx_loadjson(cJSON* root, Config* cfg) {
}
}

if (cfg->outputformat == ofJNifti) {
if (!flagset['F']) {
cfg->outputformat = mcx_keylookup((char*)FIND_JSON_KEY("OutputFormat", "Session.OutputFormat", Session, "jnii", valuestring), outputformat);
}

2 changes: 1 addition & 1 deletion src/mcx_utils.h
Original file line number Diff line number Diff line change
@@ -258,7 +258,7 @@ typedef struct MCXConfig {
float* dx; /**< anisotropic voxel spacing for x-axis */
float* dy; /**< anisotropic voxel spacing for y-axis */
float* dz; /**< anisotropic voxel spacing for z-axis */
char bc[12]; /**<boundary condition flag for [-x,-y,-z,+x,+y,+z, det(-x,-y,-z,+x,+y,+z)] */
char bc[13]; /**<boundary condition flag for [-x,-y,-z,+x,+y,+z, det(-x,-y,-z,+x,+y,+z)], last element is always NULL for string termination */
unsigned int nphase; /**< number of samples for inverse-cdf, will be added by 2 to include -1 and 1 on the two ends */
float* invcdf; /**< equal-space sampled inversion of CDF(cos(theta)) for the phase function of the zenith angle */
} Config;
3 changes: 1 addition & 2 deletions src/mcxlab.cpp
Original file line number Diff line number Diff line change
@@ -1063,8 +1063,7 @@ void mcx_set_field(const mxArray* root, const mxArray* item, int idx, Config* cf
mexErrMsgTxt("the 'bc' field must be a non-empty string");
}

mxGetString(item, cfg->bc, len + 1);
cfg->bc[len] = '\0';
mxGetString(item, cfg->bc, len + 1); // copy the string, plus the ending NULL, max 13 char
printf("mcx.bc='%s';\n", cfg->bc);
} else if (strcmp(name, "detphotons") == 0) {
arraydim = mxGetDimensions(item);
5 changes: 2 additions & 3 deletions src/pmcx.cpp
Original file line number Diff line number Diff line change
@@ -723,11 +723,10 @@ void parse_config(const py::dict& user_cfg, Config& mcx_config) {
std::string bc_string = py::str(user_cfg["bc"]);

if (bc_string.empty() || bc_string.size() > 12) {
throw py::value_error("the 'bc' field must be a non-empty string / have less than 12 characters.");
throw py::value_error("the 'bc' field must be a non-empty string / have no more than 12 characters.");
}

strncpy(mcx_config.bc, bc_string.c_str(), bc_string.size() + 1);
mcx_config.bc[bc_string.size()] = '\0';
strncpy(mcx_config.bc, bc_string.c_str(), bc_string.size() + 1); // copy the string, plus the ending NULL, max 13 char
}

if (user_cfg.contains("detphotons")) {
23 changes: 15 additions & 8 deletions utils/mcxrfreplay.m
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

function [rfjac_lnA, rfjac_phase]=mcxrfreplay(cfg,f_mod,detp,seeds,detnums)
%
% [rfjac_lnA, rfjac_phase]=mcxrfreplay(cfg,f_mod,detp,seeds,detnums)
%
%
% Compute the frequency domain (FD) log-amplitude and phase shift Jacobians
% with respect to voxel-wise absorption coefficients using the radio
% frequency (RF) replay algorithm.
@@ -20,7 +19,7 @@
% detp: the 2nd output from mcxlab, must be a struct
% seeds: the 4th output from mcxlab
% detnums: row array with the indices of the detectors to replay and obtain Jacobians
%
%
% Output:
% rfjac_lnA: a 4D array with dimensions specified by [size(vol) numb-of-detectors];
% each 3D array contains the Jacobians for log-amplitude measurements
@@ -30,6 +29,14 @@
% License: GPLv3, see http://mcx.space/ for details
%

if(nargin<5)
error('you must provide all 5 required input parameters');
end

if(~isfield(cfg,'unitinmm'))
cfg.unitinmm = 1;
end

% Initialize the 4D arrays for collecting the Jacobians. The 4th dimension
% corresponds to the detector index.
rfjac_lnA=zeros([size(cfg.vol),length(detnums)]);
@@ -40,9 +47,9 @@
% MCXLAB REPLAY SETTINGS
clear cfg_jac
cfg_jac=cfg;
cfg_jac.seed=seeds.data;
cfg_jac.detphotons=detp.data;
cfg_jac.replaydet=d;
cfg_jac.seed=seeds.data;
cfg_jac.detphotons=detp.data;
cfg_jac.replaydet=d;
cfg_jac.outputtype='rf';
cfg_jac.omega=2*pi*f_mod; % 100 MHz RF modulation
cfg_jac.isnormalized=0; % !
@@ -53,8 +60,8 @@
dett=mcxdettime(detp_d,cfg_jac.prop,cfg_jac.unitinmm); % array with photon time-of-flights

% FD MEASUREMENT ESTIMATES
X=dot(detw,cospi((2*f_mod).*dett));
Y=dot(detw,sinpi((2*f_mod).*dett));
X=dot(detw,cos((2*f_mod).*dett*pi));
Y=dot(detw,sin((2*f_mod).*dett*pi));
A=sqrt(X^2 + Y^2); % amplitude [a.u.]
phase=atan2(Y,X) + (double(atan2(Y,X)<0))*2*pi; % phase shift in [0,2*pi] [rad]
if A==0
14 changes: 14 additions & 0 deletions winget/coti.mcxstudio.installer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Created with YamlCreate.ps1 v2.1.2 $debug=AUSU.5-1-19041-1320
# yaml-language-server: $schema=https://aka.ms/winget-manifest.installer.1.1.0.schema.json

PackageIdentifier: coti.mcxstudio
PackageVersion: v2023
MinimumOSVersion: 10.0.0.0
InstallerType: inno
Scope: machine
Installers:
- Architecture: x64
InstallerUrl: https://mcx.space/nightly/release/v2023/MCXStudio-v2023-installer.exe
InstallerSha256: afc561cfc332b5fe0339e5058e127656e763a7c17b7f8d53e7fed43176326a7d
ManifestType: installer
ManifestVersion: 1.1.0
46 changes: 46 additions & 0 deletions winget/coti.mcxstudio.locale.en-US.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Created with YamlCreate.ps1 v2.1.2 $debug=AUSU.5-1-19041-1320
# yaml-language-server: $schema=https://aka.ms/winget-manifest.defaultLocale.1.1.0.schema.json

PackageIdentifier: coti.mcxstudio
PackageVersion: v2023
PackageLocale: en-US
Publisher: COTILab
PublisherUrl: https://mcx.space
PublisherSupportUrl: https://groups.google.com/g/mcx-users
# PrivacyUrl:
Author: Qianqian Fang
PackageName: MCX Studio
PackageUrl: https://sourceforge.net/projects/mcx/
License: GNU General Public License v3.0 (GPL-3.0)
LicenseUrl: https://github.com/fangq/mcx/blob/v2023/LICENSE.txt
Copyright: Copyright (c) 2010-2023 Qianqian Fang <q.fang at neu.edu>
CopyrightUrl: https://github.com/fangq/mcx/blob/v2023/LICENSE.txt
ShortDescription: Monte Carlo eXtreme (MCX) - Physically accurate and validated GPU ray-tracer
Description: Monte Carlo eXtreme, or MCX, is a Monte Carlo photon simulator for modeling light transport in 3D turbid media. It uses NVIDIA graphics processing units (GPUs) to simulate thousands of photons simultaneously, making it one of the fastest and most accurate photon modeling tools.
Moniker: mcxstudio
Tags:
- science
- physics
- optics
- cuda
- gpu
- biophotonics
- monte-carlo
- neurojson
# Agreements:
ReleaseNotes: |-
New Features
- Introduced Split voxel MC (SVMC) to accurately model curved boundaries
- GPU polarized light modeling (Stokes) with 900x speedup
- RF replay to build frequency-domain Jacobians for amplitude and phase
- Web-based MCX Cloud platform including web-client and server scripts
- pymcx - an mcxlab-like Python module for running MCX simulations in Python
- Added Debian/Ubuntu packages for easy installation
- Added a unified command line interface, photon, to call mcx/mcxcl/mmc
- Fine-tuned Windows installer
- Extensively developed Github Action for automated building and packaging of mcx
- Adopted standardized NeuroJSON JNIfTI and JData formats to ease data exchange
- New source types include hyperboloid and ring (annulus,annulus sector)
ReleaseNotesUrl: http://mcx.space/wiki/index.cgi?Doc/ReleaseNotes/v2023
ManifestType: defaultLocale
ManifestVersion: 1.1.0
8 changes: 8 additions & 0 deletions winget/coti.mcxstudio.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Created with YamlCreate.ps1 v2.1.2 $debug=AUSU.5-1-19041-1320
# yaml-language-server: $schema=https://aka.ms/winget-manifest.version.1.1.0.schema.json

PackageIdentifier: coti.mcxstudio
PackageVersion: v2023
DefaultLocale: en-US
ManifestType: version
ManifestVersion: 1.1.0
18 changes: 0 additions & 18 deletions winget/mcxstudio.yaml

This file was deleted.

0 comments on commit 0234613

Please sign in to comment.