def worker_landmarks_curved(self, arguments_worker):
        try:
            iz = arguments_worker[0]
            iz_curved, x_centerline_deriv, y_centerline_deriv, z_centerline_deriv, x_centerline_fit, y_centerline_fit, \
                z_centerline = arguments_worker[1]

            temp_results = []

            if iz in iz_curved:
                # calculate d using formula: ax + by + cz + d = 0
                a = x_centerline_deriv[iz]
                b = y_centerline_deriv[iz]
                c = z_centerline_deriv[iz]
                x = x_centerline_fit[iz]
                y = y_centerline_fit[iz]
                z = z_centerline[iz]
                d = -(a * x + b * y + c * z)

                # set coordinates for landmark at the center of the cross
                coord = Coordinate([0, 0, 0, 0])
                coord.x, coord.y, coord.z = x_centerline_fit[iz], y_centerline_fit[iz], z_centerline[iz]
                temp_results.append(coord)

                # set y coordinate to y_centerline_fit[iz] for elements 1 and 2 of the cross
                cross_coordinates = [Coordinate(), Coordinate(), Coordinate(), Coordinate(),
                                     Coordinate(), Coordinate(), Coordinate(), Coordinate(),
                                     Coordinate(), Coordinate(), Coordinate(), Coordinate(),
                                     Coordinate(), Coordinate(), Coordinate(), Coordinate()]

                cross_coordinates[0].y = y_centerline_fit[iz]
                cross_coordinates[1].y = y_centerline_fit[iz]

                # set x and z coordinates for landmarks +x and -x, forcing de landmark to be in the orthogonal plan
                # and the distance landmark/curve to be gapxy
                x_n = Symbol('x_n')
                cross_coordinates[1].x, cross_coordinates[0].x = solve((x_n - x) ** 2 +
                                                                       ((-1 / c) * (a * x_n + b * y + d) - z) ** 2 -
                                                                       self.gapxy ** 2, x_n)  # x for -x and +x
                cross_coordinates[0].z = (-1 / c) * (a * cross_coordinates[0].x + b * y + d)  # z for +x
                cross_coordinates[1].z = (-1 / c) * (a * cross_coordinates[1].x + b * y + d)  # z for -x

                # set x coordinate to x_centerline_fit[iz] for elements 3 and 4 of the cross
                cross_coordinates[2].x = x_centerline_fit[iz]
                cross_coordinates[3].x = x_centerline_fit[iz]

                # set coordinates for landmarks +y and -y. Here, x coordinate is 0 (already initialized).
                y_n = Symbol('y_n')
                cross_coordinates[3].y, cross_coordinates[2].y = solve((y_n - y) ** 2 +
                                                                       ((-1 / c) * (a * x + b * y_n + d) - z) ** 2 -
                                                                       self.gapxy ** 2, y_n)  # y for -y and +y
                cross_coordinates[2].z = (-1 / c) * (a * x + b * cross_coordinates[2].y + d)  # z for +y
                cross_coordinates[3].z = (-1 / c) * (a * x + b * cross_coordinates[3].y + d)  # z for -y


                # set the first corner
                cross_coordinates[4].y = y_centerline_fit[iz] + self.gapxy
                cross_coordinates[5].y = y_centerline_fit[iz] + self.gapxy

                # set x and z coordinates for landmarks +x and -x, forcing de landmark to be in the orthogonal plan
                # and the distance landmark/curve to be gapxy
                cross_coordinates[5].x, cross_coordinates[4].x = solve((x_n - x) ** 2 +
                                                                       ((-1 / c) * (a * x_n + b * (y + self.gapxy) + d)
                                                                        - z) ** 2 - self.gapxy ** 2, x_n)
                cross_coordinates[4].z = (-1 / c) * (a * cross_coordinates[4].x + b * (y + self.gapxy) + d)  # z for +x
                cross_coordinates[5].z = (-1 / c) * (a * cross_coordinates[5].x + b * (y + self.gapxy) + d)  # z for -x

                # set the other corner
                cross_coordinates[6].y = y_centerline_fit[iz] - self.gapxy
                cross_coordinates[7].y = y_centerline_fit[iz] - self.gapxy

                # set x and z coordinates for landmarks +x and -x, forcing de landmark to be in the orthogonal plan
                # and the distance landmark/curve to be gapxy
                cross_coordinates[7].x, cross_coordinates[6].x = solve((x_n - x) ** 2 +
                                                                       ((-1 / c) * (a * x_n + b * (y - self.gapxy) + d)
                                                                        - z) ** 2 - self.gapxy ** 2, x_n)
                cross_coordinates[6].z = (-1 / c) * (a * cross_coordinates[6].x + b * (y - self.gapxy) + d)  # z for +x
                cross_coordinates[7].z = (-1 / c) * (a * cross_coordinates[7].x + b * (y - self.gapxy) + d)  # z for -x

                gapxy = self.gapxy/2
                cross_coordinates[8].y = y_centerline_fit[iz]
                cross_coordinates[9].y = y_centerline_fit[iz]

                # set x and z coordinates for landmarks +x and -x, forcing de landmark to be in the orthogonal plan
                # and the distance landmark/curve to be gapxy
                x_n = Symbol('x_n')
                cross_coordinates[9].x, cross_coordinates[8].x = solve((x_n - x) ** 2 +
                                                                       ((-1 / c) * (a * x_n + b * y + d) - z) ** 2 -
                                                                       gapxy ** 2, x_n)  # x for -x and +x
                cross_coordinates[8].z = (-1 / c) * (a * cross_coordinates[8].x + b * y + d)  # z for +x
                cross_coordinates[9].z = (-1 / c) * (a * cross_coordinates[9].x + b * y + d)  # z for -x

                # set x coordinate to x_centerline_fit[iz] for elements 3 and 4 of the cross
                cross_coordinates[10].x = x_centerline_fit[iz]
                cross_coordinates[11].x = x_centerline_fit[iz]

                # set coordinates for landmarks +y and -y. Here, x coordinate is 0 (already initialized).
                y_n = Symbol('y_n')
                cross_coordinates[11].y, cross_coordinates[10].y = solve((y_n - y) ** 2 +
                                                                       ((-1 / c) * (a * x + b * y_n + d) - z) ** 2 -
                                                                       gapxy ** 2, y_n)  # y for -y and +y
                cross_coordinates[10].z = (-1 / c) * (a * x + b * cross_coordinates[10].y + d)  # z for +y
                cross_coordinates[11].z = (-1 / c) * (a * x + b * cross_coordinates[11].y + d)  # z for -y


                # set the first corner
                cross_coordinates[12].y = y_centerline_fit[iz] + gapxy
                cross_coordinates[13].y = y_centerline_fit[iz] + gapxy

                # set x and z coordinates for landmarks +x and -x, forcing de landmark to be in the orthogonal plan
                # and the distance landmark/curve to be gapxy
                cross_coordinates[13].x, cross_coordinates[12].x = solve((x_n - x) ** 2 +
                                                                       ((-1 / c) * (a * x_n + b * (y + gapxy) + d)
                                                                        - z) ** 2 - gapxy ** 2, x_n)
                cross_coordinates[12].z = (-1 / c) * (a * cross_coordinates[12].x + b * (y + gapxy) + d)  # z for +x
                cross_coordinates[13].z = (-1 / c) * (a * cross_coordinates[13].x + b * (y + gapxy) + d)  # z for -x

                # set the other corner
                cross_coordinates[14].y = y_centerline_fit[iz] - gapxy
                cross_coordinates[15].y = y_centerline_fit[iz] - gapxy

                # set x and z coordinates for landmarks +x and -x, forcing de landmark to be in the orthogonal plan
                # and the distance landmark/curve to be gapxy
                cross_coordinates[15].x, cross_coordinates[14].x = solve((x_n - x) ** 2 +
                                                                       ((-1 / c) * (a * x_n + b * (y - gapxy) + d)
                                                                        - z) ** 2 - gapxy ** 2, x_n)
                cross_coordinates[14].z = (-1 / c) * (a * cross_coordinates[14].x + b * (y - gapxy) + d)  # z for +x
                cross_coordinates[15].z = (-1 / c) * (a * cross_coordinates[15].x + b * (y - gapxy) + d)  # z for -x

                for coord in cross_coordinates:
                    temp_results.append(coord)
            else:
                if self.all_labels >= 1:
                    temp_results.append(Coordinate([x_centerline_fit[iz], y_centerline_fit[iz],
                                                    z_centerline[iz], 0], mode='continuous'))

            return iz, temp_results

        except __HOLE__:
            return

        except Exception as e:
            raise e
dataset/ETHPy150Open neuropoly/spinalcordtoolbox/dev/straightening/sct_straighten_spinalcord_LargeFOVOutput.py/SpinalCordStraightener.worker_landmarks_curved