コード例 #1
0
ファイル: images.py プロジェクト: I2PC/scipion
    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
コード例 #2
0
ファイル: images.py プロジェクト: the-best-elephant/scipion
    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
コード例 #3
0
ファイル: images.py プロジェクト: azazellochg/scipion
 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
コード例 #4
0
ファイル: base.py プロジェクト: denisfortun/scipion
    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
コード例 #5
0
ファイル: images.py プロジェクト: EyeSeeTea/scipion-web
    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
コード例 #6
0
ファイル: micrographs.py プロジェクト: azazellochg/scipion
 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()
コード例 #7
0
ファイル: micrographs.py プロジェクト: EyeSeeTea/scipion-web
    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()