Clear Filters
Clear Filters

Function 'niftiinfo' undefined in compiled app

5 views (last 30 days)
I am using MATLAB Runtime and a compiled version of SPM to do image analysis. Runtime was installed with the Image Processing Toolbox. SPM's built in spm_vol works to read a NIfTI header. I am using someone else's code that uses niftiinfo instead. This works in my full MATLAB, but when I run the script using compiled SPM in MATLAB Runtime I get:
Undefined function 'niftiread' for input arguments of type 'char'.
I tried testing another Image Processing Toolbox command imread and this worked as expected. I am using Runtime v9.10. Is there any special dependency that would break only niftiinfo? (I got the same error for niftiread). If so please let me know what I need to add to get niftiread to work in the Runtime environment. Otherwise, please let me know if there are other tests I can do to diagnose the problem.

Answers (1)

aditi bagora
aditi bagora on 27 Oct 2023
Hi Paul,
I understand that you encountered an error while using the "niftiread" function from the Image Processing Toolbox. It seems that this error is specific to the "niftiread" function, as other functions are working correctly in your runtime environment.
According to the documentation, "niftiread" is supported starting from MATLAB R2017b, and since you mentioned that your runtime version is v9.10, it should not be the cause of the problem. Additionally, since other functions are working fine, it indicates that the Image Processing Toolbox itself is functioning properly.
To address this issue, you can try clearing the toolbox cache and restoring the default path by following these steps:
  1. Run the command "rehash toolboxcache" to clear the toolbox cache.
  2. Execute the command "restoredefaultpath" to restore the default MATLAB path.
  3. Save the updated path by running "savepath".
% These commands can help ensure that the toolbox cache is refreshed,
% and the default path is restored, which may resolve any potential conflicts or inconsistencies.
rehash toolboxcache
Here is a MATLAB Answer related to your query which might help you to resolve the error:
Please refer to the following articles for more for information regarding clearing cache and restoring the default path:
Hope this helps with your query.
  1 Comment
Paul Wright
Paul Wright on 27 Oct 2023
Hi Aditi. Thanks for your answer. This was over a year ago and I can't remember how I solved it in the end. For the sake of other people finding this answer in a search, can you clarify where those commands are used? Is it when compiling, or at runtime? The link you gave looks like it applies to running something interactively in full MATLAB rather than running compiled code in MATLAB Runtime.

Sign in to comment.




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!