niftynet.utilities.histogram_standardisation module

Implementation of Nyúl László G., Jayaram K. Udupa, and Xuan Zhang. “New variants of a method of MRI scale standardization.” IEEE transactions on medical imaging 19.2 (2000): 143-150.

This implementation only supports input images with floating point number, (not integers).

niftynet.utilities.histogram_standardisation.create_mapping_from_multimod_arrayfiles(array_files, field, modalities, mod_to_train, cutoff, masking_function)

Performs the mapping creation based on a list of files. For each of the files (potentially multimodal), the landmarks are defined for each modality and stored in a database. The average of these landmarks is returned providing the landmarks to use for the linear mapping of any new incoming data :param array_files: List of image files to use :param list_modalities: Name of the modalities used for the standardisation and the corresponding order in the multimodal files :param cutoff: Minimum and maximum landmarks percentile values to use for

the mapping
Parameters:masking_function – Describes how the mask is defined for each image.
Returns:
niftynet.utilities.histogram_standardisation.create_standard_range()
niftynet.utilities.histogram_standardisation.read_mapping_file(mapping_file)

Reads an existing mapping file with the given modalities. :param mapping_file: file in which mapping is stored :return mapping_dict: dictionary containing the mapping landmarks for each modality stated in the mapping file

niftynet.utilities.histogram_standardisation.smooth_threshold(value, mode='high')
niftynet.utilities.histogram_standardisation.transform_by_mapping(img, mask, mapping, cutoff, type_hist='quartile')

Performs the standardisation of a given image :param img: image to standardise :param mask: mask over which to determine the landmarks :param mapping: mapping landmarks to use for the piecewise linear transformations :param cutoff: cutoff points for the mapping :param type_hist: Type of landmarks scheme to use: choice between quartile percentile and median :return new_img: the standardised image

niftynet.utilities.histogram_standardisation.write_all_mod_mapping(hist_model_file, mapping)