Scaling a part of the bone

Hi,

Can the Anybody Modeling System scale only a part of the bone?
I tried learning from the tutorial but it uses a full thigh bone, whereas I only have a part of the thigh bone to be scaled. Can it be done? If so, how do I define the points and scale a part of the thigh bone rather than the full thigh bone?

Best regards,
Atiq

Hi Atiq,

Yes, it can. There are a couple of ways to do that. We have not added this to the tutorial yet, but it will appear at some point. But I cannot promise that it will be there soon. Here they are:

  1. You can create a new surface file by cutting the generic AnyBody bone and gluing it to the part of the target bone that you want to morph into. You should smoothen the gluing region if planning to use AnyFunTransform3DSTL and this region has holes or other topological problems. If the bone is of different size - you should scale it first using AnyFunTransform3DLin2 and export as an STL surface.

You will need some external tools to manipulate STL surfaces.

  1. Second approach is to use AnyFunTransform3DRBF + AnyFunTransform3DLin2, where the latter one positions the source bone to the target bone (using a few landmarks in the region that will be not be deformed), and then morphing using the full landmark set, but:
    SourceLandmarks=UnchangedRegionLandmarks+ToBeChangedLandmarks;
    TargetLandmarks=UnchangedRegionLandmarks+TargetLandmarksOfTheRegionToBeChanged;

The second one is a little bit easier, but you may need to play with the set of landmarks to make a better match.

The tutorial uses RBF_ThinPlate RBF type, but try using RBF_Triharmonic - it seems to work better. This will also be updated in the tutorial.

Hope this helps.

Best regards,
Pavel

Hi Pavel,

Thank you for your reply.
I tried to input the STL file of part of the knee that I wanted to scale inside the AMS but it keeps giving me error:
ERROR(SYS1) : Model View initialization : Unknown error
Model View failed to initialize drawing objects.

May I know what is the problem?

Best regards,
Atiq

Hi Atiq,

It may happen due to the binary STL format of your surface. Could you convert it to an ASCII STL?

Regards,
Pavel

Hi Pavel,

Thank you very much for your help. I have changed it to ASCII STL and it turns out fine.
Regarding the landmarks, do I need to define the landmarks myself or is there anyway to find out the landmarks for the bone?

Regards,
Atiq

Hi Atiq,

You can use the landmark set that is mentioned in the tutorial, but I cannot suggest anything further since I don’t know how much of the femur is missing, which part, etc. And, in fact, there is no standard solution for partially scanned bones.

You will have to define the morphing law yourself. It may be a good idea if you start from the tutorial model and try adjusting it.

Pavel

Hi Pavel,

I tried to play with the landmarks as suggested before but it seems that the bone seems a little bit weird.
I only have the the condyle and epicondyle part of the femur with a little bit of the bone shaft. I attached the file and the file that I created for the scaling process for your convenience.
Is there any way or suggestion for the part of the knee that I have to be adjusted rightfully to its position?

Regards,
Atiq

Hi Atiq,

Sorry for the delay - have been a little bit busy. I have briefly looked at your problem and what I see is that your initial registration is not great. Please try to reduce the number of landmarks to a few that both present on the partial bone and the full one.

Secondly, if you visualize them - something seems to be wrong with them. They do not lie on the surface. I have not fully investigated it yet. But I may have time to check that next week.

So for now you can do:

  1. Use few landmarks for the affine registration step
  2. Check that the landmarks are well positioned by adding drawing objects

      AnyRefNode a0 = {sRel = .Scaling.SourceLandmarks[0];AnyDrawNode a = {ScaleXYZ={1,1,1}*0.005;};};
