text: import cv2
  import numpy as np
  
  
  
  def get_references_volume(v, only_include=[]):
      """
      Returns a Volume object with the same dimensions as v,
      which contains only a binary representation of the
      references. The desired references to include in the 
      volume can be filtered. 
  
      Parameters
      ----------
      v : Volume
          Volume to be analyzed, with the attached references.
      only_include : list, optional
          List of references that should be included, if is not passed
          or an empty list is passed, all the references wiil be included
          in the output volume, by default []
  
      Returns
      -------
      Volume
          Volume containing only the references inside.
      """    
      if only_include in [[], None]:
          only_include = list(v.references.keys())
      v2 = v.copy()
      v2._v = np.zeros(v2._v.shape, dtype='float64')
  
  
      for r, points in v.references.items():
          if r in only_include:
              for p in points:
                  x, y, z, r, i = list(p)
                  x, y, z, r = v.to_voxel_coordinates(x, y, z, r)
                  # TODO: Get circular regions instead of squared
                  v2._v[x-r:x+r, y-r:y+r, z-r:z+r] = 1.0
      return v2
  
  
  def compare_volumes(v1, v2, axes=[0,1,2], delay=100):
      """
      Show all the cuts of two equivalent volumes in the given axes.
  
      Parameters
      ----------
      v1 : Volume
          First Volume to be inspected
      v2 : Volume
          Second Volume to be inspected
      axes : list, optional
          List of axes that are going to be used to generate 
          the cuts, by default [0,1,2]
      delay : int, optional
          Time to show each cut, by default 100
  
      Raises
      ------
      ValueError
          When different shaped Volume Objects are passed
      """  
  
      if v1._v.dtype != v2._v.dtype:
          raise ValueError("Volumes have to have the same dimensions")
  
      for i in axes:
          v1.itter_axis = i
          v2.itter_axis = i
          axis_lenght = v1._v.shape[i]
          for j in range(axis_lenght):
              v1_cut = v1[j]
              v2_cut = v2[j]
              cv2.imshow(f'Volume 1 in axis {i}', v1_cut)
              cv2.imshow(f'Volume 2 in axis {i}', v2_cut)
              cv2.waitKey(delay) 
              
  
  def inspect_volume(v, axes=[0,1,2], delay=100, name="Volume Preview"):
      """
      Show all the cuts of a volume in the given axes.
  
      Parameters
      ----------
      v : Volume
          Volume to be inspected
      axes : list, optional
          List of axes that are going to be used to generate 
          the cuts, by default [0,1,2]
      delay : int, optional
          Time to show each cut, by default 100
      name: str, optional
          Name of the display window, by default 'Volume Preview'
      """    
      for i in axes:
          v.itter_axis = i
          for cut in v:
              cv2.imshow(f'{name} in axis {i}', cut)
              cv2.waitKey(delay) 
  
  
  
  def inspect_references(v, axes=[0,1,2], delay=100):
      """
      Show all the cut of a volume in the given axes.
  
      Parameters
      ----------
      v : Volume
          Volume to be inspected
      axes : list, optional
          List of axes that are going to be used to generate 
          the cuts, by default [0,1,2]
      delay : int, optional
          Time to show each cut, by default 100    
      """    
  
      v2 = get_references_volume(v)
      inspect_volume(v2, axes=axes, delay=delay, name='References')
  