Exemple #1
0
def get_log_features(image, mask, parameters=dict()):
    # Alternatively, one could use the pxehancement function
    image = sitk.GetImageFromArray(image)

    im_size = image.GetSize()

    if "sigma" in parameters.keys():
        sigma = parameters["sigma"]
    else:
        sigma = [1, 5, 10]

    # Make a dummy
    LoG_features = list()
    LoG_labels = list()

    # Create LoG filter object
    LoGFilter = sitk.LaplacianRecursiveGaussianImageFilter()
    LoGFilter.SetNormalizeAcrossScale(True)
    for i_index, i_sigma in enumerate(sigma):
        boolean = False
        # Compute LoG Filter image
        for elem in im_size:
            if elem < 4:
                boolean = True
        if boolean:
            LoG_image = np.zeros((im_size[2], im_size[1], im_size[0]))
        else:
            LoGFilter.SetSigma(i_sigma)
            LoG_image = LoGFilter.Execute(image)
            LoG_image = sitk.GetArrayFromImage(LoG_image)

        # Get histogram features of LoG image for full tumor
        masked_voxels = ih.get_masked_voxels(LoG_image, mask)
        histogram_features, histogram_labels = hf.get_histogram_features(
            masked_voxels, N_BINS)
        histogram_labels = [
            l.replace('hf_', 'logf_') for l in histogram_labels
        ]
        LoG_features.extend(histogram_features)
        final_feature_names = [
            feature_name + '_sigma' + str(i_sigma)
            for feature_name in histogram_labels
        ]
        LoG_labels.extend(final_feature_names)

    return LoG_features, LoG_labels
def get_vessel_features(image, mask, parameters=dict()):
    # Alternatively, one could use the pxehancement function
    if "scale_range" in parameters.keys():
        scale_range = parameters["scale_range"]
    else:
        scale_range = [1, 10]

    # Convert to tuple format accepted by the function
    scale_range = [(scale_range[0], scale_range[1])]

    if "scale_step" in parameters.keys():
        scale_step = parameters["scale_step"]
    else:
        scale_step = [2]

    if "radius" in parameters.keys():
        radius = parameters["radius"]
    else:
        radius = 5

    # Make a dummy
    Frangi_features = list()
    Frangi_labels = list()

    # Create different masks for edge and inner tumor
    disk = morphology.disk(radius)
    mask_edge = np.zeros(mask.shape)
    mask_inner = np.zeros(mask.shape)
    for ind in range(mask.shape[2]):
        mask_e = morphology.binary_erosion(mask[:, :, ind], disk)
        mask_edge[:, :, ind] = np.logical_or(mask[:, :, ind], mask_e)
        mask_inner[:, :, ind] = mask_e

    for i_index, (i_sr, i_ss) in enumerate(zip(scale_range, scale_step)):
        # Compute Frangi Filter image
        Frangi_image = np.zeros(image.shape)
        for i_slice in range(0, image.shape[2]):
            Frangi_image[:, :, i_slice] = frangi(image[:, :, i_slice],
                                                 scale_range=i_sr,
                                                 scale_step=i_ss)

        # Get histogram features of Frangi image for full tumor
        masked_voxels = ih.get_masked_voxels(Frangi_image, mask)
        histogram_features, histogram_labels = hf.get_histogram_features(
            masked_voxels, N_BINS)
        histogram_labels = [
            l.replace('hf_', 'vf_Frangi_full_') for l in histogram_labels
        ]
        Frangi_features.extend(histogram_features)
        final_feature_names = [
            feature_name + '_SR' + str(i_sr) + '_SS' + str(i_ss)
            for feature_name in histogram_labels
        ]
        Frangi_labels.extend(final_feature_names)

        # Get histogram features of Frangi image for edge
        masked_voxels = ih.get_masked_voxels(Frangi_image, mask_edge)

        histogram_features, histogram_labels = hf.get_histogram_features(
            masked_voxels, N_BINS)
        histogram_labels = [
            l.replace('hf_', 'vf_Frangi_edge_') for l in histogram_labels
        ]
        Frangi_features.extend(histogram_features)
        final_feature_names = [
            feature_name + '_SR' + str(i_sr) + '_SS' + str(i_ss)
            for feature_name in histogram_labels
        ]
        Frangi_labels.extend(final_feature_names)

        # Get histogram features of Frangi image inside tumor only
        masked_voxels = ih.get_masked_voxels(Frangi_image, mask_inner)
        histogram_features, histogram_labels = hf.get_histogram_features(
            masked_voxels, N_BINS)
        histogram_labels = [
            l.replace('hf_', 'vf_Frangi_inner_') for l in histogram_labels
        ]
        Frangi_features.extend(histogram_features)
        final_feature_names = [
            feature_name + '_SR' + str(i_sr) + '_SS' + str(i_ss)
            for feature_name in histogram_labels
        ]
        Frangi_labels.extend(final_feature_names)

    return Frangi_features, Frangi_labels
