code: def multi_voxel_fit(single_voxel_fit):
      """Method decorator to turn a single voxel model fit
      definition into a multi voxel model fit definition
      """
  
      def new_fit(self, data, mask=None):
          """Fit method for every voxel in data"""
          # If only one voxel just return a normal fit
          if data.ndim == 1:
              return single_voxel_fit(self, data)
  
          # Make a mask if mask is None
          if mask is None:
              shape = data.shape[:-1]
              strides = (0,) * len(shape)
              mask = as_strided(
                  np.array(True), shape=shape, strides=strides
              )
          # Check the shape of the mask if mask is not None
          elif mask.shape != data.shape[:-1]:
              raise ValueError("mask and data shape do not match")
  
          # Fit data where mask is True
          fit_array = np.empty(data.shape[:-1], dtype=object)
          bar = tqdm(total=np.sum(mask), position=0)
          for ijk in ndindex(data.shape[:-1]):
              if mask[ijk]:
                  fit_array[ijk] = single_voxel_fit(self, data[ijk])
                  bar.update()
          bar.close()
          return MultiVoxelFit(self, fit_array, mask)
  
      return new_fit
  
file_path: dipy/dipy/reconst/multi_voxel.py
imports: import numpy
  from numpy.lib.stride_tricks import as_strided
  from tqdm import tqdm
  from dipy.core.ndindex import ndindex
  from dipy.reconst.quick_squash import quick_squash
  from dipy.reconst.base import ReconstFit
label_desc: Use image node_id 1 for calling a global function with example usage: multi_voxel_fit(single_voxel_fit) and returns: new_fit, MultiVoxelFit, single_voxel_fit