I-HARMONIZE Module

The I-HARMONIZE module allows users to harmonize images to a reference image using various harmonization methods (currently, only histogram matching is available). Harmonization can be applied to the entire image or limited to specific areas using masks.

Options

The I-HARMONIZE module supports the following options:

  • verbose: Enable verbose output for detailed process information (default: False).

  • timer: Enable a timer to record execution time (default: False).

  • inputFolder: Path to the folder containing the input images.

  • outputFolder: Path to save the harmonized images.

  • outputFolderSuffix: Adds a suffix to the inputFolder name to create the output folder.

  • log: Path to a log file for saving detailed output information.

  • new_log_file: Create a new log file, overwriting any existing file with the same name.

  • skip: Path to a file listing subfolders in inputFolder to exclude from processing.

  • multiprocessing: Specify the number of CPU cores to use for parallel processing.

  • image_filename: Name of the image file to read for harmonization.

  • mask_filename: Name of the mask file for the input image, to restrict harmonization to specific regions (optional).

  • reference_image: Full path to the reference image for harmonization.

  • reference_mask: Full path to the mask file for the reference image, for region-specific harmonization (optional).

  • harmonized_image_filename: Name for the harmonized output image (default: h_img.nii.gz).

  • method: Harmonization method to apply (currently, only “histogram_matching” is available).

  • suffix_name: Suffix to add to the output image name, overriding harmonized_image_filename if specified.

Example Usage

The following example demonstrates how to use the I-HARMONIZE module:

I-HARMONIZATION:
{
    inputFolder: /path/to/NIFTI_folder
    image_filename: img.nii.gz
    mask_filename: msk.nii.gz
    harmonized_image_filename: img_h.nii.gz
    reference_image: /path/to/Reference/Images/img.nii.gz
    reference_mask: /path/to/Reference/Images/msk.nii.gz
    method: histogram_matching
    log: /path/to/logs/harmonize.log
    new_log: True
}

In this example:

  • inputFolder: Specifies the folder containing the images to harmonize.

  • image_filename and harmonized_image_filename: Define the input and output filenames.

  • reference_image: Specifies the reference image used for harmonization.

  • method: Indicates “histogram_matching” as the harmonization method.

  • log: Specifies the path for the log file.

NiftiImageHarmonization_multiprocessing.harmonize_image(patient, inpath, outpath, img_name, msk_name, ref_img_name, ref_msk_name, h_img_name, method, n_bins, n_matchPoints, dif_path, skip_files, include_files, verbose, log)[source]
NiftiImageHarmonization_multiprocessing.main(argv)[source]