MMCLAB: an easy-to-use MMC for matlab/octave

383 views
Skip to first unread message

Qianqian Fang

unread,
Aug 20, 2012, 10:15:38 AM8/20/12
to mmc-...@googlegroups.com, mcx-...@googlegroups.com
hi everyone

I am letting you know that I just uploaded a new package to
the sourceforge download site. The new package is named
MMCLAB. If you are familiar with MCXLAB, this is the exact
counterpart for MMC: a mex version of MMC compiled for both
matlab and GNU octave. Using MMCLAB greatly simplifies
the modeling workflow by directly integrating with mesh-generation
(via iso2mesh) and post analysis (plotting etc). No intermediate
files are necessary.

For more details, you can browse the following page
(where you can find sample codes and screenshots):

http://mcx.sourceforge.net/cgi-bin/index.cgi?MMC/Doc/MMCLAB

This package contains pre-compiled mex files for
Linux (32/64bit), Mac (Intel Mac 32bit) and Windows (32bit).
Unfortunately there was a problem compiling this program
on a 64bit Windows for matlab (octave is ok).

Before I make official announcement in the {mmc,mcx}-news
lists, I'd like to hear back from you regarding

1) do you have any difficulties running the examples?
2) anything I need to add to make it easy for first-time users?
3) any typos in the documentation?

oh, forgot to mention, the direct download link for the software is

http://sourceforge.net/projects/mcx/files/mmc/mmclab/

cheers

Qianqian



The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.

Qianqian Fang

unread,
Mar 18, 2013, 12:51:09 PM3/18/13
to mmc-...@googlegroups.com, frederi...@creatis.insa-lyon.fr, mcx-...@googlegroups.com
On 03/18/2013 12:28 PM, frederi...@creatis.insa-lyon.fr wrote:
Dear Mr. Fang,

I'm starting to use MMClab and have some troubles with the examples provided.

when I try to run the demo_mmclab_basic, I have the following error :

"Undefined function 'mmc' for input arguments of type 'struct'.

Error in mmclab (line 207)
  [varargout{1:mmcout}]=mmc(cfg);

Error in demo_mmclab_basic (line 24)
flux=mmclab(cfg);

"
I'm using a windows 7 - 64 bit system and matlab 2012b.

it must be a trivial problem.

hi Frédéric

the error was caused by the missing of mmc.mexw64,
required by your matlab. It was a bit tricky to set up
mingw/gcc/mcc to compile binaries for 64 bit windows.
So I only included a 32bit mex file for windows. In order to
use mmclab, you may have to find a 32 bit windows, or
a computer/virtual machine running either linux/mac. I
will try to include all the binaries in the next release (if
I can figure out how to compile).

if you are interested in compiling a copy of mmc.mexw64
on your system, you can find some instructions here:

http://mcx.sourceforge.net/cgi-bin/index.cgi?MMC/README#Download_and_Compile_MMC

http://mcx.sourceforge.net/cgi-bin/index.cgi?MMC/Doc/MMCLAB#How_to_compile_MMCLAB
and
http://mcx.sourceforge.net/cgi-bin/index.cgi?MMC/CompileLog/0.8.0

but on windows, you will have to google how to set up
mingw/gcc/mcc to generate 64bit binaries (likely to
insert "-arch x86_64" in the commands). It wasn't
easy based on my past attempts.

Qianqian



Would you help me with that ?

Best regards,

Frédéric
--
You received this message because you are subscribed to the Google Groups "mmc-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mmc-users+...@googlegroups.com.
To post to this group, send email to mmc-...@googlegroups.com.
Visit this group at http://groups.google.com/group/mmc-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Qianqian Fang

unread,
Mar 18, 2013, 12:56:21 PM3/18/13
to mmc-...@googlegroups.com, frederi...@creatis.insa-lyon.fr, mcx-...@googlegroups.com
On 03/18/2013 12:28 PM, frederi...@creatis.insa-lyon.fr wrote:
On Monday, August 20, 2012 4:15:38 PM UTC+2, Qianqian Fang wrote:

...


This package contains pre-compiled mex files for
Linux (32/64bit), Mac (Intel Mac 32bit) and Windows (32bit).
Unfortunately there was a problem compiling this program
on a 64bit Windows for matlab (octave is ok).

also, as you may read in my release note above, you can use
mmclab with GNU octave on a 64bit windows.

Qianqian


