code: def _unmask_3d(X, mask, order="C"):
      """Take masked data and bring them back to 3D (space only).
  
      Parameters
      ----------
      X : :class:`numpy.ndarray`
          Masked data. shape: (features,)
  
      mask : Niimg-like object
          See :ref:`extracting_data`.
          Mask. mask.ndim must be equal to 3, and dtype *must* be bool.
      """
      if mask.dtype != bool:
          raise TypeError("mask must be a boolean array")
      if X.ndim != 1:
          raise TypeError("X must be a 1-dimensional array")
      n_features = mask.sum()
      if X.shape[0] != n_features:
          raise TypeError(
              f"X must be of shape (samples, {n_features})."
          )
  
      data = np.zeros(
          (mask.shape[0], mask.shape[1], mask.shape[2]),
          dtype=X.dtype,
          order=order,
      )
      data[mask] = X
      return data
  
imports: import numbers
  import warnings
  import numpy
  from joblib import Parallel, delayed
  from scipy.ndimage import binary_dilation, binary_erosion
  from .None import _utils
  from ._utils import fill_doc
  from ._utils.cache_mixin import cache
  from ._utils.ndimage import get_border_data, largest_connected_component
  from ._utils.niimg import safe_get_data
  from .datasets import load_mni152_gm_template, load_mni152_template, load_mni152_wm_template
  from .image import get_data, new_img_like, resampling
label_desc: Use image node_id 13 for calling a global function with example usage: _unmask_3d(X, mask, order) and returns: data