How read the 3D image ?

4 Ansichten (letzte 30 Tage)
Vasantha Lakshmi
Vasantha Lakshmi am 4 Mär. 2017
Kommentiert: Vasantha Lakshmi am 4 Mär. 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.

Akzeptierte Antwort

Guillaume
Guillaume am 4 Mär. 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 Kommentare
Guillaume
Guillaume am 4 Mär. 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 am 4 Mär. 2017
Thank U sir.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by