Synthesis¶
Patch Based Synthesis¶
-
class
synthit.
PatchSynth
(regr, patch_size=3, n_samples=100000.0, context_radius=(3, 5, 7), threshold=None, poly_deg=None, mean=False, full_patch=False, flatten=True, use_xyz=False)¶ provides the model for training and synthesizing MR neuro images via patch-based methods
Parameters: - regr (sklearn model) – an instantiated model class (e.g., sklearn.ensemble.forest.RandomForestRegressor) needs to have a fit and predict public method
- patch_size (int) – size of patch to use (patch_size x patch_size x patch_size)
- n_samples (int) – number of patches (i.e., samples) to use from each image
- context_radius (tuple) – tuple containing number of voxels away to get context from (e.g., (3,5) means get context values at 3 voxels and 5 voxels away from the patch center)
- threshold (float) – threshold that separated background and foreground (foreground greater than threshold) if None, then use the image mean as the threshold
- poly_deg (int) – degree of polynomial features to generate from patch samples
- mean (bool) – use the mean of the patch instead of the patch values
- full_patch (bool) – use a full patch instead of the 6-nearest neighbors
- flatten (bool) – flatten the target voxel intensities (needed in some types of regressors)
- use_xyz (bool) – use x,y,z coordinates as features
-
extract_patches_predict
(source, mask=None)¶ extract patches and get indices for prediction/synthesis
-
extract_patches_train
(source, target, mask=None)¶ get patches and corresponding target voxel intensity values for training
-
fit
(source, target, mask=None)¶ train the model for synthesis given a set of source and target images
-
static
image_list
(img_dir)¶ convenience function to get a list of images in ANTsImage format
-
predict
(source, mask=None)¶ synthesize/predict an image from a source (input) image