...
      AnyRefNode a20 = {sRel = .Scaling.SourceLandmarks[10];AnyDrawNode a = {ScaleXYZ={1,1,1}*0.005;};};
      AnyFolder Scaling = {
        AnyMatrix SourceLandmarks = {
        { 0.0138, 0.0014, 0.0274},
...

Once everything is in the right place - then it should work. The problem comes from malpositioning.

Regards,
Pavel

Hi Pavel,

Thank you very much for your reply.
I have visualized the landmark and commented out most of the landmark for the affine step and using only the 4 points of the condyle. The points also seems to be in place. But the results is quite the same as before.

Could I know the problem?
May I know is there any different if I put AnyFunTransform3DRBF or AnyFunTransform3DLin2 first?

Hi Atiq,

yes, the sequence matters. And it should be AnyFunTransform3DLin2 first, then AnyFunTransform3DRFB. As I said before your landmarks are not OK.

First step is to position the bones on top of each other. You correctly selected 5 landmarks that will have to be used for that. But… you are mixing them with landmarks from other sources and because of that everything goes wrong.

So the workflow should be:

  1. Affine transform with 5 source/target landmarks (if that gives a good match, stop here).
  2. If not 1) morph remaining source landmarks using the constructed affine transform and use them as corresponding target landmarks combined with the real target landmarks.

So if we have S[1-20] and T[1-5] - it should be:
Affine: S[1-5] -> T[1-5]
RBF: S[1-20]->T[1-5]+Affine(S[6-20])

Please make sure that your affine transform moves the bones on top of each other. If it is not happening - everything else will not work either.

Hope that helps,
Pavel

Hi Pavel,

Thank you very much for your reply. It really helps a lot.
I have moved the bone on top of each other using the affine step and noticed that the part of the bone is the right knee whereas the femur is the left leg.
Is there any way to mirror any of the bone to make it as if it is the right leg or the left knee?

Best regards,
Atiq

Hi Atiq,

Yes, you can simply reflect AnyBody geometry and source landmarks about the XY plane. Then use this law for morphing.

This is explained in some details in the scaling tutorial lesson 4. Let me know if something is unclear.

Pavel

Hi Pavel,

Thank you very much for your reply. I have managed to mirror the bone and by using the affine step, move the femur to its rightful location. The first step works well.

Regarding your reply earlier, about the second step, how exactly do I need to do to morph the remaining source landmarks using the constructed affine transform? Im sorry, but I didnt quite understand how do I do this step.

Do I need to define the other remaining landmarks using the affined femur once I had done the affine step? or is there another way to affine the remaining landmarks?

Regards,
Atiq

Hi Atiq,

Sounds good. The second part should transform all generic landmarks using the affine transform to be in the target reference frame. Those that do not have corresponding landmarks will be used as target landmarks themselves after applying the transform. So the final transform should be:
RBFTr: S[1-20] -> T[1-5,6-20], where T[1-5] the ones that you selected, and T[6-20]=AffineTransform(S[6-20]).

You can construct the target matrix as:


AnyMatrix Target = {
 {x0,y0,z0},
  ...
 {xn,yn,zn},
 .Affine({xn1,yn1,zn1}),
  ...
 .Affine({xnm,ynm,znm})
};

Hope that helps,
Pavel

Hi Pavel,

Thank you very much for your guidance. It really helps a lot. I have been able to do the affine step and the RBF transformation well but the part of the femur that I want to transform does not seem to follow the shape of the bone part that I have. It’s a little bit crooked.

The transformation that I had done until now is by using 16 points of landmarks. 5 of them is the same landmark that was used in the affine step.
Do you have any suggestion that I could use?
Is it best if I add more landmarks or reduce the landmarks?
Is there anyway to easily define a landmark or do I have to search it on my own and defining the {x, y, z} point myself?

Best regards,
Atiq

Hi Atiq,

Well, typically it’s a manual process. One can load landmarks from Mimics in their native file format using a class-operation macro. You can right-click on the transform in the model tree and see the options to import/export.

Which landmarks to choose - this is a very difficult question. It will depend on your particular case. How well/bad does your initial registration look? You could play with the bounding box option and other parameters of the RBF - they change the smoothness and extrapolative behaviour of the transform.

Pavel

Hi Pavel,

Sorry for the sudden reply.
I need some help and guidance for the problem that I encountered.
As you can see, the patella on the right side of the leg seems to be a bit off. By using only one bone part as done before, when I tried to input the bone and mirrored it, the bone does not seem right.

May I know what might be the problem?
Thank you for your help

Regards,
Atiq

Hi Atiq,

there might be a few things that went wrong - we need more details. The general recommendation would be to visualize components, joint positions, check your morphing, try to strip the model down to the simplest configuration possible.

Regards,
Pavel

Did you do a reverse transformation? If you look at this thread you will see that I had a similar problem: http://forum.anyscript.org/showthread.php?t=3259&highlight=scaling

Hi Pavel and Patrick,

Thank you for the replies.
In the image that I attached, the reverse transformation had already been done.
It seems it is my mistake. Only the image at first seems to be not right. After I had done the InitialConditions step, the patella seems to move at the right place and the kinematics and inverse dynamic analysis can be done as usual.
But another questions struck me, do the analysis that is done is correct or could it be wrong?
Another question is regarding the graph, there seems to be multiple results for one type of muscle as it is written. For example, SoleusMedialis*, the * points the number and there is three SoleusMedialis. May I know what does the number means?

Regards,
Atiq