pycortex icon indicating copy to clipboard operation
pycortex copied to clipboard

DOC: Make an identity transform example

Open anwarnunez opened this issue 6 years ago • 1 comments

Anatomical data can be viewed using the built-in identity transform in pycortex:

import cortex
nifti = cortex.db.get_anat('S1')
arr = nifti.get_data().T
vol = cortex.Volume(arr, 'S1', 'identity')
cortex.webgl.show(vol)

anwarnunez avatar Jan 02 '19 23:01 anwarnunez

Just stumbled on this, so will add my two cents.

The use of nifti.get_data() is deprecated, and nifti.get_fdata() is preferred. Another alternative to achieve the same thing with an identity transform:

import cortex
import numpy as np
vol = cortex.Volume.empty('S1', 'identity', np.nan)
cortex.webgl.show(vol)

IvanAlvarez avatar Aug 07 '20 16:08 IvanAlvarez