def METHOD_NAME(self, num_modalities):
    if self.overwrite or not os.path.isfile(self.intensityproperties_file):
        p = Pool(self.num_processes)
        results = OrderedDict()
        for mod_id in range(num_modalities):
            results[mod_id] = OrderedDict()
            voxels = p.starmap(self._get_voxels_in_foreground,
                               zip(self.patient_identifiers, [mod_id] *
                                   len(self.patient_identifiers)))
            all_voxels = []
            for voxel in voxels:
                all_voxels += voxel
            median, mean, sd, mn, mx, percentile_99_5, percentile_00_5 = self._compute_stats(
                all_voxels)
            local_props = p.map(self._compute_stats, voxels)
            props_per_case = OrderedDict()
            for i, pat in enumerate(self.patient_identifiers):
                props_per_case[pat] = OrderedDict()
                props_per_case[pat]['median'] = local_props[i][0]
                props_per_case[pat]['mean'] = local_props[i][1]
                props_per_case[pat]['sd'] = local_props[i][2]
                props_per_case[pat]['mn'] = local_props[i][3]
                props_per_case[pat]['mx'] = local_props[i][4]
                props_per_case[pat]['percentile_99_5'] = local_props[i][5]
                props_per_case[pat]['percentile_00_5'] = local_props[i][6]
            results[mod_id]['local_props'] = props_per_case
            results[mod_id]['median'] = median
            results[mod_id]['mean'] = mean
            results[mod_id]['sd'] = sd
            results[mod_id]['mn'] = mn
            results[mod_id]['mx'] = mx
            results[mod_id]['percentile_99_5'] = percentile_99_5
            results[mod_id]['percentile_00_5'] = percentile_00_5
        p.close()
        p.join()
        with open(self.intensityproperties_file, 'wb') as f:
            pickle.dump(results, f)
    else:
        with open(self.intensityproperties_file, 'rb') as f:
            results = pickle.load(f)
    return results