Documentation for ToolBox

This module is inherited from DataSet class and allows for high-level functionality while working with the raw imaging data.

convert_to_nrrd(self, export_path, region_of_interest='all', image_type=<class 'numpy.int16'>)

Convert DICOM dataset to the volume (NRRD) format.

Parameters:
  • export_path (str) – Path to the folder where the converted NRRDs will be placed.

  • region_of_interest (str) – If you know exact name of the ROI you want to extract, then write it with the ! character in front, eg. region_of_interest = !gtv1 , if you want to extract all the GTVs in the rtstructure eg. gtv1, gtv2, gtv_whatever, then just specify the stem word eg. region_of_interest = gtv, default value is region_of_interest ='all' , which means that all ROIs in rtstruct will be extracted.

  • image_type – Data type of the input image.

extract_features(self, params_file, loggenabled=False)

Extract PyRadiomic features from the dataset.

Parameters:
  • params_file (str) – File with the PyRadiomics parameters for features extraction.

  • loggenabled (bool) – Enable/disable log file writing.

Returns:
  • DataFrame – DataFrame with the extracted features.

get_dataset_description(self, parameter_list=['Modality', 'SliceThickness', 'PixelSpacing', 'SeriesDate', 'Manufacturer'])

Get specified metadata from the DICOM files of the dataset.

Parameters:
  • parameter_list (list) – List of the parameters to be collected from DICOM files.

Returns:
  • DataFrame – DataFrame with the specified parameters for each patient.

get_jpegs(self, export_path)

Convert each slice of nnrd containing ROI to JPEG image. Quick and convienient way to check your ROIs after conversion.

Parameters:
  • export_path (str) – Path to the folder where the JPEGs will be generated.

get_quality_checks(self, qc_parameters={'specific_modality': '', 'thickness_range': [], 'scan_length_range': [], 'axial_res': [], 'spacing_range': [], 'kernels_list': []}, verbosity=False)

Perform a basic quality check for the data. If one of the quality checked parameters is not passed, the correspondig check is not to be performed.

Parameters:
  • specific_modality (str) – Target modality of the dataset.

  • thickness_range (list) – Range of the acceptable slice thicknesses, minimum and maximum.

  • scan_length_range (list) – Range of the acceptable number of slices, minimum and maximum.

  • axial_res (list) – Target axial resolution, in both dimensions.

  • spacing_range (list) – Range of the acceptable in-plane pixel spacing, minimum and maximum.

  • kernels_list (list) – List of the acceptable kernels for CT data.

  • verbosity (bool) – Enable log reporting.

Returns:
  • DataFrame – DataFrame with the quality check results for each patient. If '1' - check passed, if '0' - check failed.

pre_process(self, ref_img_path=None, save_path=None, z_score=False, norm_coeff=None, hist_match=False, hist_equalize=False, binning=False, percentile_scaling=False, corr_bias_field=False, subcateneus_fat=False, fat_value=None, reshape=False, to_shape=None, window_filtering_params=None, verbosity=False, visualize=False)

Pre-process the images.

Parameters:
  • ref_img_path (str) – Path to the reference image for the histogram matching.

  • save_path (str) – Path to the folder where the pre-processed images will be stored.

  • z_score (bool) – Enable Z-scoring.

  • norm_coeff (tuple) – Normalization coefficients for z-scoring (mean and standard deviation).

  • hist_match (bool) – Enable histogram matching.

  • hist_equalize (bool) – Enable histogram equalization.

  • binning (bool) – Enable intensities resampling.

  • percentile_scaling (bool) – Enable intensities scaling based on 95 percentile.

  • corr_bias_field (bool) – Enable bias field correction.

  • subcateneus_fat (bool) – Enable intensities rescaling based on subcateneus fat.

  • fat_value (bool) – Intensity value specific for the fat.

  • reshape (bool) – Enable 3D reshaping of the images.

  • to_shape (<built-in function array>) – Target shape for image reshaping.

  • verbosity (bool) – Enable log reporting.

  • visualize (bool) – Enable visualization of every pre-processing step.