PREDICT package¶
Subpackages¶
- PREDICT.IOparser package
- PREDICT.classification package
- PREDICT.featureselection package
- PREDICT.genetics package
- PREDICT.helpers package
- PREDICT.imagefeatures package
- Submodules
- PREDICT.imagefeatures.coliage_features module
- PREDICT.imagefeatures.contour_functions module
- PREDICT.imagefeatures.dti_features module
- PREDICT.imagefeatures.get_features module
- PREDICT.imagefeatures.histogram_features module
- PREDICT.imagefeatures.image_helper module
- PREDICT.imagefeatures.log_features module
- PREDICT.imagefeatures.orientation_features module
- PREDICT.imagefeatures.patient_features module
- PREDICT.imagefeatures.phase_features module
- PREDICT.imagefeatures.semantic_features module
- PREDICT.imagefeatures.shape_features module
- PREDICT.imagefeatures.sitk_helper module
- PREDICT.imagefeatures.texture_features module
- PREDICT.imagefeatures.vessel_features module
- Module contents
- PREDICT.plotting package
- Submodules
- PREDICT.plotting.compute_CI module
- PREDICT.plotting.getfeatureimages module
- PREDICT.plotting.linstretch module
- PREDICT.plotting.plot_ROC module
- PREDICT.plotting.plot_SVM module
- PREDICT.plotting.plot_SVR module
- PREDICT.plotting.plot_barchart module
- PREDICT.plotting.plot_boxplot module
- PREDICT.plotting.plot_images module
- PREDICT.plotting.plot_ranked_scores module
- PREDICT.plotting.plotminmaxresponse module
- PREDICT.plotting.scatterplot module
- Module contents
- PREDICT.processing package
Submodules¶
PREDICT.CalcFeatures module¶
-
PREDICT.CalcFeatures.
CalcFeatures
(image, segmentation, parameters, output, metadata_file=None, semantics_file=None, verbose=True)¶ Calculate features from a ROI of an image. This function serves as a wrapper around the get_features function from the imagefeatures folder. It reads all inputs, processes it through the get_features function per image and ROI and writes the output to HDF5 files.
- image: string, mandatory
- path referring to image file. Should be a format compatible with ITK, e.g. .nii, .nii.gz, .mhd, .raw, .tiff, .nrrd or a DICOM folder.
- segmentation: string, mandatory
- path referring to segmentation file. Should be a format compatible with ITK, e.g. .nii, .nii.gz, .mhd, .raw, .tiff, .nrrd.
- parameters: string, mandatory,
- path referring to a .ini file containing the parameters used for feature extraction. See the Github Wiki for the possible fields and their description.
- output: string, mandatory
- path referring to the .hdf5 file to which the output should be written.
- metadata_file: string, optional
- path referring to a .dcm file from which the patient features will be extracted.
- semantics_file: string, optional
- path referring to a .csv file from which the semantic features will be extracted. See the Github Wiki for the correct format.
- verbose: boolean, default True
- print final feature values and labels to command line or not.
-
PREDICT.CalcFeatures.
load_images
(image_file, image_type, metadata_file=None, semantics_file=None)¶ Load ITK images, the corresponding DICOM file for the metadata, a file containing the semantics and converts them to Python objects.
- image_file: string, mandatory
- path referring to image file. Should be a format compatible with ITK, e.g. .nii, .nii.gz, .mhd, .raw, .tiff, .nrrd. or a DICOM folder.
- image_type: string, mandatory
- defines the modality of the scan used. Different loading functions are used for different modalities.
- metadata_file: string, optional
- path referring to a DICOM file. Used to extract metadata features.
- semantics_file: string, optional
- path referring to a CSV file. Used to extract semantic features.
PREDICT.StatisticalTestFeatures module¶
-
PREDICT.StatisticalTestFeatures.
StatisticalTestFeatures
(features, patientinfo, config, output=None, verbose=True)¶ Perform several statistical tests on features, such as a student t-test. Useage is similar to trainclassifier.
- features: string, mandatory
- contains the paths to all .hdf5 feature files used. modalityname1=file1,file2,file3,... modalityname2=file1,... Thus, modalities names are always between a space and a equal sign, files are split by commas. We assume that the lists of files for each modality has the same length. Files on the same position on each list should belong to the same patient.
- patientinfo: string, mandatory
- Contains the path referring to a .txt file containing the patient label(s) and value(s) to be used for learning. See the Github Wiki for the format.
- config: string, mandatory
- path referring to a .ini file containing the parameters used for feature extraction. See the Github Wiki for the possible fields and their description.
# TODO: outputs
- verbose: boolean, default True
- print final feature values and labels to command line or not.
PREDICT.addexceptions module¶
This module contains all PREDICT-related Exceptions
-
exception
PREDICT.addexceptions.
PREDICTAssertionError
¶ Bases:
PREDICT.addexceptions.PREDICTError
,exceptions.AssertionError
AssertionError in the PREDICT system
-
exception
PREDICT.addexceptions.
PREDICTError
¶ Bases:
exceptions.Exception
This is the base class for all PREDICT related exceptions. Catching this class of exceptions should ensure a proper execution of PREDICT.
-
exception
PREDICT.addexceptions.
PREDICTIOError
¶ Bases:
PREDICT.addexceptions.PREDICTError
,exceptions.IOError
IOError in PREDICT
-
exception
PREDICT.addexceptions.
PREDICTIndexError
¶ Bases:
PREDICT.addexceptions.PREDICTError
,exceptions.IndexError
IndexError in the PREDICT system
-
exception
PREDICT.addexceptions.
PREDICTKeyError
¶ Bases:
PREDICT.addexceptions.PREDICTError
,exceptions.KeyError
KeyError in the PREDICT system
-
exception
PREDICT.addexceptions.
PREDICTNotImplementedError
¶ Bases:
PREDICT.addexceptions.PREDICTError
,exceptions.NotImplementedError
This function/method has not been implemented on purpose (e.g. should be overwritten in a sub-class)
-
exception
PREDICT.addexceptions.
PREDICTTypeError
¶ Bases:
PREDICT.addexceptions.PREDICTError
,exceptions.TypeError
TypeError in the PREDICT system
-
exception
PREDICT.addexceptions.
PREDICTValueError
¶ Bases:
PREDICT.addexceptions.PREDICTError
,exceptions.ValueError
TypeError in the PREDICT system
PREDICT.trainclassifier module¶
-
PREDICT.trainclassifier.
load_features
(feat, patientinfo, label_type)¶ Read feature files and stack the features per patient in an array. Additionally, if a patient label file is supplied, the features from a patient will be matched to the labels.
- featurefiles: list, mandatory
List containing all paths to the .hdf5 feature files to be loaded. The argument should contain a list per modelity, e.g. [[features_mod1_patient1, features_mod1_patient2, ...],
[features_mod2_patient1, features_mod2_patient2, ...]].- patientinfo: string, optional
- Path referring to the .txt file to be used to read patient labels from. See the Github Wiki for the format.
- label_names: list, optional
- List containing all the labels that should be extracted from the patientinfo file.
-
PREDICT.trainclassifier.
trainclassifier
(feat_train, patientinfo_train, config, output_hdf, output_json, feat_test=None, patientinfo_test=None, fixedsplits=None, verbose=True)¶ Train a classifier using machine learning from features. By default, if no split in training and test is supplied, a cross validation will be performed.
- feat_train: string, mandatory
- contains the paths to all .hdf5 feature files used. modalityname1=file1,file2,file3,... modalityname2=file1,... Thus, modalities names are always between a space and a equal sign, files are split by commas. We assume that the lists of files for each modality has the same length. Files on the same position on each list should belong to the same patient.
- patientinfo: string, mandatory
- Contains the path referring to a .txt file containing the patient label(s) and value(s) to be used for learning. See the Github Wiki for the format.
- config: string, mandatory
- path referring to a .ini file containing the parameters used for feature extraction. See the Github Wiki for the possible fields and their description.
- output_hdf: string, mandatory
- path refering to a .hdf5 file to which the final classifier and it’s properties will be written to.
- output_json: string, mandatory
- path refering to a .json file to which the performance of the final classifier will be written to. This file is generated through one of the PREDICT plotting functions.
- feat_test: string, optional
- When this argument is supplied, the machine learning will not be trained using a cross validation, but rather using a fixed training and text split. This field should contain paths of the test set feature files, similar to the feat_train argument.
- patientinfo_test: string, optional
- When feat_test is supplied, you can supply optionally a patient label file through which the performance will be evaluated.
- fixedsplits: string, optional
- By default, random split cross validation is used to train and evaluate the machine learning methods. Optionally, you can provide a .xlsx file containing fixed splits to be used. See the Github Wiki for the format.
- verbose: boolean, default True
- print final feature values and labels to command line or not.