code: def clip_boxes_numpy(boxes, window):
      """
      boxes: [N, 4] each col is y1, x1, y2, x2 / [N, 6] in 3D.
      window: iamge shape (y, x, (z))
      """
      if boxes.shape[1] == 4:
          boxes = np.concatenate(
              (
                  np.clip(boxes[:, 0], 0, window[0])[:, None],
                  np.clip(boxes[:, 1], 0, window[0])[:, None],
                  np.clip(boxes[:, 2], 0, window[1])[:, None],
                  np.clip(boxes[:, 3], 0, window[1])[:, None],
              ),
              1,
          )
  
      else:
          boxes = np.concatenate(
              (
                  np.clip(boxes[:, 0], 0, window[0])[:, None],
                  np.clip(boxes[:, 1], 0, window[0])[:, None],
                  np.clip(boxes[:, 2], 0, window[1])[:, None],
                  np.clip(boxes[:, 3], 0, window[1])[:, None],
                  np.clip(boxes[:, 4], 0, window[2])[:, None],
                  np.clip(boxes[:, 5], 0, window[2])[:, None],
              ),
              1,
          )
  
      return boxes
  
imports: import numpy
  import scipy.misc
  import scipy.ndimage
  import torch
  from torch.autograd import Variable
  import torch.nn
label_desc: Use image node_id 14 for calling a global function with example usage: clip_boxes_numpy(boxes, window) and returns: boxes