Before I make official announcement in the {mmc,mcx}-news
lists, I'd like to hear back from you regarding

1) do you have any difficulties running the examples?
2) anything I need to add to make it easy for first-time users?
3) any typos in the documentation?

oh, forgot to mention, the direct download link for the software is

http://sourceforge.net/projects/mcx/files/mmc/mmclab/

cheers

Qianqian



The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.

Qianqian Fang

unread,
May 3, 2013, 2:39:39 PM5/3/13
to mcx-...@googlegroups.com, Tyler Bywaters Rice, mmc-...@googlegroups.com, frederi...@creatis.insa-lyon.fr
On 05/03/2013 02:17 PM, Tyler Bywaters Rice wrote:
Hi Qianqian,
  I am quite interested in using MMCLAB, but I need the momentum transfer values of the simulation.  I browsed the output for MMCLAB and saw number of scattering events as a tracked variable, but not momentum transfer.  Is there some way to get that included in the photon output?  Thanks,

hi Tyler

if you are using the latest version of mmclab, the momentum transfer
output can be enabled by setting cfg.ismomentum to 1.

you can help mmclab to find the following:

cfg.ismomentum:  [0]-save momentum transfer for each detected photon

the partial path output will append #media new columns, each
representing the momentum transfer for each medium type.

let me know if you can find this option.

Qianqian


Tyler
--
You received this message because you are subscribed to the Google Groups "mcx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mcx-users+...@googlegroups.com.
To post to this group, send email to mcx-...@googlegroups.com.
Visit this group at http://groups.google.com/group/mcx-users?hl=en.

Muhanad Fadhel

unread,
Oct 16, 2014, 2:47:10 PM10/16/14
to mmc-...@googlegroups.com, mcx-...@googlegroups.com, tyby...@gmail.com, frederi...@creatis.insa-lyon.fr
Hi,

Is the issue of using 64 bit windows to run mmclab is fixed as now I am trying to run the mmclab example and I am getting this error:

Undefined function 'mmc' for input arguments of type 'struct'.

Error in mmclab (line 207)
  [varargout{1:mmcout}]=mmc(cfg);

Thanks,
Muhannad

Qianqian Fang

unread,
Oct 16, 2014, 10:33:26 PM10/16/14
to mmc-...@googlegroups.com
On 10/16/2014 02:47 PM, Muhanad Fadhel wrote:
Hi,

Is the issue of using 64 bit windows to run mmclab is fixed as now I am trying to run the mmclab example and I am getting this error:

Undefined function 'mmc' for input arguments of type 'struct'.

Error in mmclab (line 207)
  [varargout{1:mmcout}]=mmc(cfg);

hi Muhannad

unfortunately I haven't made any new progress in order to
port mmclab to a 64bit windows. The compilation still failed
hopelessly with tons of errors. I am not sure if anyone
else had looked into this.

Qianqian

Qianqian Fang

unread,
Jan 22, 2015, 3:24:21 PM1/22/15
to mcx-...@googlegroups.com, mmc-...@googlegroups.com

Warning: This message has had one or more attachments removed (mexopts_w32.bat). Please read the "NMR-MGH-Attachment-Warning.txt" attachment(s) for more information.

On 01/08/2015 04:34 PM, Catherinen wrote:
Hi,

May I know why I received an error after typed "make mex"
"Undefined function 'make' for input arguments of type 'char'."
is that some other software I needed except for MATLAB?

I am using Windows 7 (64) and Matlab R2013b

Thank you for the help,

hi Catherinen

sorry, just noticed this message in the list approval queue.

I have only notes for compiling MMCLAB on a 32bit
windows. Making this to work on 64bit windows was quite
difficult in my past attempts.

Here I have some overall notes on compiling MMC on windows

http://mcx.sourceforge.net/cgi-bin/index.cgi?MMC/CompileLog/0.8.0

you will need a few things to get the compilation going:

first, you need to install MinGW, a unix environment for
windows (add gcc during the installation process). This will
provide GNU make and gcc/g++. this will also provide a
unix/linux command window/shell (MSYS) so you can run the
make scripts.

http://sourceforge.net/projects/mingw/files/Installer/mingw-get/

assuming you have matlab and matlab C compiler installed,
you will need the attached file. You will have to save it and rename
to this path:

C:\Users\<username>\AppData\Roaming\MathWorks\MATLAB\RXXXX\mexopts.bat

