Open cif-team opened 6 years ago
It seems that this file, dtiCompileMex.m, does indeed have a bug for the reason you say. The apparent but was introduced in 2013:
It is possible that the code ran at the time, and that niftiRead.c has been deleted since then. In any case, it looks to me like that part of the code should be reverted.
I can make this part of the code by reverting it. However, I then get errors from later lines such as
Warning: Something went wrong! Where is directory?
> In dtiCompileMex (line 97)
Error using cd
Cannot CD to (No directory specified).
Error in dtiCompileMex (line 99)
cd(srcDir);
All of which makes me wonder how necessary this compile code is. Does anyone use dtiCompileMex? If so, how, since it seems to produce a lot of errors.
-Jon
Oopsie. Did I break something?
Possibly, back in 2013. But then again, maybe the code ran when it was introduced, and fails now because files have subsequently been removed. Not sure.
In any case, the bit of code in question can be fixed by reverting these lines:
-cd(fileparts(which('niftiRead.c')));
+cd(fileparts(which('readFileNifti.c')));
disp('Compiling read/writeFileNifti ...');
try
- mex niftiRead.c nifti1_io.c znzlib.c zlib/adler32.c zlib/compress.c zlib/crc32.c zlib/deflate.c zlib/gzio.c zlib/infback.c zlib/inffast.c zlib/inflate.c zlib/inftrees.c zlib/trees.c zlib/zutil.c
- mexFiles{end+1} = ['niftiRead.' mexext];
+ mex readFileNifti.c nifti1_io.c znzlib.c zlib/adler32.c zlib/compress.c zlib/crc32.c zlib/deflate.c zlib/gzio.c zlib/infback.c zlib/inffast.c zlib/inflate.c zlib/inftrees.c zlib/trees.c zlib/zutil.c
+ mexFiles{end+1} = ['readFileNifti.' mexext];
mex writeFileNifti.c nifti1_io.c znzlib.c zlib/adler32.c zlib/compress.c zlib/crc32.c zlib/deflate.c zlib/gzio.c zlib/infback.c zlib/inffast.c zlib/inflate.c zlib/inftrees.c zlib/trees.c zlib/zutil.c
mexFiles{end+1} = ['writeFileNifti.' mexext];
catch
However, many of the subsequent calls to mex also fail, due to what looks like a path problem (or problems), starting with line 75:
functionsToCompile={ ...
Which makes me wonder if anyone in fact calls this function.
Following up on this, I am trying to run dtiCompileMex.m on a MacOS Mojave Version 10.14.6 with Matlab 2019a, but get errors throughout, not only errors in the paths, but also in compiling dtiFiberTracker.cxx dtiFitTensor.c and several others.
To further clarify, I can compile other code that requires lapack succesfully (e.g. the Matlab example), but get the following error when trying to compile dtiFitTensor.c: mex -v dtiFitTensor.c -lmwblas -lmwlapack
Building with 'Xcode with Clang'. /usr/bin/xcrun -sdk macosx10.15 clang -c -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -DMATLAB_MEX_FILE -I"/Applications/MATLAB_R2019a.app/extern/include" -I"/Applications/MATLAB_R2019a.app/simulink/include" -fno-common -arch x86_64 -mmacosx-version-min=10.9 -fexceptions -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -O2 -fwrapv -DNDEBUG "/Users/dora/Documents/git/vistasoft/mrDiffusion/src/dtiFitTensor.c" -o /var/folders/0q/_5mfjpy55d96ch71yjrvkt2h2x8pjt/T/mex_3944013439158_9088/dtiFitTensor.o Error using mex In file included from /Users/dora/Documents/git/vistasoft/mrDiffusion/src/dtiFitTensor.c:109: /Applications/MATLAB_R2019a.app/extern/include/lapack.h:8703:9: warning: 'dgelss' macro redefined [-Wmacro-redefined]
In dtiFitTensor.c, I think there is a small mistake on line 594 which states 'return 0;' in a void return function. Changing this to 'return;' solves the compile issue Dora encountered above.
I was trying to run 'dtiCompileMex.m' in mrDiffusion in MATLAB R2017a, but I get the following error:
Searching through the entire vistasoft on github, I don't even see a 'niftiRead.c', only a 'readFileNifti.c' which seems to have been modified about five years ago (but I'm guessing many people have been able to run the program since then). There also seems to have been a problem last year regarding something similar on MATLAB R2017a (https://github.com/vistalab/vistasoft/issues/229).
Hope someone can point me in the right direction so I can compile the script. Thanks!