Python code for ijk_to_lps coordinates?

Hi, I have a 3d model in lps that corresponds to a few ct views. I saw that there’s a affine transformation from the image ijk (dicom) to the lps coordinates Coordinate systems - Slicer Wiki

I’m trying to map the lps coordinate on the model to the ct views(axial, coronal, sagittal), I looked at my sample files manually and it looks like everything matches up if I took from the same orientation on the 3d model(say axial), translate x,y based on the image patient position, and then get the mm distance from pixel spacing to get the same coordinate space in lps. Is there python code that does the affine transformation available somewhere?

There are examples similar to this in the script repository.