Пример #1
0
 def init_dictionary(self):
     if self.dictionary is None:
         fm = File_Manager()
         self.dictionary = fm.read_dictionary(
             dataset_name=self.dataset_name, modality_name=self.get_name())
         if self.dictionary is None:
             self.dictionary = self.make_dictionary()  # no dictionary
             fm.write_dictionary(dictionary=self.dictionary,
                                 dataset_name=self.dataset_name,
                                 modality_name=self.get_name())
         else:
             fm.write_dictionary2logdir(dictionary=self.dictionary,
                                        modality_name=self.get_name())
Пример #2
0
    def append_suggested_dictionary(self,
                                    dataset_name,
                                    modality_name,
                                    FMSingleton=None):
        assert isinstance(
            modality_name,
            str), f'Modality name is not a string "{modality_name}"'
        assert isinstance(
            dataset_name,
            str), f'Dataset name is not a string "{modality_name}"'
        modality_name = modality_name.lower()

        if FMSingleton is None:
            FMSingleton = File_Manager()
        suggested_dictionary = FMSingleton.read_dictionary(
            dataset_name=dataset_name,
            modality_name=modality_name,
        )
        if suggested_dictionary is not None:
            self.__suggested_dictionaries[modality_name].append(
                suggested_dictionary)

        return self