code: def test_mask_brain():
      # Inputs for generate_signal
      dimensions = np.array(
          [10, 10, 10]
      )  # What is the size of the brain
      feature_size = [2]
      feature_type = ["cube"]
      feature_coordinates = np.array([[4, 4, 4]])
      signal_magnitude = [30]
  
      # Generate a volume representing the location and quality of the signal
      volume = sim.generate_signal(
          dimensions=dimensions,
          feature_coordinates=feature_coordinates,
          feature_type=feature_type,
          feature_size=feature_size,
          signal_magnitude=signal_magnitude,
      )
  
      # Mask the volume to be the same shape as a brain
      mask, _ = sim.mask_brain(
          dimensions,
          mask_self=None,
      )
      brain = volume * mask
  
      assert np.sum(brain != 0) == np.sum(
          volume != 0
      ), "Masking did not work"
      assert brain[0, 0, 0] == 0, "Masking did not work"
      assert brain[4, 4, 4] != 0, "Masking did not work"
  
      feature_coordinates = np.array([[1, 1, 1]])
  
      volume = sim.generate_signal(
          dimensions=dimensions,
          feature_coordinates=feature_coordinates,
          feature_type=feature_type,
          feature_size=feature_size,
          signal_magnitude=signal_magnitude,
      )
  
      # Mask the volume to be the same shape as a brain
      mask, _ = sim.mask_brain(
          dimensions,
          mask_self=None,
      )
      brain = volume * mask
  
      assert np.sum(brain != 0) < np.sum(
          volume != 0
      ), "Masking did not work"
  
      # Test that you can load the default
      dimensions = np.array([100, 100, 100])
      mask, template = sim.mask_brain(dimensions, mask_self=False)
  
      assert mask[20, 80, 50] == 0, "Masking didn" "t work"
      assert mask[25, 80, 50] == 1, "Masking didn" "t work"
      assert (
          int(template[25, 80, 50] * 100) == 57
      ), "Template not correct"
  
      # Check that you can mask self
      mask_self, template_self = sim.mask_brain(
          template, mask_self=True
      )
  
      assert (template_self - template).sum() < 1e2, "Mask self error"
      assert (mask_self - mask).sum() == 0, "Mask self error"
  
file_path: brainiak/tests/utils/test_fmrisim.py
imports: import numpy
  import math
  from brainiak.utils import fmrisim
  import pytest
  from itertools import product
label_desc: Use image node_id 6 for calling a global function with example usage: test_mask_brain() without return types