<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_offsets(self, pix):
 """Get offset of the first pixel in each dimension in the global coordinate system. Parameters pix : `~numpy.ndarray` Pixel coordinates in global coordinate system. """


        idx = []
        for i in range(self.ndim):

            if i == 0:
                idx += [0]
            else:
                npix1 = int(self.shape[i])
                pix0 = int(pix[i - 1]) - npix1 // 2
                idx += [pix0]

        return idx