Generate NRRD header from DICOM header

I already read .npy file from a LPS coordinate system DICOM folder and generate a .npy mask. When I want to generate the .nrrd header from the DICOM header, and I got confused about the results.

For the dicom header, I read:
(0018, 0050) Slice Thickness DS: ‘1.1000000238419’
(0028, 0030) Pixel Spacing DS: [0.80357140302658, 0.80357140302658]
(0020, 0032) Image Position (Patient) DS: [-191.80030483817, -176.12590213898, 86.606538507263]
(0020, 0037) Image Orientation (Patient) DS: [0.9993283937409, -2.051034E-10, 0.036643709737, 2.049657E-10, 1, 7.5158E-12]

To generate space directions in NRRD, I generate the z space directions by cross product, with the reference of Slicer Coordinate System.

origin = dicom_data.ImagePositionPatient
x_spacing, y_spacing = dicom_data.PixelSpacing
z_spacing = dicom_data.SliceThickness

direction_x = np.array(dicom_data.ImageOrientationPatient[:3])
direction_y = np.array(dicom_data.ImageOrientationPatient[3:])
direction_z = np.cross(direction_x, direction_y)

space_direction_x = direction_x * x_spacing
space_direction_y = direction_y * y_spacing
space_direction_z = direction_z * z_spacing
space_directions = np.stack((space_direction_x, space_direction_y, space_direction_z)).tolist()

The generated space_directions is:
array([[ 9.99328394e-01, -2.05103400e-10, 3.66437097e-02],
[ 2.04965700e-10, 1.00000000e+00, 7.51580000e-12],
[-4.03080807e-02, -5.35973205e-17, 1.09926123e+00]])

Looks like the z spacing is positive. But the second slice is DICOM folder has smaller z origin value. Is that possible? Actually I tried to manually draw a segmentation in Slicer and Slicer generate the same NRRD header with same Spacing Directions. And the segmentation I generated can be properly showed in Slicer.

So I’m wondering why the DICOM z spacing (space directions[2][2]) is positive but the second slice origin is smaller than the first slice? And is my code generating NRRD header from LPS DICOM can be applied to all situations? Thanks.