neurite.py.dataproc
Data processing for neurite.
filestruct_change
change from independent subjects in a folder to breakdown structure
example: filestruct_change('/../in_path', '/../out_path', {'asegs.nii.gz':'asegs', 'norm.nii.gz':'vols'})
input structure: /.../in_path/subj_1 --> with files that match regular repressions defined in re_map.keys() /.../in_path/subj_2 --> with files that match regular repressions defined in re_map.keys() ... output structure: /.../out_path/asegs/subj_1.nii.gz, subj_2.nii.gz /.../out_path/vols/subj_1.nii.gz, subj_2.nii.gz
Parameters: in_path (string): input path out_path (string): output path re_map (dictionary): keys are reg-exs that match files in the input folders. values are the folders to put those files in the new structure. values can also be tuples, in which case values[0] is the dst folder, and values[1] is the extension of the output file mode (optional) use_symlinks (bool): whether to just use symlinks rather than copy files default:True
Source code in neurite/py/dataproc.py
ml_split
ml_split(in_path, out_path, cat_titles=['train', 'validate', 'test'], cat_prop=[0.5, 0.3, 0.2], use_symlinks=False, seed=None, tqdm=tqdm)
split dataset
Source code in neurite/py/dataproc.py
prior_to_weights
transform a 4D prior (3D + nb_labels) into a class weight vector
Source code in neurite/py/dataproc.py
proc_mgh_vols
process mgh data from mgz format and save to numpy format
- load file
- normalize intensity
- resize
- save as python block
TODO: check header info and such.?
Source code in neurite/py/dataproc.py
vol_proc
vol_proc(vol_data, crop=None, resize_shape=None, interp_order=None, rescale=None, rescale_prctle=None, resize_slices=None, resize_slices_dim=None, offset=None, clip=None, extract_nd=None, force_binary=None, permute=None)
process a volume with a series of intensity rescale, resize and crop rescale