Forum

Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.





Pages: [1] 2
Author Topic: Side-by-side configuration error
Chrysi
Newbie
Posts: 9
Permalink
Post Side-by-side configuration error
on: June 25, 2013, 15:56
Quote

Hi,

I have been trying to set up nifty_rec to work with MATLAB, but so far unsuccessfully.

1) After installing the binaries I tried to run some of the demos (I am running Windows 7 64-bit but I have 32-bit MATLAB) but I get the following error:
------------------------------------------------------------------------------------------------------
>> tt_demo_mlem_parallel
Invalid MEX-file 'C:\Program Files (x86)\NiftyRec\niftyrec\matlab\et_rotate_mex.mexw32': The application has failed to start because its side-by-side configuration is incorrect.
Please see the application event log or use the command-line sxstrace.exe tool for more detail.

Error in et_rotate (line 58)
out_image = et_rotate_mex(in_image, rotation, center, use_gpu, background);

Error in tt_demo_mlem_parallel (line 27)
phantom_attenuation = mask.*et_rotate(attenuation_128,[pi/2,0,0],[64.5,64.5,64.5],1,0)*1e-5;
------------------------------------------------------------------------------------------------------
Looking in the event log and around the Internet it seems that this is related to MS Visual C++ Redistributable packages that may or may not be correctly referenced. I have uninstalled and re-installed all MSVC++ Redistributable (2005, 2008, 2010, including service packs) but the problem persists.

Has anyone else experienced this problem or have any other ideas?

2) In a parallel attempt to get things working, I have also tried to build the binaries myself using Cmake and Visual Studio. I am assuming that in this case I should build the mexw32 files from within MATLAB. However when I try to run mex, I get the following error:

>> mex -v _et_rotate_mex.cpp
***************************************************************************
Warning: Neither -compatibleArrayDims nor -largeArrayDims is selected.
Using -compatibleArrayDims. In the future, MATLAB will require
the use of -largeArrayDims and remove the -compatibleArrayDims
option. For more information, see:

http://www.mathworks.com/help/techdoc/matlab_external/bsflnue-1.html

****************************************************************************

-> Default options filename found in C:\Users\nly17915\AppData\Roaming\MathWorks\MATLAB\R2012b
----------------------------------------------------------------
-> Options file = C:\Users\nly17915\AppData\Roaming\MathWorks\MATLAB\R2012b\mexopts.bat
MATLAB = C:\Program Files (x86)\MATLAB\R2012b
-> COMPILER = lcc
-> Compiler flags:
COMPFLAGS = -c -I"C:\Program Files (x86)\MATLAB\R2012b\sys\lcc\include" -DMATLAB_MEX_FILE -noregistrylookup
OPTIMFLAGS = -DNDEBUG
DEBUGFLAGS = -g4
arguments =
Name switch = -Fo
-> Pre-linking commands =
-> LINKER = lcclnk
-> Link directives:
LINKFLAGS = -tmpdir "." -dll "C:\Program Files (x86)\MATLAB\R2012b\extern\lib\win32\lcc\mexFunction.def" -L"C:\Program Files (x86)\MATLAB\R2012b\sys\lcc\lib" -libpath "C:\Program Files (x86)\MATLAB\R2012b\extern\lib\win32\lcc" "C:\Users\nly17915\AppData\Local\Temp\mex_R9lSua\templib2.obj"
LINKDEBUGFLAGS =
LINKFLAGSPOST = libmx.lib libmex.lib libmat.lib
Name directive = -o "_et_rotate_mex.mexw32"
File link directive =
Lib. link directive =
Rsp file indicator = @
-> Resource Compiler = lrc -I"C:\Program Files (x86)\MATLAB\R2012b\sys\lcc\include" -noregistrylookup -fo"mexversion.res"
-> Resource Linker =
----------------------------------------------------------------

--> lcc -c -I"C:\Program Files (x86)\MATLAB\R2012b\sys\lcc\include" -DMATLAB_MEX_FILE -noregistrylookup -FoC:\Users\nly17915\AppData\Local\Temp\mex_R9lSua\_et_rotate_mex.obj -I"C:\Program Files (x86)\MATLAB\R2012b\extern\include" -I"C:\Program Files (x86)\MATLAB\R2012b\simulink\include" -DNDEBUG -DMX_COMPAT_32 _et_rotate_mex.cpp