def get_phase_features(image, mask, parameters=dict()):
    # Alternatively, one could use the pxehancement function
    if "minwavelength" in parameters.keys():
        minwavelength = parameters["minwavelength"]
    else:
        minwavelength = [3]

    if "nscale" in parameters.keys():
        nscale = parameters["nscale"]
    else:
        nscale = [5]

    # Make a dummy
    phase_features = list()
    phase_labels = list()

    for i_index, (i_wl, i_sc) in enumerate(zip(minwavelength, nscale)):
        monogenic_image = np.zeros(image.shape)
        phasecon_image = np.zeros(image.shape)
        phasesym_image = np.zeros(image.shape)
        for i_slice in range(0, image.shape[2]):
            # Phase Congruency using Monogenic signal
            M, ori, ft, T = pp.phasecongmono(image[:, :, i_slice],
                                             nscale=i_sc,
                                             minWaveLength=i_wl,
                                             mult=2.1,
                                             sigmaOnf=0.55,
                                             k=2.,
                                             cutOff=0.5,
                                             g=10.,
                                             noiseMethod=-1,
                                             deviationGain=1.5)
            monogenic_image[:, :, i_slice] = ori
            phasecon_image[:, :, i_slice] = M

            # Phase Symmetry using Monogenic signal
            phaseSym, totalEnergy, T = pp.phasesymmono(image[:, :, i_slice],
                                                       nscale=i_sc,
                                                       minWaveLength=i_wl,
                                                       mult=2.1,
                                                       sigmaOnf=0.55,
                                                       k=2.,
                                                       noiseMethod=-1)
            phasesym_image[:, :, i_slice] = phaseSym

        # Get histogram features
        masked_voxels = ih.get_masked_voxels(monogenic_image, mask)
        histogram_features, histogram_labels = hf.get_histogram_features(
            masked_voxels, N_BINS)
        histogram_labels = [
            l.replace('hf_', 'phasef_monogenic_') for l in histogram_labels
        ]
        phase_features.extend(histogram_features)
        final_feature_names = [
            feature_name + '_WL' + str(i_wl) + '_N' + str(i_sc)
            for feature_name in histogram_labels
        ]
        phase_labels.extend(final_feature_names)

        masked_voxels = ih.get_masked_voxels(phasecon_image, mask)
        histogram_features, histogram_labels = hf.get_histogram_features(
            masked_voxels, N_BINS)
        histogram_labels = [
            l.replace('hf_', 'phasef_phasecong_') for l in histogram_labels
        ]
        phase_features.extend(histogram_features)
        final_feature_names = [
            feature_name + '_WL' + str(i_wl) + '_N' + str(i_sc)
            for feature_name in histogram_labels
        ]
        phase_labels.extend(final_feature_names)

        masked_voxels = ih.get_masked_voxels(phasesym_image, mask)
        histogram_features, histogram_labels = hf.get_histogram_features(
            masked_voxels, N_BINS)
        histogram_labels = [
            l.replace('hf_', 'phasef_phasesym_') for l in histogram_labels
        ]
        phase_features.extend(histogram_features)
        final_feature_names = [
            feature_name + '_WL' + str(i_wl) + '_N' + str(i_sc)
            for feature_name in histogram_labels
        ]
        phase_labels.extend(final_feature_names)

    return phase_features, phase_labels
