How read the 3D image ?

4 次查看(过去 30 天)
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.

采纳的回答

Guillaume
Guillaume 2017-3-4
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 个评论
Guillaume
Guillaume 2017-3-4
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Import and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by