code: def segment_vertebra(self, request, image, centroids):
      original_size = list(image.shape)
      result_mask = None
  
      l = None
      image_cached = None
      count = 0
      for centroid in tqdm(centroids):
          # For Debuging - select few label...
          # logger.info(f"Centroid: {centroid}")
          # lkey = list(centroid.keys())[0]
          # if lkey not in ("label_20", "label_22", "label_24"):
          #     continue
  
          req = copy.deepcopy(request)
          req.update(
              {
                  "image": image,
                  "image_cached": image_cached,
                  "original_size": original_size,
                  "centroids": [centroid],
                  "pipeline_mode": True,
                  "logging": "ERROR" if count > 1 else "INFO",
              }
          )
  
          d, r = self.task_seg_vertebra(req)
          l = self._latencies(r, l)
  
          image = d["image"]
          image_cached = image
  
          # Paste/Merge each mask
          v = d["current_label"]
          s = d["slices_cropped"]
          m = d["pred"]
          m[m > 0] = v
  
          mask = torch.zeros_like(image)
          mask[
              :,
              s[-3][0] : s[-3][1],
              s[-2][0] : s[-2][1],
              s[-1][0] : s[-1][1],
          ] = m
  
          if result_mask is None:
              result_mask = mask
          else:
              result_mask = result_mask + mask
              result_mask[result_mask > v] = v
  
          count = count + 1
  
      return result_mask, l
  
imports: import copy
  import logging
  import time
  from typing import Callable, Sequence
  import torch
  from tqdm import tqdm
  from monailabel.interfaces.tasks.infer_v2 import InferTask, InferType
  from monailabel.interfaces.utils.transform import run_transforms
  from monailabel.tasks.infer.basic_infer import BasicInferTask
  from monailabel.transform.post import Restored
  from monailabel.transform.writer import Writer
  from monailabel.utils.others.generic import name_to_device
label_desc: Use image node_id 8 for calling the InferVertebraPipeline obj's underlying member method code with example usage: obj.segment_vertebra(request, image, centroids) and returns: result_mask,  l