def get_log_features(image, mask, parameters=dict()):
    '''
    Compute features by filtering an image with a Laplacian of Gaussian (LoG)
    filter, after which histogram features are extracted.

    Parameters
    ----------
    image: numpy array, mandatory
            Image array from which the features are extracted.

    mask: numpy array, mandatory
            ROI to be used for feature extraction.

    parameters: dictionary, optional
            Contains the parameters for feature computation. Currently can only
            include a list of sigma values to be used for the LoG filter.
            Default values for sigma are [1, 5, 10].

    Returns
    ----------
    LoG_features: list
            Contains the values for all extracted features.

    LoG_labels: list
            Contains the labels for all extracted features. Each entry
            corresponds to the element with the same index from the
            LoG_features object.

    '''

    # Convert image to array and get size
    image = sitk.GetImageFromArray(image)
    im_size = image.GetSize()

    # mask = sh.GetImageFromArray(mask.astype(np.uint8))
    if "sigma" in parameters.keys():
        sigma = parameters["sigma"]
    else:
        sigma = [1, 5, 10]

    # Make a dummy
    LoG_features = list()
    LoG_labels = list()

    # Create LoG filter object
    LoGFilter = sitk.LaplacianRecursiveGaussianImageFilter()
    LoGFilter.SetNormalizeAcrossScale(True)

    # Iterate over sigmas
    for i_index, i_sigma in enumerate(sigma):
        LoGFilter.SetSigma(i_sigma)
        LoG_image = np.zeros(
            [image.GetSize()[0],
             image.GetSize()[2],
             image.GetSize()[1]])

        # LoG Feature needs a minimum of 4 voxels in each direction
        if not any(t < 4 for t in im_size):
            # Iterate over slices
            for i_slice in range(0, image.GetSize()[0]):
                # Compute LoG Filter image
                LoG_image_temp = LoGFilter.Execute(image[i_slice, :, :])
                LoG_image[i_slice, :, :] = sitk.GetArrayFromImage(
                    LoG_image_temp)

        # Get histogram features of LoG image for full tumor
        masked_voxels = ih.get_masked_voxels(LoG_image, mask)
        histogram_features, histogram_labels = hf.get_histogram_features(
            masked_voxels, N_BINS)
        histogram_labels = [
            l.replace('hf_', 'logf_') for l in histogram_labels
        ]
        LoG_features.extend(histogram_features)
        final_feature_names = [
            feature_name + '_sigma' + str(i_sigma)
            for feature_name in histogram_labels
        ]
        LoG_labels.extend(final_feature_names)

    return LoG_features, LoG_labels
