def __init__(self): self.CHANNEL_NAMES = pd.read_csv( self.CHANNEL_PATH, sep='\t', header=None).values[:, 0] VALID_IMAGE_EXTENSIONS = ('tif', 'jpg', 'png') self.FILENAMES = [f for f in os.listdir(self.DIRECTORY_PATH) if f.endswith( VALID_IMAGE_EXTENSIONS) and not f.startswith('.') and not f.endswith(self.FILENAME_ENDS_TO_EXCLUDE)] if len(self.FILENAMES) < 1: raise NameError( 'No image files found. Make sure you are pointing to the right directory') reference_image_path = os.path.join(self.DIRECTORY_PATH, self.FILENAMES[0]) if self.AUTOBOOST_REFERENCE_IMAGE != '' and self.BOOST == 'auto': if self.AUTOBOOST_REFERENCE_IMAGE in self.FILENAMES: self.FILENAMES.remove(self.AUTOBOOST_REFERENCE_IMAGE) self.FILENAMES.insert(0, self.AUTOBOOST_REFERENCE_IMAGE) print('Using autoboost reference image with filename', self.AUTOBOOST_REFERENCE_IMAGE) else: print('AUTOBOOST_REFERENCE_IMAGE does not exist. Check your config file - image filename must match exactly.') print('Defaulting to first image reference...') self.N_DIMS, self.EXT, self.DTYPE, self.SHAPE, self.READ_METHOD = cvutils.meta_from_image(reference_image_path) self.PROGRESS_TABLE = [] if(os.path.exists(self.PROGRESS_TABLE_PATH)): self.PROGRESS_TABLE = [line.rstrip('\n') for line in open(self.PROGRESS_TABLE_PATH)]
def __init__(self): if self.IS_CODEX_OUTPUT: self.CHANNEL_NAMES = pd.read_csv(self.CHANNEL_PATH, sep='\t', header=None).values[:, 0] VALID_IMAGE_EXTENSIONS = ('tif', 'jpg', 'png') self.FILENAMES = [ f for f in os.listdir(self.DIRECTORY_PATH) if f.endswith(VALID_IMAGE_EXTENSIONS) and not f.startswith('.') ] if len(self.FILENAMES) < 1: raise NameError( 'No image files found. Make sure you are pointing to the right directory' ) self.N_DIMS, self.EXT, self.DTYPE, self.SHAPE, self.READ_METHOD = cvutils.meta_from_image( os.path.join(self.DIRECTORY_PATH, self.FILENAMES[0]))