Пример #1
0
	def __init__(self,file_name):
		'''
		@param file_name the name of the file that which is being overwritten
		@exception raised if the file_name does not exist on the file system
		@exception raised if the file_name has a unrecognized (or no) type
		'''
		if not os.path.exists(file_name): raise
		splt = file_name.split(".")
		if len(splt) < 2: raise
		if EMUtil.get_image_ext_type(splt[-1]) == EMUtil.ImageType.IMAGE_UNKNOWN:
			raise
		self.__file_ext = "."+splt[-1]
		
		EMTmpFileHandleBase.__init__(self)
		self.__file_name = get_file_tag(file_name)
		self.__full_file_name = file_name
		self.__tmp_file_name = None
		self.__establish_tmp_file_name()
Пример #2
0
	def __init__(self,file_name):
		'''
		@param file_name the name of the file that which is being overwritten
		@exception if either the .hed or .img file corrsponding to the old_file_name does not exist on the file system
		@exception if the old_file_name is not an imagic file
		'''
		
		splt = file_name.split(".")
		if len(splt) < 2 or splt[-1] not in ["img","hed"]: raise
		
		self.__file_name_root = get_file_tag(file_name)
		
		if not os.path.exists(self.__file_name_root+".img"): raise
		if not os.path.exists(self.__file_name_root+".hed"): raise
		
		EMTmpFileHandleBase.__init__(self)
		self.__file_name_root_hed = self.__file_name_root+".hed"
		self.__file_name_root_img = self.__file_name_root+".img"
		self.__establish_tmp_file_name()