parameters: (self, voxsize, interp_method='linear', smooth_sigma=0)
return_statement: return resliced_vol
docstring: Returns the resampled volume with a given resolution determined by voxel
          size in mm.
  
          Parameters:
              voxsize: Voxel size of target volume. Can be single value or list.
              interp_method: Interpolation method. Must be 'linear' or 'nearest'. Default is 'linear'.
              smooth_sigma: Apply gaussian smoothing before resampling (kernel size is
                  in voxel space). Default is 0.
docstring_summary: Returns the resampled volume with a given resolution determined by voxel
          size in mm.
docstring_tokens: Returns the resampled volume with a given resolution determined by voxel size in mm .
function: def reslice(self, voxsize, interp_method='linear', smooth_sigma=0):
          '''
          Returns the resampled volume with a given resolution determined by voxel
          size in mm.
  
          Parameters:
              voxsize: Voxel size of target volume. Can be single value or list.
              interp_method: Interpolation method. Must be 'linear' or 'nearest'. Default is 'linear'.
              smooth_sigma: Apply gaussian smoothing before resampling (kernel size is
                  in voxel space). Default is 0.
          '''
  
          # convert single value to list
          if not isinstance(voxsize, Iterable):
              voxsize = [voxsize] * self.basedims
  
          if np.allclose(voxsize, self.voxsize):
              return self
  
          src_shape = self.shape[:3]
          target_shape = tuple(np.ceil(np.array(self.voxsize).astype(float) * src_shape / voxsize).astype(int))
          
          # get source-to-RAS matrix
          src2ras = self.affine if self.affine is not None else LIA(src_shape, self.voxsize)
  
          # compute target-to-RAS matrix
          pcrs = np.append(np.array(src_shape) / 2, 1)
          cras = np.matmul(src2ras, pcrs)[:3]
          trg2ras = np.eye(4)
          trg2ras[:3, :3] = src2ras[:3, :3] * voxsize / self.voxsize
          pcrs = np.append(np.array(target_shape) / 2, 1)
          trg2ras[:3, 3] = cras - np.matmul(trg2ras, pcrs)[:3]
  
          # compute target-to-source matrix
          ras2src = np.linalg.inv(src2ras)
          trg2src = np.matmul(ras2src, trg2ras)
  
          # resample into new volume
          if self.data.ndim != 3:
              target_shape = (*target_shape, self.nframes)
          resliced_data = resample(self.data, target_shape, trg2src, interp_method=interp_method, smooth_sigma=smooth_sigma)
          resliced_vol = Volume(resliced_data, affine=trg2ras, voxsize=voxsize)
          resliced_vol.copy_metadata(self)
          return resliced_vol
function_tokens: def reslice ( self , voxsize , interp_method = 'linear' , smooth_sigma = 0 ) : # convert single value to list if not isinstance ( voxsize , Iterable ) : voxsize = [ voxsize ] * self . basedims if np . allclose ( voxsize , self . voxsize ) : return self src_shape = self . shape [ : 3 ] target_shape = tuple ( np . ceil ( np . array ( self . voxsize ) . astype ( float ) * src_shape / voxsize ) . astype ( int ) ) # get source-to-RAS matrix src2ras = self . affine if self . affine is not None else LIA ( src_shape , self . voxsize ) # compute target-to-RAS matrix pcrs = np . append ( np . array ( src_shape ) / 2 , 1 ) cras = np . matmul ( src2ras , pcrs ) [ : 3 ] trg2ras = np . eye ( 4 ) trg2ras [ : 3 , : 3 ] = src2ras [ : 3 , : 3 ] * voxsize / self . voxsize pcrs = np . append ( np . array ( target_shape ) / 2 , 1 ) trg2ras [ : 3 , 3 ] = cras - np . matmul ( trg2ras , pcrs ) [ : 3 ] # compute target-to-source matrix ras2src = np . linalg . inv ( src2ras ) trg2src = np . matmul ( ras2src , trg2ras ) # resample into new volume if self . data . ndim != 3 : target_shape = ( * target_shape , self . nframes ) resliced_data = resample ( self . data , target_shape , trg2src , interp_method = interp_method , smooth_sigma = smooth_sigma ) resliced_vol = Volume ( resliced_data , affine = trg2ras , voxsize = voxsize ) resliced_vol . copy_metadata ( self ) return resliced_vol