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

Having trouble running AFQ in deployed (compiled) mode #24

Open
soichih opened this issue Feb 15, 2018 · 2 comments
Open

Having trouble running AFQ in deployed (compiled) mode #24

soichih opened this issue Feb 15, 2018 · 2 comments

Comments

@soichih
Copy link

soichih commented Feb 15, 2018

We are trying to run AFQ in deployed (compiled via mcc) mode, and having some issue inside AFQ_SegmentFiberGroups.m. It's running which('mrDiffusion.m') that doesn't seem to work in compiled mode.

We basically made following patch to AFQ to make it work.

diff --git a/functions/AFQ_SegmentFiberGroups.m b/functions/AFQ_SegmentFiberGroups.m
index 1968a82..ccb6023 100644
--- a/functions/AFQ_SegmentFiberGroups.m
+++ b/functions/AFQ_SegmentFiberGroups.m
@@ -154,7 +154,9 @@ end
 % Load fiber group - Can be filename or the data
 if ischar(fg), fg = dtiLoadFiberGroup(fg); end
 % Set the directory where templates can be found
-tdir = fullfile(fileparts(which('mrDiffusion.m')), 'templates');
+%tdir = fullfile(fileparts(which('mrDiffusion.m')), 'templates');
+%fix for compiling
+tdir = fullfile(pwd, 'templates');
 % Initialize spm defualts for normalization
 spm_get_defaults; global defaults; 
 % In my case it is not reading the estimate, just the .write, copied this values

I am wondering, this piece of code can be updated to something like.

if isdeployed
    tdir = ...something that works in deployed mode..
else
    tdir = fullfile(fileparts(which('mrDiffusion.m')), 'templates');
end

?

@soichih
Copy link
Author

soichih commented Apr 11, 2018

I think I have found a workaround, and probably a more proper way to fix this. I basically needed to include ./mrDiffusion/templates to the compiled binary.

mcc -m -R -nodisplay -a /N/u/brlife/git/vistasoft/mrDiffusion/templates -d compiled main

Now AFQ seems to be finding the templates and executing as it should be.

@soichih soichih closed this as completed Apr 11, 2018
@soichih soichih reopened this Apr 12, 2018
@soichih
Copy link
Author

soichih commented Apr 12, 2018

Sorry, I was wrong.. I am still seeing a different but similar error message.

Please download mrVista and add it to your matlab search path
Whole-brain tractography was already done for subject /N/u/hayashis/Karst/testdata/108323/dtiinit/dtiYou chose to recompute ROIs
Fibers that get as close to the ROIs as 2mm will become candidates for the Mori Groups
** ERROR (nifti_image_read): failed to find header file for 'templates/MNI_JHU_T2.nii.gz'


nim is NULL! Check to be sure the file exists.

Smoothing by 0 & 8mm..
Index exceeds matrix dimensions.

Error in spm_normalise (line 159)


Error in mrAnatComputeSpmSpatialNorm (line 83)


Error in AFQ_SegmentFiberGroups (line 176)


Error in AFQ_run (line 169)


Error in main (line 29)

MATLAB:badsubscript

The nifti_image_read vistasoft/fileFilters/nifti/C-code/nifti1_io.c is a C code and it looks for files in native file system.. not the Matlab's virtual filesystem that comes with the compiled binary.

One possible way to solve this creating a copy of the template file from matlab's virtual directory to local directory (??) and let mrAnatComputeSpmSpatialNorm() to use that local file instead.

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

1 participant