Error using medicalref​3d/intrins​icToWorld Invalid argument at position 2. Value must be integer.

5 ビュー (過去 30 日間)
Hi, i try to copy paste and run the live script from your example, but error above pop up. Can anyone help me on this, very new with Matlab and doing a master thesis project on this topic. thanks a milllion in advance.
Create STL Surface Model of Femur Bone for 3-D Printing
best regards
Kam

採用された回答

Cris LaPierre
Cris LaPierre 2024 年 2 月 28 日
編集済み: Cris LaPierre 2024 年 2 月 29 日
There appears to be an issue with the intrinsicToWorld function. There is no requirement in the documentation that these values be positive integers. Please report this to MathWorks here:
  2 件のコメント
Kam Loong
Kam Loong 2024 年 2 月 29 日
Dear Cris LaPierre,
Thank you for your email, I will contact support for further support about this so i can proceed with my paper soonest. Thank you very much.
regards
Kam
Cris LaPierre
Cris LaPierre 2024 年 2 月 29 日
The example does run in R2023a. If you have access to it, you can at least move forward while waiting to hear back.

サインインしてコメントする。

その他の回答 (1 件)

Nicolas CRETIN
Nicolas CRETIN 2024 年 2 月 28 日
編集済み: Nicolas CRETIN 2024 年 2 月 28 日
Hi kam!
Is that your question:
You're trying to run this example (this line only works if you have at least Matlab R2022b):
openExample('medical/Create3DBoneSurfaceModelFor3DPrintingExample')
Then the section of code below (extract of the code):
I = vertices(:,1);
J = vertices(:,2);
K = vertices(:,3);
[X,Y,Z] = intrinsicToWorld(R,I,J,K);
generates the following mistake:
Error using medicalref3d/intrinsicToWorld
[X,Y,Z] = intrinsicToWorld(R,I,J,K);
Invalid argument at position 2. Value must be integer.
If this is your question, then did you tried to add this:
I = floor(I);
J = floor(J);
K = floor(K);
to take the integer part of your vectors I, J and K?
Will there be then any major physical consequences (I mean if you take this integer part)?
Best regards,
Nicolas
  3 件のコメント
Kam Loong
Kam Loong 2024 年 2 月 28 日
Yes, I did run on my own computer, with the latest version, after input your recommended code, error still persist, which i'm trying to understand why the errors. Thanks for replying.
regards
Kam
Transform Vertices into Patient Coordinates
To accurately represent the femur surface points, transform the ijk-coordinates in vertices to the patient coordinate system defined by the medicalref3d object, R. The X, Y, and Z outputs define the xyz-coordinates of the surface points, in millimeters.
I = vertices(:,1);
J = vertices(:,2);
K = vertices(:,3);
I = floor(I);
J = floor(J);
K = floor(K);
[X,Y,Z] = intrinsicToWorld(R,I,J,K)
Error using medicalref3d/intrinsicToWorld
Invalid argument at position 4. Value must be positive.
verticesPatientCoords = [X Y Z];
Create a triangulation of the transformed vertices, verticesPatientCoords. Maintain the original connectivity defined by faces.
triPatient = triangulation(double(faces),double(verticesPatientCoords));
Nicolas CRETIN
Nicolas CRETIN 2024 年 2 月 28 日
編集済み: Nicolas CRETIN 2024 年 2 月 28 日
But then they are still 2889 values of K that are equal to zero and it seems to be an issue
K(K<0)
ans =
0x1 empty single column vector
K(K<=0)
ans =
2889x1 single column vector
So I replaced all the values of K equal to zero by one (be careful, because I have absolutely no idea about the physical consequences it will have). However it allows the following function to work:
K(K<=0) = 1; % set all the values that are equal to zero to 1
[X,Y,Z] = intrinsicToWorld(R,I,J,K);
Please keep in mind that I don't know what this matrix vertices physically represents, so I may have modified it inappropriately! I can just help with the code
Hope it helps!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by