collection/collectionEditor.py
def process(self, **kwargs):
        """
        process to make the new field
        :param kwargs:
            file_list: the list of the files, if not given, use all the files with selected field extension
            file_ext: the new file extension, if not given, use the same as the old one
            d_type: the new data type, if not given, use the same as the old one
        :return:
        """
        if 'file_list' not in kwargs:
            file_list = self.clc.load_files(','.join(self.clc.field_name), ','.join(self.clc.field_id),
                                            self.field_ext_pair[0])
        else:
            file_list = kwargs['file_list']
        assert len(file_list[0]) == 1
        pbar = tqdm(file_list)
        for img_file in pbar:
            save_name = img_file[0].replace(''.join([a for a in self.field_ext_pair[0] if a != '.' and a != '*']),
                                            self.field_ext_pair[1])
            if 'file_ext' in kwargs:
                # user specified a new file extension
                save_name = save_name.replace(save_name.split('.')[-1], kwargs['file_ext'])
            save_name = os.path.join(self.path, os.path.basename(save_name))
            pbar.set_description('Making {}'.format(os.path.basename(save_name)))
            img = ersa_utils.load_file(img_file[0])
            for old_val, new_val in self.switch_dict.items():
                img[np.where(img == old_val)] = new_val
            if 'd_type' in kwargs:
                img = img.astype(kwargs['d_type'])
            ersa_utils.save_file(save_name, img)
            self.files.append(save_name)

        process to make the new field
        :param kwargs:
            file_list: the list of the files, if not given, use all the files with selected field extension
            file_ext: the new file extension, if not given, use the same as the old one
            d_type: the new data type, if not given, use the same as the old one
        :return:
        
process to make the new field
process to make the new field
def process(self, **kwargs):
        if 'file_list' not in kwargs:
            file_list = self.clc.load_files(','.join(self.clc.field_name), ','.join(self.clc.field_id),
                                            self.field_ext_pair[0])
        else:
            file_list = kwargs['file_list']
        assert len(file_list[0]) == 1
        pbar = tqdm(file_list)
        for img_file in pbar:
            save_name = img_file[0].replace(''.join([a for a in self.field_ext_pair[0] if a != '.' and a != '*']),
                                            self.field_ext_pair[1])
            if 'file_ext' in kwargs:
                save_name = save_name.replace(save_name.split('.')[-1], kwargs['file_ext'])
            save_name = os.path.join(self.path, os.path.basename(save_name))
            pbar.set_description('Making {}'.format(os.path.basename(save_name)))
            img = ersa_utils.load_file(img_file[0])
            for old_val, new_val in self.switch_dict.items():
                img[np.where(img == old_val)] = new_val
            if 'd_type' in kwargs:
                img = img.astype(kwargs['d_type'])
            ersa_utils.save_file(save_name, img)
            self.files.append(save_name)
def process ( self , ** kwargs ) : if 'file_list' not in kwargs : file_list = self . clc . load_files ( ',' . join ( self . clc . field_name ) , ',' . join ( self . clc . field_id ) , self . field_ext_pair [ 0 ] ) else : file_list = kwargs [ 'file_list' ] assert len ( file_list [ 0 ] ) == 1 pbar = tqdm ( file_list ) for img_file in pbar : save_name = img_file [ 0 ] . replace ( '' . join ( [ a for a in self . field_ext_pair [ 0 ] if a != '.' and a != '*' ] ) , self . field_ext_pair [ 1 ] ) if 'file_ext' in kwargs : save_name = save_name . replace ( save_name . split ( '.' ) [ - 1 ] , kwargs [ 'file_ext' ] ) save_name = os . path . join ( self . path , os . path . basename ( save_name ) ) pbar . set_description ( 'Making {}' . format ( os . path . basename ( save_name ) ) ) img = ersa_utils . load_file ( img_file [ 0 ] ) for old_val , new_val in self . switch_dict . items ( ) : img [ np . where ( img == old_val ) ] = new_val if 'd_type' in kwargs : img = img . astype ( kwargs [ 'd_type' ] ) ersa_utils . save_file ( save_name , img ) self . files . append ( save_name )
process to make the new field
process to make the new field
"""
        process to make the new field
        :param kwargs:
            file_list: the list of the files, if not given, use all the files with selected field extension
            file_ext: the new file extension, if not given, use the same as the old one
            d_type: the new data type, if not given, use the same as the old one
        :return:
        """ # user specified a new file extension
None
self
kwargs
the list of the files, if not given, use all the files with selected field extension
file_ext: the new file extension, if not given, use the same as the old one
d_type: the new data type, if not given, use the same as the old one
the list of the files if not given use all the files with selected field extension file_ext : the new file extension if not given use the same as the old one d_type : the new data type if not given use the same as the old one