def save_model_data(self, what_to_save):
        """
        save 3D images of the model dictionary using the dictionary of information about the data slices by subject

        :param what_to_save: type of data to be saved
        """
        suffix = ''
        data_to_save = []
        if what_to_save == 'gm_seg':
            suffix = '_gm_seg'
            data_to_save = [dic_slice.gm_seg for dic_slice in self.slices]
        if what_to_save == 'inverted_gm_seg':
            suffix = '_wm_seg'
            data_to_save = [dic_slice.wm_seg for dic_slice in self.slices]
        elif what_to_save == 'im':
            suffix = '_im'
            data_to_save = [dic_slice.im for dic_slice in self.slices]
        elif what_to_save == 'im_M':
            suffix = '_im_model_space'
            data_to_save = [dic_slice.im_M for dic_slice in self.slices]
        elif what_to_save == 'gm_seg_M':
            suffix = '_gm_seg_model_space'
            data_to_save = [dic_slice.gm_seg_M for dic_slice in self.slices]
        elif what_to_save == 'wm_seg_M':
            suffix = '_wm_seg_model_space'
            data_to_save = [dic_slice.wm_seg_M for dic_slice in self.slices]

        for subject_name in sorted(self.dic_data_info.keys()):
            first_subject_slice, last_subject_slice = self.dic_data_info[subject_name]['n_slices']
            self.dic_data_info[subject_name][what_to_save] = data_to_save[first_subject_slice:last_subject_slice]

            for i, slice_i in enumerate(self.dic_data_info[subject_name][what_to_save]):
                to_save = Image(param=np.asarray(slice_i))
                to_save.path = self.model_dic_name + '/' + subject_name + '/'

                if 10 < i:
                    i_str = str(i)
                    i_str = '0' + i_str
                else:
                    i_str = str(i)
                to_save.file_name = subject_name + '_slice' + i_str + '_' + self.level_label[self.dic_data_info[subject_name]['levels'][i]] + suffix
                to_save.ext = '.nii.gz'
                to_save.save(type='minimize')

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