Help with Matlab gadgets

192 views
Skip to first unread message

Laura Gui

unread,
Apr 4, 2018, 9:37:30 AM4/4/18
to Gadgetron
Dear all,

We would like to start using Matlab gadgets in our reconstructions. However, being newbies to Gadgetron, we would like to ask you how to install and get started with Matlab on Gadgetron? For instance, we would like to use the files in https://github.com/gadgetron/gadgetron/tree/master/gadgets/matlab but do not know where / how to install them. Thanks very much!

Best regards,
Laura

Stanislas Rapacchi

unread,
Apr 5, 2018, 10:21:45 AM4/5/18
to Laura Gui, Gadgetron
Hi Laura,

 if you use Gadgetron in a Docker container, you can find information related here: https://github.com/gadgetron/gadgetron/wiki/Using-Matlab-with-Gadgetron-in-Docker

 And if you build Gadgetron from sources, assuming Matlab is installed in a conventional path and that paths are included in the host environment, the makefiles should take care of finding Matlab and building the Matlab gadgets accordingly. 

Hope that helps,

Stan

--
You received this message because you are subscribed to the Google Groups "Gadgetron" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gadgetron+unsubscribe@googlegroups.com.
To post to this group, send email to gadg...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gadgetron/62f64fb6-636b-4c32-9839-595d7d85998e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Stanislas

Laura Gui

unread,
Apr 5, 2018, 11:20:20 AM4/5/18
to Gadgetron
Thanks for your reply! We are using Gadgetron installed from sources. However, I cannot find the Matlab gadgets on our computer. (How) Can they be added to the installation? Thanks!

Best,
Laura


On Thursday, April 5, 2018 at 4:21:45 PM UTC+2, Stanislas Rapacchi wrote:
Hi Laura,

 if you use Gadgetron in a Docker container, you can find information related here: https://github.com/gadgetron/gadgetron/wiki/Using-Matlab-with-Gadgetron-in-Docker

 And if you build Gadgetron from sources, assuming Matlab is installed in a conventional path and that paths are included in the host environment, the makefiles should take care of finding Matlab and building the Matlab gadgets accordingly. 

Hope that helps,

Stan
On Wed, Apr 4, 2018 at 3:37 PM, Laura Gui <gui....@gmail.com> wrote:
Dear all,

We would like to start using Matlab gadgets in our reconstructions. However, being newbies to Gadgetron, we would like to ask you how to install and get started with Matlab on Gadgetron? For instance, we would like to use the files in https://github.com/gadgetron/gadgetron/tree/master/gadgets/matlab but do not know where / how to install them. Thanks very much!

Best regards,
Laura

--
You received this message because you are subscribed to the Google Groups "Gadgetron" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gadgetron+...@googlegroups.com.

To post to this group, send email to gadg...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gadgetron/62f64fb6-636b-4c32-9839-595d7d85998e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Stanislas

Valéry Ozenne

unread,
Apr 6, 2018, 4:02:18 AM4/6/18
to Gadgetron
Hi,

Assuming you are running Gadgetron on ubuntu, mac is similar 

first :
cmake should return this message :
Matlab found> /usr/local/MATLAB/R2015b/extern/include. Matlab registration wrapper is being compiled.
MATLAB FOUND: matlab wrapper for gtplus toolbox will be compiled.

also check using ccmake  and the option toggle that all the path for matlab are correctly filled

/usr/local/MATLAB/R2015b/bin/glnxa64/libeng.so                                                                                  
 MATLAB_INCLUDE_DIR               /usr/local/MATLAB/R2015b/extern/include                                                                                         
 MATLAB_JMI_JAR                   /usr/local/MATLAB/R2015b/java/jar/jmi.jar                                                                                       
 MATLAB_MAT_LIBRARY               /usr/local/MATLAB/R2015b/bin/glnxa64/libmat.so                                                                                  
 MATLAB_MEX_LIBRARY               /usr/local/MATLAB/R2015b/bin/glnxa64/libmex.so                                                                                  
 MATLAB_MX_LIBRARY                /usr/local/MATLAB/R2015b/bin/glnxa64/libmx.so                                                                                   
 MATLAB_ROOT                      /usr/local/MATLAB/R2015b                                                                                                        
 MATLAB_UTIL_JAR                  /usr/local/MATLAB/R2015b/java/jar/util.jar                                                                                      
 MATLAB_UT_LIBRARY                /usr/local/MATLAB/R2015b/bin/glnxa64/libut.so   


you might need  these lines in the bashrc :