def get_image_features(image_data,
                       masks,
                       parameters,
                       mask_index=-1,
                       multi_mask=False,
                       config=None,
                       output=None):
    if type(image_data) == pd.core.frame.DataFrame:
        images = image_data['images']
        image_types = image_data['images'].keys()
        meta_data = image_data['metadata']
        sem_data = image_data['semantics']
        N_images = len(image_data.images)
    else:
        # Dictionary
        images = image_data['images']
        image_types = image_data['image_type']
        meta_data = image_data['metadata']
        sem_data = image_data['semantics']
        N_images = len(images)

    N_masks = len(masks)
    feature_values = list()
    feature_labels = list()

    if ~multi_mask and mask_index == -1:
        raise ValueError('Multi_mask was set to False, but no mask index was\
                         provided')

    if multi_mask and N_images != N_masks:
        raise ValueError('Multi_contour was set to True, but the number of\
                         contours does not match the number of images')

    if multi_mask:
        pass
    else:
        shape_mask = ih.get_masked_slices_mask(masks[mask_index])

        print("Computing shape features.")
        shape_features, shape_labels = sf.get_shape_features(
            shape_mask, meta_data[0])
        feature_values += shape_features
        feature_labels += shape_labels

        if config["orientation"]:
            print("Computing orientation features.")
            orientation_features, orientation_labels =\
                of.get_orientation_features(shape_mask)
            feature_values += orientation_features
            feature_labels += orientation_labels

    if meta_data[0] is not None:
        print("Extracting patient features.")
        patient_features, patient_labels =\
            pf.get_patient_features(meta_data[0], image_types[0])
        feature_values += patient_features
        feature_labels += patient_labels

    if sem_data[0] is not None and output is not None:
        print("Extracting semantic features.")
        sem_features, sem_labels = semf.get_semantic_features(
            sem_data[0], output)
        feature_values += sem_features
        feature_labels += sem_labels

    for i_image, i_mask, i_image_type, i_meta_data in zip(
            images, masks, image_types, meta_data):
        if 'MR' in i_image_type:
            i_image_array = sitkh.GetArrayFromImage(i_image)
            i_mask_array = sitkh.GetArrayFromImage(i_mask)

            masked_voxels = ih.get_masked_voxels(i_image_array, i_mask_array)

            print("Computing histogram features.")
            histogram_features, histogram_labels =\
                hf.get_histogram_features(masked_voxels,
                                          N_BINS)

            i_image_array, i_mask_array = ih.get_masked_slices_image(
                i_image_array, i_mask_array)

            print("Computing texture features.")
            texture_features, texture_labels =\
                tf.get_texture_features(i_image_array,
                                        i_mask_array,
                                        parameters,
                                        config['texture'])

            feature_values += histogram_features + texture_features
            feature_labels += histogram_labels + texture_labels

            if config["coliage"]:
                print("Computing coliage features.")
                coliage_features, coliage_labels =\
                    cf.get_coliage_features(i_image_array,
                                            i_mask_array)
                feature_values += coliage_features
                feature_labels += coliage_labels

            if config["vessel"]:
                print("Computing vessel features.")
                vessel_features, vessel_labels =\
                    vesf.get_vessel_features(i_image_array,
                                             i_mask_array,
                                             parameters['vessel'])
                feature_values += vessel_features
                feature_labels += vessel_labels

            if config["log"]:
                print("Computing log features.")
                log_features, log_labels =\
                    logf.get_log_features(i_image_array,
                                          i_mask_array,
                                          parameters['log'])
                feature_values += log_features
                feature_labels += log_labels

            if config["phase"]:
                print("Computing phase features.")
                phase_features, phase_labels =\
                    phasef.get_phase_features(i_image_array,
                                              i_mask_array,
                                              parameters['phase'])
                feature_values += phase_features
                feature_labels += phase_labels

        elif 'DTI_post' in i_image_type:
            dti_features, dti_labels = dtif.get_dti_post_features(
                i_image, i_mask, i_meta_data)
            feature_values += dti_features
            feature_labels += dti_labels

        elif 'DTI' in i_image_type:
            dti_features, dti_labels = dtif.get_dti_features(
                i_image, i_mask, i_meta_data)
            feature_values += dti_features
            feature_labels += dti_labels

        elif 'CT' in i_image_type:
            i_image_array = sitkh.GetArrayFromImage(i_image)
            i_mask_array = sitkh.GetArrayFromImage(i_mask)

            masked_voxels = ih.get_masked_voxels(i_image_array, i_mask_array)

            print("Computing histogram features.")
            histogram_features, histogram_labels =\
                hf.get_histogram_features(masked_voxels,
                                          N_BINS)

            i_image_array, i_mask_array = ih.get_masked_slices_image(
                i_image_array, i_mask_array)

            print("Computing texture features.")
            texture_features, texture_labels =\
                tf.get_texture_features(i_image_array,
                                        i_mask_array,
                                        parameters,
                                        config['texture'])

            feature_values += histogram_features + texture_features
            feature_labels += histogram_labels + texture_labels

            if config["coliage"]:
                print("Computing coliage features.")
                coliage_features, coliage_labels =\
                    cf.get_coliage_features(i_image_array,
                                            i_mask_array)
                feature_values += coliage_features
                feature_labels += coliage_labels

            if config["vessel"]:
                print("Computing vessel features.")
                vessel_features, vessel_labels =\
                    vesf.get_vessel_features(i_image_array,
                                             i_mask_array,
                                             parameters['vessel'])
                feature_values += vessel_features
                feature_labels += vessel_labels

            if config["log"]:
                print("Computing log features.")
                log_features, log_labels =\
                    logf.get_log_features(i_image_array,
                                          i_mask_array,
                                          parameters['log'])
                feature_values += log_features
                feature_labels += log_labels

            if config["phase"]:
                print("Computing phase features.")
                phase_features, phase_labels =\
                    phasef.get_phase_features(i_image_array,
                                              i_mask_array,
                                              parameters['phase'])
                feature_values += phase_features
                feature_labels += phase_labels

        else:
            print("Invalid image type: {}").format(i_image_type)
            raise TypeError

    return feature_values, feature_labels
def get_image_features(image_data,
                       masks,
                       gabor_settings,
                       mask_index=-1,
                       multi_mask=False,
                       config=None,
                       output=None):

    if type(image_data) == pd.core.frame.DataFrame:
        images = image_data['images']
        image_types = image_data['images'].keys()
        meta_data = image_data['metadata']
        sem_data = image_data['semantics']
        N_images = len(image_data.images)
    else:
        # Dictionary
        images = image_data['images']
        image_types = image_data['image_type']
        meta_data = image_data['metadata']
        sem_data = image_data['semantics']
        N_images = len(images)

    N_masks = len(masks)
    image_features = dict()

    if ~multi_mask and mask_index == -1:
        raise ValueError('Multi_mask was set to False, but no mask index was\
                         provided')

    if multi_mask and N_images != N_masks:
        raise ValueError('Multi_contour was set to True, but the number of\
                         contours does not match the number of images')

    if multi_mask:
        pass
    else:
        shape_mask = ih.get_masked_slices_mask(masks[mask_index])

        shape_features = sf.get_shape_features(shape_mask, meta_data[0])

        if config["orientation"]:
            orientation_features = of.get_orientation_features(shape_mask)
            image_features['orientation_features'] = orientation_features

    image_features['shape_features'] = shape_features

    if meta_data[0] is not None:
        patient_features = pf.get_patient_features(meta_data[0],
                                                   image_types[0])
        image_features['patient_features'] = patient_features

    if sem_data[0] is not None and output is not None:
        sem_features = semf.get_semantic_features(sem_data[0], output)
        image_features['semantic_features'] = sem_features

    for i_image, i_mask, i_image_type, i_meta_data in zip(
            images, masks, image_types, meta_data):
        if 'MR' in i_image_type:
            i_image_array = sitkh.GetArrayFromImage(i_image)
            i_mask_array = sitkh.GetArrayFromImage(i_mask)

            masked_voxels = ih.get_masked_voxels(i_image_array, i_mask_array)

            histogram_features = hf.get_histogram_features(
                masked_voxels, N_BINS)

            i_image_array, i_mask_array = ih.get_masked_slices_image(
                i_image_array, i_mask_array)

            texture_features = tf.get_texture_features(i_image_array,
                                                       i_mask_array,
                                                       gabor_settings,
                                                       config['texture'])

            coliage_features = cf.get_coliage_featues(i_image_array,
                                                      i_mask_array)
            # filter_features = ff.get_filter_features(i_image_array,
            #                                          i_mask_array)

            # image_features[i_image_type] =\
            #     pd.concat([histogram_features, texture_features],
            #               keys=['histogram_features', 'texture_features'])
            image_features['histogram_features'] = histogram_features
            image_features['texture_features'] = texture_features
            image_features['coliage_features'] = coliage_features
            # image_features['filter_features'] = filter_features
            # image_features[i_image_type] = histogram_features

        elif 'DTI_post' in i_image_type:
            dti_features = dtif.get_dti_post_features(i_image, i_mask,
                                                      i_meta_data)
            image_features[i_image_type] = dti_features
        elif 'DTI' in i_image_type:
            dti_features = dtif.get_dti_features(i_image, i_mask, i_meta_data)
            image_features[i_image_type] = dti_features
        elif 'CT' in i_image_type:
            i_image_array = sitkh.GetArrayFromImage(i_image)
            i_mask_array = sitkh.GetArrayFromImage(i_mask)

            masked_voxels = ih.get_masked_voxels(i_image_array, i_mask_array)

            histogram_features = hf.get_histogram_features(
                masked_voxels, N_BINS)

            i_image_array, i_mask_array = ih.get_masked_slices_image(
                i_image_array, i_mask_array)

            texture_features = tf.get_texture_features(i_image_array,
                                                       i_mask_array,
                                                       gabor_settings,
                                                       config['texture'])

            coliage_features = cf.get_coliage_featues(i_image_array,
                                                      i_mask_array)

            # filter_features = ff.get_filter_features(i_image_array,
            #                                          i_mask_array)

            # image_features[i_image_type] = histogram_features
            image_features['histogram_features'] = histogram_features
            image_features['texture_features'] = texture_features
            image_features['coliage_features'] = coliage_features
            # image_features['filter_features'] = filter_features
        else:
            print("Invalid image type: {}").format(i_image_type)
            raise TypeError

    # We also return just the arrray
    image_feature_array = list()

    for _, feattype in image_features.iteritems():
        for _, features in feattype.iteritems():
            image_feature_array.extend(features.values)

    print image_feature_array

    image_feature_array = np.asarray(image_feature_array)
    image_feature_array = image_feature_array.ravel()

    return image_features, image_feature_array
def get_image_features(image_data,
                       mask,
                       parameters,
                       config=None,
                       config_general=None,
                       output=None):
    '''
    Calculate features from a ROI of an image.

    Parameters
    ----------
    image_data: Pandas DataFrame or dictionary, mandatory
            Contains the image, image type, metadata and semantics for
            the feature extraction. These have to be indexed by these keys.

            Should either be a Pandas DataFrame, in which the image type is
            he key of the images, or a dictionary, in which image type is a
            a separate field.

            The image should be a SimpleITK Image, the image type a string,
            the metadata a pydicom dicom type and the semantics a dictionary.


    mask: ITK Image, mandatory
            ROI to be used for feature extraction.

    parameters: dictionary, mandatory,
            Parameters for feature calculation. See the Github Wiki for the possible
            fields and their description.

    config: dictionary, mandatory
            Configuration for feature calculation. Mostly configures which
            features are calculated or not. See the Github Wiki for the possible
            fields and their description.

    config_general: dictionary, mandatory
            Configuration for general settings. Currently only configures
            settings for the Joblib Parallel function. 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 for the CalcFeatures function. This field is used to match
            the patient ID of the semantic features to this filename.


    Returns
    ----------
    feature_values: list
            Contains the values for all extracted features.

    feature_labels: list
            Contains the labels for all extracted features. Each entry
            corresponds to the element with the same index from the
            feature_values object.

    '''

    # Assign data to correct variables
    if type(image_data) == pd.core.frame.DataFrame:
        image_type = image_data['images'].keys()[0]
        meta_data = image_data['metadata']
        sem_data = image_data['semantics']
        image_data = image_data['images']
    else:
        # Dictionary
        image_type = image_data['image_type']
        meta_data = image_data['metadata']
        sem_data = image_data['semantics']
        image_data = image_data['images']

    # Initialize feature value and label lists.
    feature_values = list()
    feature_labels = list()

    # Extract shape features
    shape_mask = ih.get_masked_slices_mask(mask)

    print("Computing shape features.")
    shape_features, shape_labels = sf.get_shape_features(shape_mask, meta_data)
    feature_values += shape_features
    feature_labels += shape_labels

    if config["orientation"]:
        print("Computing orientation features.")
        orientation_features, orientation_labels =\
            of.get_orientation_features(shape_mask)
        feature_values += orientation_features
        feature_labels += orientation_labels

    if meta_data is not None:
        print("Extracting patient features.")
        patient_features, patient_labels =\
            pf.get_patient_features(meta_data, image_type)
        feature_values += patient_features
        feature_labels += patient_labels

    if sem_data is not None and output is not None:
        print("Extracting semantic features.")
        sem_features, sem_labels = semf.get_semantic_features(sem_data, output)
        feature_values += sem_features
        feature_labels += sem_labels

    if 'DTI_post' in image_type:
        dti_features, dti_labels = dtif.get_dti_post_features(
            image_data, mask, meta_data)
        feature_values += dti_features
        feature_labels += dti_labels

    elif 'DTI' in image_type:
        dti_features, dti_labels = dtif.get_dti_features(
            image_data, mask, meta_data)
        feature_values += dti_features
        feature_labels += dti_labels

    elif any(type in image_type for type in ['MR', 'CT', 'PET', 'MG']):
        image_data_array = sitkh.GetArrayFromImage(image_data)
        mask_array = sitkh.GetArrayFromImage(mask)

        masked_voxels = ih.get_masked_voxels(image_data_array, mask_array)

        print("Computing histogram features.")
        histogram_features, histogram_labels =\
            hf.get_histogram_features(masked_voxels,
                                      N_BINS)

        # NOTE: As a minimum of 4 voxels in each dimension is needed
        # for the SimpleITK log filter, we compute these features
        # on the full image
        if config["log"]:
            print("Computing log features.")
            log_features, log_labels =\
                logf.get_log_features(image_data_array,
                                      mask_array,
                                      parameters['log'])
            feature_values += log_features
            feature_labels += log_labels

        image_data_array, mask_array = ih.get_masked_slices_image(
            image_data_array, mask_array)

        print("Computing texture features.")
        texture_features, texture_labels =\
            tf.get_texture_features(image_data_array,
                                    mask_array,
                                    parameters,
                                    config['texture'],
                                    config_general)

        feature_values += histogram_features + texture_features
        feature_labels += histogram_labels + texture_labels

        if config["coliage"]:
            print("Computing coliage features.")
            coliage_features, coliage_labels =\
                cf.get_coliage_features(image_data_array,
                                        mask_array)
            feature_values += coliage_features
            feature_labels += coliage_labels

        if config["vessel"]:
            print("Computing vessel features.")
            vessel_features, vessel_labels =\
                vesf.get_vessel_features(image_data_array,
                                         mask_array,
                                         parameters['vessel'])
            feature_values += vessel_features
            feature_labels += vessel_labels

        if config["phase"]:
            print("Computing phase features.")
            phase_features, phase_labels =\
                phasef.get_phase_features(image_data_array,
                                          mask_array,
                                          parameters['phase'])
            feature_values += phase_features
            feature_labels += phase_labels

    else:
        raise ae.PREDICTTypeError(
            ("Invalid image type: {}").format(image_type))

    return feature_values, feature_labels