dsets - Simple manipulation of datasets¶
methods to do simple manipulations of datasets
-
class
neural.dsets.DsetInfo[source]¶ Container for dset meta-data
All lists are returned in RAI order (i.e., a list of 3 numbers refers to the R-L axis, A-P axis, then I-S axis)
-
neural.dsets.afni_copy(filename)[source]¶ creates a
+origcopy of the given dataset and returns the filename as a string
-
neural.dsets.bounding_box(dset)[source]¶ return the coordinates (in RAI) of the corners of a box enclosing the data in
dset
-
neural.dsets.dset_grids_equal(dsets)[source]¶ Tests if each dataset in the
listdsetshas the same number of voxels and voxel-widths
-
neural.dsets.is_dset(filename)[source]¶ just checks if the filename has the format of an fMRI dataset
-
neural.dsets.nifti_copy(filename, prefix=None, gzip=True)[source]¶ creates a
.niicopy of the given dataset and returns the filename as a string
-
neural.dsets.resample_dset(dset, template, prefix=None, resam='NN')[source]¶ Resamples
dsetto the grid oftemplateusing resampling moderesam. Default prefix is to suffix_resamat the end ofdset- Available resampling modes:
NN: Nearest Neighbor Li: Linear Cu: Cubic Bk: Blocky
-
neural.dsets.strip_subbrick(filename)[source]¶ returns the filename without any
[]subbrick modifiers
-
neural.dsets.subbrick(dset, label, coef=False, tstat=False, fstat=False, rstat=False, number_only=False)[source]¶ returns a string referencing the given subbrick within a dset
This method reads the header of the dataset
dset, finds the subbrick whose label matcheslabeland returns a string of typedataset[X], which can be used by most AFNI programs to refer to a subbrick within a fileThe options coef, tstat, fstat, and rstat will add the suffix that is appended to the label by 3dDeconvolve
Coef: “#0_Coef” Tstat: “#0_Tstat” Fstat: “_Fstat” Rstat: “_R^2” If
coefortstatare set to a number, it will use that parameter number (instead of 0), for models that use multiple parameters (e.g., “TENT”).if
number_onlyis set toTrue, will only return the subbrick number instead of a string
-
neural.dsets.suffix(filename, suffix)[source]¶ returns a filenames with
suffixinserted before the dataset suffix
-
class
neural.dsets.temp_afni_copy(in_dset, out_dsets=None)[source]¶ used within a
withblock, will create a temporary+origcopy of datasetWhen invoked in a
withblock, will make a+origcopy of the given dataset and return the filename as a string.On exiting the block, it will delete the
+origcopy. If out_dsets is a string or list of strings, it will try to make nifti copies of all datasets listed and then delete the original version if successful. AFNI datasets should be specified with the+view.- Example usage::
- with temp_afni_copy(‘dataset.nii.gz’) as dset_afni:
- do_something_with_a_dset(dset_afni)
- with temp_afni_copy(‘dataset.nii.gz’,’output_dataset+orig’) as dset_afni:
- do_something_with_a_dset(dset_afni,output=’output_dataset’)