I was wondering if anyone has had a similar problem and could help me figure this out.

In short: I have a preoperative and postoperative CT of a femur. Postoperative the proximal femur above the trochanter minor has been repositioned. We want to measure this reposition.

Because we have multiple patients we would like to create a local coordinate system for consistent measurement. For this i figured we could appoint the femoral shaft axis as the Z-axis and pick another landmark to create a coordinate system.

I’ve tried the vascular modeling toolkit, however the medullary cavity seems to disrupt the algorithm.

Is there a possibility to get the center point of multiple axial slices of the femoral shaft segmentation and creating a trendline through these points to create the femoral shaft axis?

I did, unfortunately the CT is only of the proximal part of the femur. The medullary cavity seems to give VMTK some problems in calculating the centerline correctly as shown here:

If i were to fill in the medullary cavity and it would create the centerline, would i then be able to construct a line averaging this one? (so a straight line i could use as my z axis?).

Bones are not perfectly straight so you still obtain a centerline curve but then you would just select two points of it that delineate your region of interest, that would be the two points to create the axis line you want.

You can solve the cavity with the WrapSolidify effect of the extensions manager. You should apply it using the segment editor over the current femur segmentation you have. Then use vmtk centerline extraction.

If you have a almost-straight bone model exported from your segmentation you may also have a look at this algorithm: