How read the 3D image ?

1 visualizzazione (ultimi 30 giorni)
Vasantha Lakshmi
Vasantha Lakshmi il 4 Mar 2017
I read the .mha file using mha_read_header(filename),but it is showing error.
Invalid field name: 'dim[0]'.
Error in mha_read_header (line 78) info.(type)=data;
Error in three (line 1) info = mha_read_header('a.mha'); What can I do to solve this problem.

Risposta accettata

Guillaume
Guillaume il 4 Mar 2017
I'm assuming you're using this function (always a good idea to mention where your code comes from). I don't know anything about it but after a quick glance it would appear that your file contains a field in the header that the reader doesn't know about. When reading unknown field, it simply creates a field with the same name in the output structure.
Unfortunately, in your case, that unknown field is not a valid field name for matlab structures. The quick fix would be to modify that line 78 to:
info(matlab.lang.makeValidName(type)) = data;
While that would fix the immediate error, there's no guarantee that the code will yet be able to read your file since, as said, the code knows nothing about that dim[0] field which may well be critical.
  3 Commenti
Guillaume
Guillaume il 4 Mar 2017
Well, clearly that reader cannot read your file. You will have to find a different reader or save your file in a way supported by that reader. Failing that, you will have to write your own reader.
Vasantha Lakshmi
Vasantha Lakshmi il 4 Mar 2017
Thank U sir.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Data Import and Analysis in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by