vampire.quickstart.fit_models#

vampire.quickstart.fit_models(img_info_df, random_state=None, savefig=True)[source]#

Fits all models from the input info of image sets.

Parameters:
img_info_dfDataFrame

Contains all information about image sets to be analyzed. See notes.

random_stateint, optional

Random state of random processes.

savefigbool, optional

Whether save distribution contour dendrogram.

Notes

Learn more about basics and advanced input requirement and examples. Below is a general description.

Required columns of img_info_df (col 1-6)

The input DataFrame img_info_df must contain, in order, the 6 required columns of

img_set_pathstr

Path to the directory containing the image set(s) used to fit model.

output_pathstr

Path of the directory used to output model and figures. Defaults to img_set_path.

model_namestr, default

Name of the model. Defaults to time of function call.

n_pointsint, default

Number of sample points of object contour. Defaults to 50.

n_clustersint, default

Number of clusters of K-means clustering. Defaults to 5. Recommended range [2, 10].

n_pcsint, default

Number of principal components kept for analysis. Default to keeping those that explains 95% of total variance. Recommended to adjust after analyzing scree plot.

in the first 5 columns. The default values are used in default columns when (1) the space is left blank in csv/excel file before converting to DataFrame, or (2) the space is None/np.NaN in the DataFrame.

Warning

The required columns must appear in order in the first 5 columns, even when defaults are used.

Optional columns of img_info_df (col 7-)

The input DataFrame img_info_df could also contain any number (none to many) of optional columns at the right of the required columns. These optional columns serve as filters to the image filenames. The images with filenames containing values of all filters are used in analysis.

filter1str, optional

Regex filter of image filenames to be analyzed. E.g. “c1” for channel 1.

filter2str, optional

Regex filter of image filenames to be analyzed. E.g. “cortex” for sample region.

str, optional

Regex filter of image filenames to be analyzed. E.g. “40x” for magnification.

Tip

The column names of optional columns does not affect the analysis. The values in the columns only serves as filters to images to be analyzed.