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

Missing 'niftiRead.c' file #303

Open
cif-team opened this issue Aug 28, 2018 · 6 comments
Open

Missing 'niftiRead.c' file #303

cif-team opened this issue Aug 28, 2018 · 6 comments

Comments

@cif-team
Copy link

I was trying to run 'dtiCompileMex.m' in mrDiffusion in MATLAB R2017a, but I get the following error:

Error using cd
Cannot CD to  (No directory specified).

Error in dtiCompileMex (line 44)
cd(fileparts(which('niftiRead.c')));

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 (#229).

Hope someone can point me in the right direction so I can compile the script. Thanks!

@JWinawer
Copy link
Member

JWinawer commented Oct 3, 2018

It seems that this file, dtiCompileMex.m, does indeed have a bug for the reason you say. The apparent but was introduced in 2013:

d96d293#diff-8ee67c097b9526d9288582abcabd771e

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

@arokem
Copy link
Member

arokem commented Oct 3, 2018

Oopsie. Did I break something?

@JWinawer
Copy link
Member

JWinawer commented Oct 3, 2018

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.

@dorahermes
Copy link

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.

@dorahermes
Copy link

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]
#define dgelss FORTRAN_WRAPPER(dgelss)

@MaxvandenBoom
Copy link

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.

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

5 participants