class_docstr: Implement the :term:`General Linear Model<GLM>` for multiple     subject :term:`fMRI` data.
  
  Parameters
  ----------
  mask_img : Niimg-like, :class:`~nilearn.maskers.NiftiMasker` or             :class:`~nilearn.maskers.MultiNiftiMasker`, optional
      Mask to be used on data. If an instance of masker is passed,
      then its mask will be used. If no mask is given,
      it will be computed automatically by a
      :class:`~nilearn.maskers.MultiNiftiMasker` with default
      parameters. Automatic mask computation assumes first level imgs have
      already been masked.
  %(target_affine)s
  
      .. note::
          This parameter is passed to :func:`nilearn.image.resample_img`.
  
  %(target_shape)s
  
      .. note::
          This parameter is passed to :func:`nilearn.image.resample_img`.
  
  %(smoothing_fwhm)s
  %(memory)s
  %(memory_level1)s
  %(verbose0)s
      If 0 prints nothing. If 1 prints final computation time.
      If 2 prints masker computation details.
  %(n_jobs)s
  minimize_memory : :obj:`bool`, default=True
      Gets rid of some variables on the model fit results that are not
      necessary for contrast computation and would only be useful for
      further inspection of model details. This has an important impact
      on memory consumption.
class_docstr_tok: ["Implement","the",":","term",":","`","General","Linear","Model","<","GLM",">","`","for","multiple","subject",":","term",":","`","fMRI","`","data",".","Parameters","--","--","--","--","--","mask_img",":","Niimg-like",",",":","class",":","`","~nilearn.maskers.NiftiMasker","`","or",":","class",":","`","~nilearn.maskers.MultiNiftiMasker","`",",","optional","Mask","to","be","used","on","data",".","If","an","instance","of","masker","is","passed",",","then","its","mask","will","be","used",".","If","no","mask","is","given",",","it","will","be","computed","automatically","by","a",":","class",":","`","~nilearn.maskers.MultiNiftiMasker","`","with","default","parameters",".","Automatic","mask","computation","assumes","first","level","imgs","have","already","been","masked",".","%","(","target_affine",")","s","..","note",":",":","This","parameter","is","passed","to",":","func",":","`","nilearn.image.resample_img","`",".","%","(","target_shape",")","s","..","note",":",":","This","parameter","is","passed","to",":","func",":","`","nilearn.image.resample_img","`",".","%","(","smoothing_fwhm",")","s","%","(","memory",")","s","%","(","memory_level1",")","s","%","(","verbose0",")","s","If","0","prints","nothing",".","If","1","prints","final","computation","time",".","If","2","prints","masker","computation","details",".","%","(","n_jobs",")","s","minimize_memory",":",":","obj",":","`","bool","`",",","default=True","Gets","rid","of","some","variables","on","the","model","fit","results","that","are","not","necessary","for","contrast","computation","and","would","only","be","useful","for","further","inspection","of","model","details",".","This","has","an","important","impact","on","memory","consumption","."]
code: def __init__(
      self,
      mask_img=None,
      target_affine=None,
      target_shape=None,
      smoothing_fwhm=None,
      memory=Memory(None),
      memory_level=1,
      verbose=0,
      n_jobs=1,
      minimize_memory=True,
  ):
      self.mask_img = mask_img
      self.target_affine = target_affine
      self.target_shape = target_shape
      self.smoothing_fwhm = smoothing_fwhm
      memory = stringify_path(memory)
      self.memory = (
          Memory(memory) if isinstance(memory, str) else memory
      )
      self.memory_level = memory_level
      self.verbose = verbose
      self.n_jobs = n_jobs
      self.minimize_memory = minimize_memory
      self.second_level_input_ = None
      self.confounds_ = None
      self.labels_ = None
      self.results_ = None
  
imports: import sys
  import time
  from warnings import warn
  import numpy
  import pandas
  from joblib import Memory
  from nibabel import Nifti1Image
  from sklearn.base import clone
  from nilearn._utils import fill_doc, stringify_path
  from nilearn._utils.niimg_conversions import check_niimg
  from nilearn.glm._base import BaseGLM
  from nilearn.glm.contrasts import compute_contrast, expression_to_contrast_vector
  from nilearn.glm.first_level import FirstLevelModel, run_glm
  from nilearn.glm.first_level.design_matrix import make_second_level_design_matrix
  from nilearn.glm.regression import RegressionResults, SimpleRegressionResults
  from nilearn.image import mean_img
  from nilearn.maskers import NiftiMasker
  from nilearn.mass_univariate import permuted_ols
label_desc: Use image node_id 1 to create a new SecondLevelModel object from inherited base classes: BaseGLM with example: obj = SecondLevelModel(mask_img, target_affine, target_shape, smoothing_fwhm, memory, memory_level, verbose, n_jobs, minimize_memory)