# labs.spatial_models.parcellation

## Module: `labs.spatial_models.parcellation`

Inheritance diagram for `nipy.labs.spatial_models.parcellation`:

Generic Parcellation class: Contains all the items that define a multi-subject parcellation

Author : Bertrand Thirion, 2005-2008

TODO : add a method ‘global field’, i.e. non-subject-specific info

## `MultiSubjectParcellation`

class nipy.labs.spatial_models.parcellation.MultiSubjectParcellation(domain, template_labels=None, individual_labels=None, nb_parcel=None)

  Bases: `object`

  MultiSubjectParcellation class are used to represent parcels that can have different spatial different contours in a given group of subject It consists of self.domain: the specification of a domain self.template_labels the specification of a template parcellation self.individual_labels the specification of individual parcellations

  fixme:should inherit from mroi.MultiROI

  __init__(domain, template_labels=None, individual_labels=None, nb_parcel=None)

    Initialize multi-subject parcellation

    Parameters:
      domain: discrete_domain.DiscreteDomain instance,

        definition of the space considered in the parcellation

      template_labels: array of shape domain.size, optional

        definition of the template labelling

      individual_labels: array of shape (domain.size, nb_subjects), optional,

        the individual parcellations corresponding to the template

      nb_parcel: int, optional,

        number of parcels in the model can be inferred as template_labels.max()+1, or 1 by default cannot be smaller than template_labels.max()+1

  check()

    Performs an elementary check on self

  copy()

    Returns a copy of self

  get_feature(fid)

    Get feature defined by fid

    Parameters:
      fid: string, the feature identifier
  make_feature(fid, data)

    Compute parcel-level averages of data

    Parameters:
      fid: string, the feature identifier
      data: array of shape (self.domain.size, self.nb_subj, dim) or

        (self.domain.sire, self.nb_subj) Some information at the voxel level

    Returns:
      pfeature: array of shape(self.nb_parcel, self.nbsubj, dim)

        the computed feature data

  population()

    Returns the counting of labels per voxel per subject

    Returns:
      population: array of shape (self.nb_parcel, self.nb_subj)
  set_feature(fid, data)

    Set feature defined by fid and data into `self`

    Parameters:
      fid: string

        the feature identifier

      data: array of shape (self.nb_parcel, self.nb_subj, dim) or

        > (self.nb_parcel, self.nb_subj)

        the data to be set as parcel- and subject-level information

  set_individual_labels(individual_labels)
  set_template_labels(template_labels)