the compiler (g++) and linker info are set for the gcc/g++
from MinGW (assuming the paths to the binaries in MinGW have
been added in your PATH environment variable).

once done. you will then be able to cd /path/to/mmc/src from an MSYS
shell, and type "make mex". the compilation should work, but the
linking may fail. In that case, you need to start a windows cmd shell
(type cmd in Start->Run), and manually run the linking command,
something like:

cd path\to\mmc\src
"C:\Program Files\MATLAB\RXXXX\bin\win32\mex.bat" mmclab.cpp -outdir ..\mmclab *.obj

now, if you get everything working, this will give you a mex file for
32bit windows. The 64bit windows have multiple issues. First of
all, you may need to install mingw-w64 instead of the regular mingw:

http://mingw-w64.sourceforge.net/

second, the attached mexopts files will have to be updated to generate
64bit binaries (insert -m64 and/or -arch x86_64 in the compilation lines).
I see many people had similar difficulties writing a proper mexopts file
for 64bit windows, see

https://www.google.com/search?client=ubuntu&channel=fs&q=mexopts.bat+for+windows+7+64+bit&ie=utf-8&oe=utf-8

if anyone wants to go further above this point, keep us posted!
I am sure there will be many users who have been waiting for
this support.


Qianqian


NMR-MGH-Attachment-Warning.txt

Qianqian Fang

unread,
Jan 22, 2015, 3:36:29 PM1/22/15
to mcx-...@googlegroups.com, mmc-...@googlegroups.com
On 01/22/2015 03:21 PM, Qianqian Fang wrote:

Warning: This message has had one or more attachments removed (mexopts_w32.bat). Please read the "NMR-MGH-Attachment-Warning.txt" attachment(s) for more information.


sorry, the attachment was blocked by the spam filters. here is the content of the file

http://mcx.sourceforge.net/cgi-bin/index.cgi?MMC/CompileLog/mexopts.bat

Qianqian

Catherinen

unread,
Jan 29, 2015, 7:22:04 PM1/29/15
to mmc-...@googlegroups.com, mcx-...@googlegroups.com
Hi Dr. Fang,

Thank you so much for your reply.

I use VirtualBox to build a new Linux 64 system, Ubtunu 14.04.1, and I installed MALTAB 2014b and GNU gcc/g++ 4.7 compiler.

In this way, the "make mex" works at terminal. And got "MEX completed successfully." at the terminal.

Right now, I am following the steps on http://mcx.sourceforge.net/cgi-bin/index.cgi?MMC/Basics . And met another problem when run "mmc -f onecube.inp".

I typed "./mmc -f onecube.inp" , terminal reflects error as "MMC ERROR(-2):can not load the specified config file in unit mcx_utils.c:184", 
I thought this may because of the path problem, and tried "./mmc -f path/mmc/examples/onecube/onecube.inp", I received "nodefile=node_onecube.dat
can not open node file" , I tried to add the directory "path/mmc/examples/onecube" to Linux path, but this still does not work.

If I typed "mmc -f onecube.inp", I got
"Launching MMCLAB - Mesh-based Monte Carlo for MATLAB & GNU Octave ...
MMCLAB ERROR 999 in unit mmclab.cpp:68
Unexpected unknown exception from MEX file.."

I Googled this, have not found any solution yet.

May I know how I can solve this problem, please?

Best,
Catherinen

Qianqian Fang

unread,
Jan 29, 2015, 10:50:39 PM1/29/15
to mmc-...@googlegroups.com

On 01/29/2015 07:22 PM, Catherinen wrote:
Hi Dr. Fang,

Thank you so much for your reply.

I use VirtualBox to build a new Linux 64 system, Ubtunu 14.04.1, and I installed MALTAB 2014b and GNU gcc/g++ 4.7 compiler.

In this way, the "make mex" works at terminal. And got "MEX completed successfully." at the terminal.

Right now, I am following the steps on http://mcx.sourceforge.net/cgi-bin/index.cgi?MMC/Basics . And met another problem when run "mmc -f onecube.inp".

I typed "./mmc -f onecube.inp" , terminal reflects error as "MMC ERROR(-2):can not load the specified config file in unit mcx_utils.c:184", 
I thought this may because of the path problem, and tried "./mmc -f path/mmc/examples/onecube/onecube.inp", I received "nodefile=node_onecube.dat
can not open node file" , I tried to add the directory "path/mmc/examples/onecube" to Linux path, but this still does not work.

