.. _scil_connectivity_math: scil_connectivity_math ====================== :: usage: __main__.py [-h] [--data_type DATA_TYPE] [--exclude_background] [-v [{DEBUG,INFO,WARNING,ERROR}]] [-f] {lower_threshold,upper_threshold,lower_threshold_eq,upper_threshold_eq,lower_threshold_otsu,upper_threshold_otsu,lower_clip,upper_clip,absolute_value,round,ceil,floor,normalize_sum,normalize_max,log_10,log_e,convert,invert,addition,subtraction,multiplication,division,maximum,mean,std,correlation,union,intersection,difference} in_matrices [in_matrices ...] out_matrix Performs an operation on a list of matrices. The supported operations are listed below. Some operations such as multiplication or addition accept float value as parameters instead of matrices. > scil_connectivity_math multiplication mat.npy 10 mult_10.npy lower_threshold: MAT THRESHOLD All values below the threshold will be set to zero. All values above the threshold will be set to one. upper_threshold: MAT THRESHOLD All values below the threshold will be set to one. All values above the threshold will be set to zero. Equivalent to lower_threshold followed by an inversion. lower_threshold_eq: MAT THRESHOLD All values below the threshold will be set to zero. All values above or equal the threshold will be set to one. upper_threshold_eq: MAT THRESHOLD All values below or equal the threshold will be set to one. All values above the threshold will be set to zero. Equivalent to lower_threshold followed by an inversion. lower_threshold_otsu: MAT All values below or equal to the Otsu threshold will be set to zero. All values above the Otsu threshold will be set to one. (Otsu's method is an algorithm to perform automatic matrix thresholding of the background.) upper_threshold_otsu: MAT All values below the Otsu threshold will be set to one. All values above or equal to the Otsu threshold will be set to zero. Equivalent to lower_threshold_otsu followed by an inversion. lower_clip: MAT THRESHOLD All values below the threshold will be set to threshold. upper_clip: MAT THRESHOLD All values above the threshold will be set to threshold. absolute_value: MAT All negative values will become positive. round: MAT Round all decimal values to the closest integer. ceil: MAT Ceil all decimal values to the next integer. floor: MAT Floor all decimal values to the previous integer. normalize_sum: MAT Normalize the matrix so the sum of all values is one. normalize_max: MAT Normalize the matrix so the maximum value is one. log_10: MAT Apply a log (base 10) to all non zeros values of an matrix. log_e: MAT Apply a natural log to all non zeros values of an matrix. convert: MAT Perform no operation, but simply change the data type. invert: MAT Operation on binary matrix to interchange 0s and 1s in a binary mask. addition: MATs Add multiple matrices together. subtraction: MAT_1 MAT_2 Subtract first matrix by the second (MAT_1 - MAT_2). multiplication: MATs Multiply multiple matrices together (danger of underflow and overflow) division: MAT_1 MAT_2 Divide first matrix by the second (danger of underflow and overflow) Ignore zeros values, excluded from the operation. maximum: MATs Compute the voxel-wise maximum across matrices. mean: MATs Compute the mean of matrices. If a single 4D matrix is provided, average along the last dimension. std: MATs Compute the standard deviation average of multiple matrices. If a single 4D matrix is provided, compute the STD along the last dimension. correlation: MATs Computes the correlation of the 3x3x3 neighborhood of each voxel, for all pair of input matrices. The final matrix is the average correlation (through all pairs). For a given pair of matrices - Background is considered as 0. May lead to very high correlations close to the border of the background regions, or very poor ones if the background in both matrices differ. - Images are zero-padded. For the same reason as higher, may lead to very high correlations if you have data close to the border of the matrix. - NaN values (if a voxel's neighborhood is entirely uniform; std 0) are replaced by - 0 if at least one neighborhood was entirely containing background. - 1 if the voxel's neighborhoods are uniform in both matrices - 0 if the voxel's neighborhoods is uniform in one matrix, but not the other. UPDATE AS OF VERSION 2.0: Random noise was previously added in the process to help avoid NaN values. Now replaced by either 0 or 1 as explained above. union: MATs Operation on binary matrix to keep voxels, that are non-zero, in at least one file. intersection: MATs Operation on binary matrix to keep the voxels, that are non-zero, are present in all files. difference: MAT_1 MAT_2 Operation on binary matrix to keep voxels from the first file that are not in the second file (non-zeros). positional arguments: {lower_threshold,upper_threshold,lower_threshold_eq,upper_threshold_eq,lower_threshold_otsu,upper_threshold_otsu,lower_clip,upper_clip,absolute_value,round,ceil,floor,normalize_sum,normalize_max,log_10,log_e,convert,invert,addition,subtraction,multiplication,division,maximum,mean,std,correlation,union,intersection,difference} The type of operation to be performed on the matrices. in_matrices The list of matrices files or parameters. out_matrix Output matrix path. options: -h, --help show this help message and exit --data_type DATA_TYPE Data type of the output image. Use the format: uint8, float16, int32. --exclude_background Does not affect the background of the original matrices. -v [{DEBUG,INFO,WARNING,ERROR}] Produces verbose output depending on the provided level. Default level is warning, default when using -v is info. -f Force overwriting of the output files. 2.2.2