Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when using LBV background removal and question about reference tissue #76

Closed
MHoch96 opened this issue Dec 27, 2023 · 3 comments
Closed

Comments

@MHoch96
Copy link

MHoch96 commented Dec 27, 2023

I am getting an error when I run the LBV for background removal, and I am unsure how to get around it:

Invalid MEX-file
'/Users/hochy/Documents/MATLAB/MEDI_toolbox-2/functions/_LBV/mexMGv6.mexmaci64':
dlopen(/Users/hochy/Documents/MATLAB/MEDI_toolbox-2/functions/_LBV/mexMGv6.mexmaci64,
0x0006): Library not loaded: @rpath/libMatlabEngine.dylib
Referenced from:
/Users/hochy/Documents/MATLAB/MEDI_toolbox-2/functions/_LBV/mexMGv6.mexmaci64
Reason: tried: '/Applications/MATLAB_R2022a.app/bin/maci64/libMatlabEngine.dylib' (no such
file), '/Applications/MATLAB_R2022a.app/bin/maci64/./libMatlabEngine.dylib' (no such file),
'/Applications/MATLAB_R2022a.app/bin/maci64/../../sys/os/maci64/libMatlabEngine.dylib' (no
such file), '/Applications/MATLAB_R2022a.app/Contents/MacOS/libMatlabEngine.dylib' (no such
file), '/Applications/MATLAB_R2022a.app/Contents/MacOS/./libMatlabEngine.dylib' (no such
file),
'/Applications/MATLAB_R2022a.app/Contents/MacOS/../../standalone/bin/maci64/libMatlabEngine.dylib'
(no such file),
'/Applications/MATLAB_R2022a.app/Contents/MacOS/../../sys/os/maci64/libMatlabEngine.dylib'
(no such file), '/Applications/MATLAB_R2022a.app/bin/maci64/libMatlabEngine.dylib' (no such
file)

I ran the > mex mexMGv6.cpp and this was the output:

Building with 'Xcode Clang++'.
/Users/hochy/Documents/MATLAB/MEDI_toolbox-2/functions/_LBV/mexMGv6.cpp:734:13: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
delete mask_int;
^
[]
/Users/hochy/Documents/MATLAB/MEDI_toolbox-2/functions/_LBV/mexMGv6.cpp:725:29: note: allocated with 'new[]' here
int* mask_int = new int this->n_vox[0];
^
1 warning generated.

ld: warning: -undefined error is deprecated
ld: warning: -undefined error is deprecated

ld: warning: -undefined error is deprecated
ld: warning: -undefined error is deprecated

MEX completed successfully.

I am not sure how to get around this issue?

Also, what does the reference tissue mean? I am working with data for mouse brains, and whenever I pick a reference tissue all of my susceptibility values go to 0.

Sorry for all of the questions!

@kschan0214
Copy link
Owner

Hi, sorry for the late reply!

For the LBV issue,
I've got the same warning when I build the mex file again (on M2 Pro, macOs 14.2.1, Matlab R2023b):

Building with 'Xcode Clang++'.
/Users/kc020/Documents/tools/sepia/external/MEDI_toolbox/MEDI_toolbox_20200115/functions/_LBV/mexMGv6.cpp:734:13: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
            delete mask_int;
            ^
                  []
/Users/kc020/Documents/tools/sepia/external/MEDI_toolbox/MEDI_toolbox_20200115/functions/_LBV/mexMGv6.cpp:725:29: note: allocated with 'new[]' here
            int* mask_int = new int [this->n_vox[0]]();
                            ^
1 warning generated.

ld: warning: -undefined error is deprecated
ld: warning: -undefined error is deprecated

ld: warning: -undefined error is deprecated
ld: warning: -undefined error is deprecated

MEX completed successfully.

But I was able to run LBV afterward even with these warning messages during the build. Can you use the LBV in your case?

For the (CSF) reference tissue, it works only on in vivo human data. Basically, this step performs:
Chimp_final = Chimap - mean(Chimp(mask_reference>0))

Currently we utilise the implementation from the MEDI toolbox for CSF segmentation, which may not work on mouse data. If 'Brain mask' is chosen then the reference mask would be the input mask. Does it give you 0 even when you chose 'Brain mask' as the reference tissue?

@ahervouin
Copy link

ahervouin commented Feb 15, 2024

Hi,

I had the same problem with Matlab R2022b on macOS sonoma 14.3 but resolved it.

This page was really helpful :

https://fr.mathworks.com/matlabcentral/answers/2034829-maci64-libmatlabengine-dylib-not-found-trying-to-call-a-compiled-mexmaci64-function-on-macos

Aurelien

@kschan0214
Copy link
Owner

Thanks a lot for the solution Aurelien!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants