  The relative orientation between filamentary structures in molecular clouds
and the ambient magnetic field provides insight into filament formation and
stability. To calculate the relative orientation, a measurement of filament
orientation is first required. We propose a new method to calculate the
orientation of the one pixel wide filament skeleton that is output by filament
identification algorithms such as \textsc{filfinder}. We derive the local
filament orientation from the direction of the intensity gradient in the
skeleton image using the Sobel filter and a few simple post-processing steps.
We call this the `Sobel-gradient method'. The resulting filament orientation
map can be compared quantitatively on a local scale with the magnetic field
orientation map to then find the relative orientation of the filament with
respect to the magnetic field at each point along the filament. It can also be
used in constructing radial profiles for filament width fitting. The proposed
method facilitates automation in analysis of filament skeletons, which is
imperative in this era of `big data'.
