cortex.utils.add_roi

cortex.utils.add_roi(data, name='new_roi', open_inkscape=True, add_path=True, overlay_file=None, **kwargs)[source]

Add new flatmap image to the ROI file for a subject.

(The subject is specified in creation of the data object)

Creates a flatmap image from the data input, and adds that image as a sub-layer to the data layer in the rois.svg file stored for the subject in the pycortex database. Most often, this is data to be used for defining a region (or several regions) of interest, such as a localizer contrast (e.g. a t map of Faces > Houses).

Use the **kwargs inputs to specify

Parameters:
dataDataView

The data used to generate the flatmap image.

namestr, optional
Name that will be assigned to the data sub-layer in the rois.svg file

(e.g. ‘Faces > Houses, t map, p<.005’ or ‘Retinotopy - Rotating Wedge’)

open_inkscapebool, optional

If True, Inkscape will automatically open the ROI file.

add_pathbool, optional

If True, also adds a sub-layer to the rois new SVG layer will automatically be created in the ROI group with the same name as the overlay.

overlay_filestr, optional

Custom overlays.svg file to use instead of the default one for this subject (if not None). Default None.

**kwargs

Additional keyword arguments are forwarded to cortex.quickflat.make_png (note that height, with_rois, and with_labels are already set by this function and cannot be overridden):

recachebool, optional

Whether to re-generate intermediate files. Takes longer to plot this way, but can resolve some errors.

pixelwisebool, optional

Use pixel-wise mapping.

samplerstr, optional

Name of sampling function used to sample underlying volume data.

bgcolormatplotlib colorspec, optional

Color of background of image. None (default) gives transparent background.

dpiint, optional

DPI of the generated image.

Further keyword arguments accepted by make_png’s own **kwargs (forwarded on to cortex.quickflat.make_figure, e.g. depth, with_colorbar, with_borders, with_dropout, with_curvature, linewidth, linecolor, roifill, shadow, labelsize, labelcolor, cutout) are also accepted here.

Returns:
returncodeint or None

If open_inkscape is True, the return code from launching Inkscape (via subprocess.call). If open_inkscape is False, returns None.