export MATLAB_ROOT=/usr/local/MATLAB/R2015b
export MATLAB_HOME=/usr/local/MATLAB/R2015b
export PATH=$PATH:/usr/local/MATLAB/R2015b/bin

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/MATLAB/R2015b/bin/glnxa64

and you need to install tcsh , sudo apt-get install tcsh


most of the troubles related to the matlab installation has already been discussed in the forum :

https://groups.google.com/forum/#!searchin/gadgetron/matlab%7Csort:date
and also in the old forum :
https://sourceforge.net/p/gadgetron/discussion/search/?q=matlab

for instance
https://groups.google.com/forum/#!searchin/gadgetron/matlab|sort:date/gadgetron/kwy58z7-IA0/zMfGCB5bCgAJ
https://groups.google.com/forum/#!searchin/gadgetron/matlab|sort:date/gadgetron/5uIbzY7kHNY/S1i4P3BIDQAJ
https://sourceforge.net/p/gadgetron/discussion/general/thread/81eb5468/

Hopes it helps

Best

Valéry

Valéry Ozenne

unread,
Apr 6, 2018, 4:04:59 AM4/6/18
to Gadgetron

Lindsey Crowe

unread,
Apr 25, 2018, 2:38:46 AM4/25/18
to Gadgetron
Hi, Thanks this helped a lot, we have redone gadgetron to get the link with matlab and sorted out some of the library path errors as per the forum threads you posted.

So we tried

gadgetron_ismrmrd_client -f data212.h5 -o recon212matlab.h5 -c matlabbuffer.xml

on a no grappa, no cine, 1 slice GRE and trufisp.  There was no error in the command window, but in the gadgetron we see
** Error in `gadgetron': free(): invalid pointer: 0x00007f9340012aa8 ***

Here are some debug info that might be useful:

04-24 10:43:08.762 DEBUG [AcquisitionAccumulateTriggerGadget.cpp:66] TRIGGER DIMENSION IS: repetition (6)
04-24 10:43:08.762 DEBUG [AcquisitionAccumulateTriggerGadget.cpp:109] SORTING DIMENSION IS:  (17)
04-24 10:43:08.762 DEBUG [BucketToBufferGadget.cpp:41] N DIMENSION IS:  (17)
04-24 10:43:08.762 DEBUG [BucketToBufferGadget.cpp:64] S DIMENSION IS:  (17)
04-24 10:43:08.762 DEBUG [BucketToBufferGadget.cpp:67] SPLIT SLICES IS: %b
04-24 10:43:08.762 DEBUG [BucketToBufferGadget.cpp:70] IGNORE SEGMENT IS: %b
04-24 10:43:08.762 DEBUG [MatlabBufferGadget.h:70] MATLAB Class Name : bufferRecon
04-24 10:43:08.762 DEBUG [MatlabBufferGadget.h:74] Starting MATLAB engine with command: matlab -nosplash
*** Error in `gadgetron': free(): invalid pointer: 0x00007f4ab4023888 ***

Can you help please?
Thanks
Lindsey

Valéry Ozenne

unread,
Apr 26, 2018, 10:45:38 AM4/26/18
to Gadgetron
Hi,

It is difficult to find a solution with this information. Could you do the following step:

cd /home/valery/Dev/gadgetron-ihu/test/integration
python get_data.py (do it several time sometimes)

it downloads some reference data

then
python run_gadgetron_test.py  -G /usr/local/ -I /usr/local/ cases/matlab.cfg
it will launch a test that should work in principle:
 
put the log and the output of the command  located in
/home/valery/Dev/gadgetron-ihu/test/integration/test
in this forum

as an alternative, if you want to work with your data offline waiting that the gadgetron works in your station,
you can read the h5 file with this script:

https://github.com/ismrmrd/ismrmrd/blob/master/examples/matlab/test_recon_dataset.m

you need to compile ismrmrd in a similar way to gadgetron with the matlab FLAG in the cmake
then add at the beggining of script
addpath (/usr/local/share/ismrmr/matlab)

- therefore you can read h5 in matlab with the ismrmrd format and manipulate easily the kspace data en kspace information (encoding)
- your code will be easely transferable into the gadgetron as the data format is the same and matlab is supported

Best,
Valéry

Laura Gui

unread,
May 14, 2018, 5:19:27 AM5/14/18
to Gadgetron
Hi,

Thanks! I run the test and here is the result:

maxwell@lmedlab506:~/Documents/TestGadgetron$ python run_gadgetron_test.py -G /usr/local/ -I /usr/local/ cases/matlab.cfg
Running Gadgetron test with:
  -- ISMRMRD_HOME  : /usr/local
  -- GADGETRON_HOME  : /usr/local
  -- PATH            : /usr/local/bin:/usr/local/bin:/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
  -- LD_LIBRARY_PATH : /usr/local/lib:/usr/local/lib:/usr/local/../arma/lib:/usr/local/cuda/lib64:/opt/intel/mkl/lib/intel64:/opt/intel/lib/intel64:/usr/local/lib::/opt/intel/mkl/lib/intel64:/opt/intel/lib/intel64_lin/:/usr/local/lib:/usr/local/lib
  -- TEST CASE       : cases/matlab.cfg
Running test case: cases/matlab.cfg
Converting Siemens .dat file to ISMRMRD for data measurement.
Running Gadgetron recon on data measurement
Elapsed time: 0.0613851547241
Failed to run gadgetron_ismrmrd_client!
TEST: cases/matlab.cfg FAILED

I'm attaching the smaller files from the Test directory and will send the data file (84 Mo) with wetransfer (is there any other way to do it?). Can you please help us to fix the errors in our installation? Thanks!

Best regards,
Laura
client.log
gadgetron.log

Laura Gui

unread,
May 14, 2018, 5:22:02 AM5/14/18
to Gadgetron

Valéry Ozenne

unread,
May 22, 2018, 8:09:45 AM5/22/18
to Gadgetron
Hi Laura,

Thanks for sending all the information, could you do it again after some minor changes. Here are some possibility to make it work:

- First in case write the command : sudo apt-get install tcsh

- Then did you follow the indication post above? It might be the same issue :  https://groups.google.com/forum/#!searchin/gadgetron/matlab%7Csort:date/gadgetron/5uIbzY7kHNY/S1i4P3BIDQAJ

- If not, use also export ACE_DEBUG=1 and send again the output of the gadgetron log  : the output message will then indicated more precisely what is missing .

Best

Valéry

Laura Gui

unread,
May 30, 2018, 6:51:07 AM5/30/18
to Gadgetron
Dear Valéry,

Thank you for your answer! I installed tsch and followed the indications in the post you mentioned, but the result of running the test didn't change at all. Moreover, I ran export ACE_DEBUG=1 before running the test, but I don't see any detailed error messages in the output logs (everything stayed the same). Do you know why that might be? Thanks for your help!

Best regards,
Laura

Valéry Ozenne

unread,
May 30, 2018, 10:56:34 AM5/30/18
to Gadgetron
Hi Laura,

As you can see in the forum, lots of people (including me) spend of lot of time to debug the gadgetron/matlab at the beggining, it is a bit tricky but if you are running a ubuntu + matlab it always works at the end. Are you using a virtual machine?

In order to help you, I can only debug with the log. You should post again the full log (compilation and tests).

cd /user/gadgetron/build
rm -fr *
cmake ../
make
sudo make install

(send the log)

then
echo $PATH
echo $LD_LIBRARY_PATH

(send the log)

cd gadgetron test/

python run_gadgetron_test.py  -G /usr/local/ -I /usr/local/ cases/matlab.cfg

(send client.log gadgetron.log and also the output of the command as you did before)

reading our previous log in the post above : 

-- PATH            : /usr/local/bin:/usr/local/bin:/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
  -- LD_LIBRARY_PATH : /usr/local/lib:/usr/local/lib:/usr/local/../arma/lib:/usr/local/cuda/lib64:/opt/intel/mkl/lib/intel64:/opt/intel/lib/intel64:/usr/local/lib::/opt/intel/mkl/lib/intel64:/opt/intel/lib/intel64_lin/:/usr/local/lib:/usr/local/lib

there is some problems in the bashrc  
 - first :/usr/local/MATLAB/R2015b/glnxa64 for instance is missing but you have corrected it  I think now
-  secondly : check the LD_LIBRARY_PATH , i mean you should see in red bold above some typo error that might be the problem

Best,

Valéry










Laura Gui

unread,
Jun 15, 2018, 8:45:16 AM6/15/18
to Gadgetron

Dear Valéry,

We have advanced a little bit by adding some paths to the environment. The test yields 'SUCCESS' now but there is still a little error in the logs (attached). Can you please advise how to fix this? I'm sending you the logs from re-compiling gadgetron and the test.

We would also like to get started with using Matlab under Gadgetron, starting with simple sequences, as you advised. As we are beginning, could you please give us the basic instructions/steps of how to do this? Where do we write/test our code and how do we interface with Gadgetron? Thanks!

Best,
Laura
client.log
gadgetron.log
test.log
gadgetron_install.log

Laura Gui

unread,
Jun 15, 2018, 8:47:24 AM6/15/18
to Gadgetron
Reply all
Reply to author
Forward
0 new messages