For a first try, I first reoriented the axes by applying a linear transform to my segmentation and volume as shown below.
I then applied the SlicePlotArea.py code. However, the plot did not take the transform into account and instead plotted the original axis.
I am looking for another method to try. I believe I need to resample my segmentation and volume, but I’m not sure how to do this. When I tried using Resample Scalar/Vector/DWI Volume Module along with my transform, all of my views became black.
Since a linear transform is applied, hardening would not resample the volume.
A simple solution would be to create an ROI node, rotate it with a transform so that it is aligned with the axis directions that you need and use that in Crop volume module to crop/resample the volume.
You can set up the transform manually, using sliders and/or interactively moving/rotating in a 3D view (in Transforms module, enable Display / Interaction / Visible in 3D view). Or, create the ROI automatically from an open curve node (in recent Slicer Preview version) by dropping a curve point in the middle of the femur head, a second point along the femur, and copy-pasting this code into the Python console:
You can rotate slice views to align with volume axes by clicking pushpin icon at the top-left corner of the slice view controller and clicking “Rotate to volume plane” button.
You can then perform cross section analysis using this cropped volume.
Thank you very much for the detailed response Andras! I was able to get the SliceAreaPlot code to work along my defined axis using the methods you described. I opted to manually set-up the ROI node and transform.