def load_data_dictionary(self):
        """
        each slice of each subject will be loaded separately in a Slice object containing :

        - a slice id

        - the original T2star image crop around the spinal cord: im

        - a manual segmentation of the gray matter: seg

        :return slices: numpy array of all the slices of the data dictionary
        """
        # initialization
        slices = []
        total_j_im = 0
        total_j_seg = 0
        # TODO: change the name of files to find to a more general structure
        for subject_dir in os.listdir(self.param.path_dictionary):
            subject_path = self.param.path_dictionary + '/' + subject_dir
            if os.path.isdir(subject_path):
                self.dic_data_info[subject_dir] = {'n_slices': 0, 'inverted_gm_seg': [], 'im_M': [], 'seg_M': [], 'levels': []}
                j_im = 0
                j_seg = 0
                first_slice = total_j_im
                sct.run('mkdir ' + self.model_dic_name + '/' + subject_dir, verbose=self.param.verbose)
                for file_name in os.listdir(subject_path):
                    if 'im' in file_name:
                        slice_level = 0
                        name_list = file_name.split('_')
                        for word in name_list:
                            if word in self.level_label.values():
                                slice_level = get_key_from_val(self.level_label, word)

                        slices.append(Slice(slice_id=total_j_im, im=Image(subject_path + '/' + file_name).data, level=slice_level, reg_to_m=[]))
                        self.dic_data_info[subject_dir]['levels'].append(slice_level)

                        # copy of the slice image in the saved model folder
                        if 10 < j_im:
                            j_im_str = str(j_im)
                            j_im_str = '0' + j_im_str
                        else:
                            j_im_str = str(j_im)

                        im_file_name = subject_dir + '_slice' + j_im_str + '_' + self.level_label[slice_level] + '_im.nii.gz'
                        sct.run('cp ./' + self.param.path_dictionary + '/' + subject_dir + '/' + file_name + ' ' + self.model_dic_name + '/' + subject_dir + '/' + im_file_name)
                        j_im += 1
                        total_j_im += 1

                    if 'seg' in file_name:
                        slices[total_j_seg].set(gm_seg=Image(subject_path + '/' + file_name).data)
                        j_seg += 1
                        total_j_seg += 1

                if j_im == j_seg:
                    self.dic_data_info[subject_dir]['n_slices'] = (first_slice, total_j_im)
                else:
                    sct.printv('ERROR: subject ' + subject_dir + ' doesn\'t have the same number of slice images and segmentations', verbose=self.param.verbose, type='error')

        return np.asarray(slices)

    # ------------------------------------------------------------------------------------------------------------------
dataset/ETHPy150Open neuropoly/spinalcordtoolbox/dev/sct_segment_gray_matter_asman/sct_asman_old.py/ModelDictionaryBySlice.load_data_dictionary/swapped operands of `<`