If I typed "mmc -f onecube.inp", I got
"Launching MMCLAB - Mesh-based Monte Carlo for MATLAB & GNU Octave ...
MMCLAB ERROR 999 in unit mmclab.cpp:68
Unexpected unknown exception from MEX file.."

this does not sound right.

if you did "make mex", the output file should be under mmc/mmclab/mmc.mex*.
this is a mex file, and can only be luanched in matlab.

what you described above was for the binary version of MMC (the mmc binary
can be created by running "make omp" or "make ssemath", you can
not generate it with "make mex").

how did you get the mmc executable? did you download it from
MMC's website or you compiled it yourself? were you interested in
using mmc binary or MMCLAB?

for MMCLAB, the related documentation can be found here:

http://mcx.sourceforge.net/cgi-bin/index.cgi?MMC/Doc/MMCLAB

let me know if you have any further questions.

Qianqian

Qianqian Fang

unread,
Mar 10, 2015, 11:28:57 PM3/10/15
to mcx-...@googlegroups.com, mmc-...@googlegroups.com
On 03/04/2015 05:49 AM, Gili Dardikman wrote:
Hi,
First of all, thank you for this wonderful simulation. 
I've been trying to use the simulation on the brain atlas mash (Collin27),

hi Gili

as I mentioned in another reply, sorry for the delay because of a
trip for a family emergency.

I do have an example for Colin27 for the mmc binary, see

https://github.com/fangq/mmc/tree/master/mmc/trunk/examples/colin27

if you do not have this folder under examples, you may checkout the latest
code from github or sourceforge:

http://mcx.sf.net/cgi-bin/index.cgi?MMC/Download#Anonymous_Git_Access

but I can't seem to figure out where the 'face' array fits in the cfg structure. Is there an example code for running the simulation on the brain? I found a screenshot but it only shows partial code. Plus- I can''t seem to figure out what to put on the 'elemprop' field.

the "face" array in iso2mesh output typically represents a
triangular surface mesh. It is not needed in mmc or mmclab.

if you meant facenb (face-neighbors), the mmclab.m script
automatically calculates cfg.facenb if you do not define it explicitly. see

https://github.com/fangq/mmc/blob/master/mmc/trunk/mmclab/mmclab.m#L138-L140

like in this example, you can first call mmclab in the 'prep' mode,
to fill the missing cfg fields, and then call mmclab again with the
completed cfg for the actual simulation:

https://github.com/fangq/mmc/blob/master/mmc/trunk/mmclab/example/demo_example_replay.m#L34

this method can reduce the overhead if you want to run multiple
simulations based on one incomplete cfg input.

let me know if these answer your questions.

Qianqian


Thanks,
Gili

Ματθαίος Δουλγεράκης

unread,
Oct 16, 2015, 12:20:50 PM10/16/15
to mmc-users, mcx-...@googlegroups.com
Dear Qianqian,

First of all, congratulations with the amazing work you have done with MCX and MMC.

I am currently trying to run MMC in Matlab on my Windows 64 machine,so I am trying to compile MMC for windows 64bit, but I am afraid I am not doing very well... 
I looked through this forum and this seems to be quite a common problem (you had trouble with it as well), but I could not find any complete solution posted anywhere.
Any chance I missed something? Has anyone managed to compile for Matlab Windows 64? 
I want to do some computational time comparisons between MMC and other available light propagation software packages, so I don't have the option to run it in another machine / virtual machine as it would affect my results.
(well, maybe I should switch to another O.S. for all my tests anyway...).

Best wishes,
Matthaios

edu.bo...@gmail.com

unread,
Dec 26, 2018, 10:23:13 PM12/26/18
to mmc-users
We have the same problem, I tried to run the mcxlab under Matlab for Win 64, but my Matlab doesn't recognize the "make mex" command!  

Qianqian Fang

unread,
Dec 27, 2018, 11:07:36 PM12/27/18
to mmc-...@googlegroups.com, edu.bo...@gmail.com

please read the README file inside the MMCLAB package, particularly this section

https://github.com/fangq/mmc/blob/master/mmclab/README.txt#L327-L347

"make" is not a matlab command, you need to run it from a shell (or terminal).

--
You received this message because you are subscribed to the Google Groups "mmc-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mmc-users+...@googlegroups.com.
To post to this group, send email to mmc-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages