class_docstr: The contrast class handles the estimation of statistical contrasts
  on a given model: student (t), Fisher (F), conjunction (tmin-conjunction).
  The important feature is that it supports addition,
  thus opening the possibility of fixed-effects models.
  
  The current implementation is meant to be simple,
  and could be enhanced in the future on the computational side
  (high-dimensional F contrasts may lead to memory breakage).
  
  Notes
  -----
  The 'tmin-conjunction' test is the valid conjunction test discussed in:
  Nichols T, Brett M, Andersson J, Wager T, Poline JB. Valid conjunction
  inference with the minimum statistic. Neuroimage. 2005 Apr 15;25(3):653-60.
  This test gives the p-value of the z-values under the conjunction null,
  i.e. the union of the null hypotheses for all terms.
class_docstr_tok: ["The","contrast","class","handles","the","estimation","of","statistical","contrasts","on","a","given","model",":","student","(","t",")",",","Fisher","(","F",")",",","conjunction","(","tmin-conjunction",")",".","The","important","feature","is","that","it","supports","addition",",","thus","opening","the","possibility","of","fixed-effects","models",".","The","current","implementation","is","meant","to","be","simple",",","and","could","be","enhanced","in","the","future","on","the","computational","side","(","high-dimensional","F","contrasts","may","lead","to","memory","breakage",")",".","Notes","--","--","-","The","'tmin-conjunction","'","test","is","the","valid","conjunction","test","discussed","in",":","Nichols","T",",","Brett","M",",","Andersson","J",",","Wager","T",",","Poline","JB",".","Valid","conjunction","inference","with","the","minimum","statistic",".","Neuroimage",".","2005","Apr","15",";","25","(","3",")",":653-60",".","This","test","gives","the","p-value","of","the","z-values","under","the","conjunction","null",",","i.e",".","the","union","of","the","null","hypotheses","for","all","terms","."]
docstr: Parameters
  ==========
  effect: array of shape (contrast_dim, n_voxels)
          the effects related to the contrast
  variance: array of shape (contrast_dim, contrast_dim, n_voxels)
            the associated variance estimate
  dof: scalar, the degrees of freedom
  contrast_type: string to be chosen among 't' and 'F'
docstr_tok: ["Parameters","==========","effect",":","array","of","shape","(","contrast_dim",",","n_voxels",")","the","effects","related","to","the","contrast","variance",":","array","of","shape","(","contrast_dim",",","contrast_dim",",","n_voxels",")","the","associated","variance","estimate","dof",":","scalar",",","the","degrees","of","freedom","contrast_type",":","string","to","be","chosen","among","'t","'","and","'","F","'"]
code: def __init__(
      self,
      effect,
      variance,
      dof=DEF_DOFMAX,
      contrast_type="t",
      tiny=DEF_TINY,
      dofmax=DEF_DOFMAX,
  ):
      """
      Parameters
      ==========
      effect: array of shape (contrast_dim, n_voxels)
              the effects related to the contrast
      variance: array of shape (contrast_dim, contrast_dim, n_voxels)
                the associated variance estimate
      dof: scalar, the degrees of freedom
      contrast_type: string to be chosen among 't' and 'F'
      """
      if variance.ndim != 3:
          raise ValueError("Variance array should have 3 dimensions")
      if effect.ndim != 2:
          raise ValueError("Variance array should have 2 dimensions")
      if variance.shape[0] != variance.shape[1]:
          raise ValueError(
              "Inconsistent shape for the variance estimate"
          )
      if (variance.shape[1] != effect.shape[0]) or (
          variance.shape[2] != effect.shape[1]
      ):
          raise ValueError(
              "Effect and variance have inconsistent shape"
          )
      self.effect = effect
      self.variance = variance
      self.dof = float(dof)
      self.dim = effect.shape[0]
      if self.dim > 1 and contrast_type == "t":
          print(
              "Automatically converted multi-dimensional t to F contrast"
          )
          contrast_type = "F"
      self.contrast_type = contrast_type
      self.stat_ = None
      self.p_value_ = None
      self.baseline = 0
      self.tiny = tiny
      self.dofmax = dofmax
  
imports: from warnings import warn
  import numpy
  import scipy.stats
  from nibabel import Nifti1Image, load
  from nipy.algorithms.statistics.models.regression import ARModel, OLSModel
  from nipy.algorithms.statistics.utils import multiple_mahalanobis, z_score
  from nipy.io.nibcompat import get_affine, get_header
  from nipy.labs.mask import compute_mask_sessions
label_desc: Use image node_id 1 to create a new Contrast object  with example: obj = Contrast(effect, variance, dof, contrast_type, tiny, dofmax)