mtex-toolbox / mtex

MTEX is a free Matlab toolbox for quantitative texture analysis. Homepage:
http://mtex-toolbox.github.io/
GNU General Public License v2.0
288 stars 185 forks source link

Quaternion class object name conflict with quaternion objects from various MATLAB toolboxes #2138

Closed ZhangxiJesseFeng closed 5 months ago

ZhangxiJesseFeng commented 5 months ago

MTEX could initialize normally if I have MTEX added to path and initialized at launch, then install the toolboxes with quaternions, but I cannot use the quaternion functions from the toolboxes, as MTEX has priority. If I uninstall MTEX, then I can use the quaternion functions, but when I try to reinstall MTEX, I get the errors below. Not a huge priority issue, but might be nice to address the name conflict in the future.

Error Message If you get an error message copy and paste it below

********************************************************************************
  MTEX: Couldn't get the mex files working!

  The original error message was:

Error using check_installation>fast_check_mex
Invalid default value for property 'rot' in class 'symmetry':
Class 'quaternion' is Sealed and may not be used as a superclass.

Error in check_installation (line 20)
    fast_check_mex

Error in startup_mtex (line 69)
check_installation;

Error in install_mtex (line 13)
  startup_mtex('noMenu')

 Please have a look at https://mtex-toolbox.github.io/installation
 or ask in the forum https://github.com/mtex-toolbox/mtex/discussions for help.

********************************************************************************

--------------------------------------------------------------------------------

********************************************************************************

  MTEX: Error running NFFT with openMP - I'm going to try it without openmp!

  MTEX: Error running NFFT without openMP!

 I did not get NFFT working. This restricts the functionality of MTEX.
 To overcome this restriction you may need to compile the NFFT your own.
 Please have a look at https://github.com/mtex-toolbox/mtex/blob/develop/extern/nfft_openMP/readme.md
 or ask in the forum https://github.com/mtex-toolbox/mtex/discussions for help.

  The original error message was:

Error using check_installation>check_NSOFT
Invalid default value for property 'rot' in class 'symmetry':
Class 'quaternion' is Sealed and may not be used as a superclass.

Error in check_installation (line 54)
  check_NSOFT

Error in startup_mtex (line 69)
check_installation;

Error in install_mtex (line 13)
  startup_mtex('noMenu')

What MTEX version do you use? 5.10.2

ralfHielscher commented 5 months ago

Hi Zhang,

  1. What toolbox are you using that has its own quaternion implementation?
  2. We could put all MTEX functions into a MTEX namespace. However, this would requite, that throughout all code one has to write mtex.Miller() or mtex.EBSD.load(). The problem is that Matlab does not support specifying a namespace for a block of code.

Ralf

ZhangxiJesseFeng commented 5 months ago

There are quite a few: sensor fusion, navigation, radar, etc. The issue is if I create a quaternion object via MTEX, it does not initialize a quaternion object in those toolboxes and I cannot use the quaternion functions from them. I don't know how they resolve conflicts among themselves, maybe their functions are consistent.

Yeah I see the difficulty in it. It never occurred to me either until I tried to use slerp function the other day. Maybe we can add slerp in MTEX.

ralfHielscher commented 5 months ago

Hi Zhang,

these are official Matlab toolboxes which uses the official Matlab quaternion class. There are two reasons MTEX does not use the Matlab quaternion class (1) MTEX is older than the Matlab quaternion class. and (2) the MTEX implementation is much faster.

From my perspective the toolboxes you mentioned do not have so much in common with MTEX. What you are working on that you want to use MTEX in combination with any of these?

Ralf.

ZhangxiJesseFeng commented 5 months ago

It is not that I need a combination of the toolboxes, I just have one MATLAB installation with everything in it. It is not a huge issue of the name conflict, I was able to run what I needed to run after uninstalling MTEX. To reinstall MTEX I had to uninstall the toolboxes.