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).

create_mapping_from_multimod_arrayfiles(array_files, field, modalities, mod_to_train, cutoff, masking_function)[source]

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

Parameters:
  • array_files – List of image files to use
  • modalities – Name of the modalities used for the standardisation and the corresponding order in the multimodal files
  • cutoff – Minimum and maximum landmarks percentile values to use for the mapping
  • masking_function – Describes how the mask is defined for each image.
Returns:

create_standard_range()[source]
transform_by_mapping(img, mask, mapping, cutoff, type_hist='quartile')[source]

Performs the standardisation of a given image.

Parameters:
  • img – image to standardise
  • mask – mask over which to determine the landmarks
  • mapping – mapping landmarks to use for the piecewise linear transformations
  • cutoff – cutoff points for the mapping
  • type_hist – Type of landmarks scheme to use: choice between quartile percentile and median
Return new_img:

the standardised image

smooth_threshold(value, mode='high')[source]
read_mapping_file(mapping_file)[source]

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

write_all_mod_mapping(hist_model_file, mapping)[source]