NIFTI format is very problematic. There are two ways to define IJK to LPS transformation (sform and qform) and not always clear which one should be used and how. Also, NIFTI uses RAS internally, so depending on what library you use to read the header and what options, you might get IJK to RAS.
To eliminate one source of error, I would recommend to save as NRRD format instead.
You can get IJK from LPS in a NRRD file using Python (outside Slicer’s Python environment) as shown here.