lcc preprocessor error: _et_rotate_mex.cpp:12 Could not find include file "_et_array_interface.h"
lcc preprocessor error: _et_rotate_mex.cpp:14 Could not find include file <limits>
lcc preprocessor error: _et_rotate_mex.cpp:17 Could not find include file <cmath>
Error _et_rotate_mex.cpp: 29 illegal statement termination
Error _et_rotate_mex.cpp: 29 skipping `const'
Error _et_rotate_mex.cpp: 29 illegal use of type name `mxClassID'
Warning _et_rotate_mex.cpp: 29 Statement has no effect
Error _et_rotate_mex.cpp: 29 syntax error; found `cid_image' expecting `;'
Error _et_rotate_mex.cpp: 29 undeclared identifier `cid_image'
Error _et_rotate_mex.cpp: 30 illegal statement termination
Error _et_rotate_mex.cpp: 30 skipping `const' `int'
Error _et_rotate_mex.cpp: 30 undeclared identifier `dim_image'
Error _et_rotate_mex.cpp: 32 illegal statement termination
Error _et_rotate_mex.cpp: 32 skipping `const'
Error _et_rotate_mex.cpp: 32 illegal use of type name `mxClassID'
Warning _et_rotate_mex.cpp: 32 Statement has no effect
Error _et_rotate_mex.cpp: 32 syntax error; found `cid_rotation' expecting `;'
Error _et_rotate_mex.cpp: 32 undeclared identifier `cid_rotation'
Error _et_rotate_mex.cpp: 33 illegal statement termination
Error _et_rotate_mex.cpp: 33 skipping `const' `int'
Error _et_rotate_mex.cpp: 33 undeclared identifier `dim_rotation'
Error _et_rotate_mex.cpp: 35 illegal statement termination
Error _et_rotate_mex.cpp: 35 too many errors

C:\PROGRA~2\MATLAB\R2012B\BIN\MEX.PL: Error: Compile of '_et_rotate_mex.cpp' failed.

Error using mex (line 206)
Unable to complete successfully.

---------------------------------------------------------------- ----------------------------------------------------------------

It seems that it cannot find some header files, although I have added the entire nifty_rec directory to the path. In fact, I can just open the file _et_array_interface.h in the MATLAB editor, yet somehow mex doesn't see it...

Any help will be much appreciated.

Chrysi

spedemon
Administrator
Posts: 22
Permalink
Post Re: Side-by-side configuration error
on: June 28, 2013, 08:19
Quote

Hi Chrysi,
Thank you for reporting this problem. Since it has never occurred to us, I can only suggest to compile from the source.
The build system of NiftyRec builds the Matlab interface (mex files), therefore you do not need to run 'mex ..' in Matlab.
Just make sure that the option NiftyRec_BUILD_MEX is enabled (it is enabled by default) when configuring with CMake.
CMake generates a Visual Studio project and the mex files are built within Visual Studio.
Follow the instructions here: http://niftyrec.scienceontheweb.net/wiki/index.php?title=Install_NiftyRec#Windows_-_Microsoft_Visual_Studio
Once you have built and installed NiftyRec, open Matlab and type 'addpath('C:/Program Files/nifty_rec/matlab/');' (adjust it according to your installation directory).
Stefano

Chrysi
Newbie
Posts: 9
Permalink
Post Re: Side-by-side configuration error
on: June 28, 2013, 11:36
Quote

Hi Stefano,

Thanks for your reply!
I had indeed tried building the binaries. After some puzzling, I have now figured out that some cmake variables needed to be set that were not described in the wiki (there is a broken link to a screenshot, maybe this is where the info should be?). I will list them here for others who might run into similar issues:
MATLAB_ENG_LIBRARY: <matlabroot>/extern/lib/win32/microsoft/libeng.lib [the exact path depends on the installed compilers, I have MS visual studio so ]
MATLAB_INCLUDE: <matlabroot>/extern/include
MATLAB_LIBS_DIR: <matlabroot>/BIN/WIN32
MATLAB_MEX_LIBRARY <matlabroot>/extern/lib/win32/microsoft/libmex.lib
MATLAB_MX_LIBRARY <matlabroot>/extern/lib/win32/microsoft/libmx.lib
I also attach a screenshot of all my settings, which worked.

[This: http://b-tk.googlecode.com/svn-history/r10/BTK/branches/SOFAMEA/CMake/FindMatlab.cmake
is where I found which values the cmake variable should have.]

Then I build the project in MSVC 2010 where everything works fine, no errors.

Then I go to MATLAB, add the paths to the build files, the data directory and the m files to the MATLAB path and try to run tt_demo_mlem_parallel. So m files, mex files and data are all visible to MATLAB.

At this point MATLAB crashes with a segmentation fault, see .txt file for details.

Any ideas?

Thanks for your time,
Chrysi

Image
Image

spedemon
Administrator
Posts: 22
Permalink
Post Re: Side-by-side configuration error
on: June 28, 2013, 11:56
Quote

Hi Chrysi,
I don't know what is the reason of the segmentation fault.
Have you tried any other demo? E.g. et_demo_mlem
Also try et_list_gpus(), does it crash?
Stefano

Chrysi
Newbie
Posts: 9
Permalink
Post Re: Side-by-side configuration error
on: June 28, 2013, 12:05
Quote

Hi Stefano,
With the other 2 demo files you mention, MATLAB doesn't crash but produces the following errors:
>> et_demo_mlem
Creating synthetic sinogram..
Visualising sinogram..
Undefined function or variable 'N_projections'.

Error in et_demo_mlem (line 59)
for i=1:N_projections

et_list_gpus()
Error using et_list_gpus_mex
Error while querying GPU info.

Error in et_list_gpus (line 26)
gpus = et_list_gpus_mex();

I tried to figure out what happens during the crash of tt_demo_mlem_parallel by examining the log file, no luck so far but I will keep looking.

Chrysi

spedemon
Administrator
Posts: 22
Permalink
Post Re: Side-by-side configuration error
on: June 28, 2013, 12:31
Quote

Do you have a CUDA compatible GPU installed? If not, edit the demo file and set the GPU flag to 0.
Any luck with et_demo_osem ?

Chrysi
Newbie
Posts: 9
Permalink
Post Re: Side-by-side configuration error
on: June 28, 2013, 13:31
Quote

Also maybe relevant, the error message for tt_demo_mlem_conebeam

>> tt_demo_mlem_conebeam
Mex file entry point is missing. Please check the (case-sensitive)
spelling of mexFunction (for C MEX-files), or the (case-insensitive)
spelling of MEXFUNCTION (for FORTRAN MEX-files).
Invalid MEX-file 'C:\Windows\system32\version.dll': The specified module could not be found.

Error in load_nii_hdr>header_key (line 183)
v6 = version;

Error in load_nii_hdr>read_header (line 148)
dsr.hk = header_key(fid);

Error in load_nii_hdr (line 92)
hdr = read_header(fid);

Error in load_nii (line 122)
[nii.hdr,nii.filetype,nii.fileprefix,nii.machine] = load_nii_hdr(filename);

Error in et_load_nifti (line 13)
[nifti_struct]= load_nii(filename);

Error in tt_demo_mlem_conebeam (line 35)
attenuation = et_load_nifti('attenuation_02_128.nii');

Chrysi
Newbie
Posts: 9
Permalink
Post Re: Side-by-side configuration error
on: June 28, 2013, 13:40
Quote

Sorry, my previous post crossed yours (had to wait for the spam filter).

I changed the GPU flag to 0, still the same error in tt_demo_mlem_conebeam.

Chrysi

spedemon
Administrator
Posts: 22
Permalink
Post Re: Side-by-side configuration error
on: June 28, 2013, 14:25
Quote

Hi Chrysi,

There seems to be a problem reading the Nifti file (.nii).
It is difficult to say what causes the problem as I have no means to reproduce it.
You can try loading the file with e.g. http://www.mathworks.com/matlabcentral/fileexchange/8797-tools-for-nifti-and-analyze-image
or to use another phantom, not necessarily from a .nii file.

tt_demo_mlem_conebeam currently has only the GPU implementation, while tt_demo_mlem_parallel has the CPU or GPU option.
So if there is no GPU installed, that might be the reason of the crash.

Stefano

Chrysi
Newbie
Posts: 9
Permalink
Post Re: Side-by-side configuration error
on: June 28, 2013, 15:49
Quote

Hi Stefano,

The crash happens when I try to run tt_demo_mlem_parallel, and with GPU=0.

I will check loading other phantom types or using another loading routine and get back to you after the weekend.

Thanks for all the help so far.

Chrysi

Pages: [1] 2
Mingle Forum by cartpauj
Version: 1.0.34 ; Page loaded in: 0.095 seconds.
{lang: 'en-GB'}