def _validateImages(self): errors = [] ih = ImageHandler() for imgFn, _ in self.iterFiles(): if isdir(imgFn): errors.append("Folders can not be selected.") errors.append(' %s' % imgFn) else: # Check if images are correct by reading the header of the # imported files: # Exceptions: # - Compressed movies (bz2 or tbz extensions) # - Importing in streaming, since files may be incomplete # - Bad characters in path [':' ,'%', '#'] if (not self.dataStreaming and not (imgFn.endswith('bz2') or imgFn.endswith('tbz') or ih.isImageFile(imgFn))): if not errors: # if empty add the first line errors.append("Error reading the following images:") errors.append(' %s' % imgFn) errors += ProtImportImages.validatePath(imgFn) return errors
def _validateImages(self): errors = [] ih = ImageHandler() for imgFn, _ in self.iterFiles(): if isdir(imgFn): errors.append("Folders can not be selected.") errors.append(' %s' % imgFn) else: # try to read the header of the imported images # except for the special case of compressed movies (bz2 extension) if not (imgFn.endswith('bz2') or imgFn.endswith('tbz') or ih.isImageFile(imgFn)): if not errors: # if empty add the first line errors.append("Error reading the following images:") errors.append(' %s' % imgFn) return errors
def _validate(self): from pyworkflow.em.convert import ImageHandler errors = [] if self.importFrom == self.IMPORT_FROM_FILES: if not self.getPattern(): errors.append("The path and pattern can not be both empty!!!") else: # Just check the number of files matching the pattern self.getMatchFiles() if self.numberOfFiles == 0: errors.append("There are no files matching the pattern " + "%s" % self.getPattern()) for imgFn, _ in self.iterFiles(): ih = ImageHandler() if not ih.isImageFile(imgFn): errors.append("The imported files must be images.") break return errors
def _validate(self): from pyworkflow.em.convert import ImageHandler ci = self.getImportClass() if ci is None: errors = ProtImportMicBase._validate(self) for micFn, _ in self.iterFiles(): imgh = ImageHandler() if imgh.isImageFile(micFn): _, _, z, n = imgh.getDimensions(micFn) if n > 1 or z > 1: errors.append("The protocol not support micrographs stored in stacks. " "If you want to obtain your micrographs individually, " "you can run the following command:\n" "scipion run scipion_directory/scripts/split_stacks.py --files *your files* --ext *extension*") # JMRT: only check the first image, for large dataset # even reading the header can take a while break return errors else: return ci.validateMicrographs()
def _validate(self): from pyworkflow.em.convert import ImageHandler ci = self.getImportClass() if ci is None: errors = ProtImportMicBase._validate(self) for micFn, _ in self.iterFiles(): imgh = ImageHandler() if imgh.isImageFile(micFn): _, _, z, n = imgh.getDimensions(micFn) if n > 1 or z > 1: errors.append( "The protocol not support micrographs stored in stacks. " "If you want to obtain your micrographs individually, " "you can run the following command:\n" "scipion run scipion_directory/scripts/split_stacks.py --files *your files* --ext *extension*" ) # JMRT: only check the first image, for large dataset # even reading the header can take a while break return errors else: return ci.validateMicrographs()