def get_meta_info(self, data_path): ''' Get meta information for a requested data path. ''' if data_path not in self._views.keys(): path_type = self.check_path_type(data_path) # detect if this is a section or fov if path_type == 'FOV': # this is a FoV fov = FoV.from_directory(data_path, True) view = View.create( data_path, [fov], fov._width, fov._height, fov._tx, fov._ty, self) elif path_type == 'SECTION': section = Section.from_directory(data_path, True, True) view = View.create( data_path, section._fovs, section._width, section._height, section._tx, section._ty, self, section._luts64_map) # # and add to our views dictionary # self._views[data_path] = view else: view = self._views[data_path] meta_info = {} meta_info['width'] = view._width meta_info['height'] = view._height meta_info['layer'] = 0 meta_info['minLevel'] = 0 meta_info['maxLevel'] = 1 meta_info['tileSize'] = settings.CLIENT_TILE_SIZE meta_info['centers'] = view._centers return meta_info
def get_meta_info(self, data_path): ''' Get meta information for a requested data path. ''' if not data_path in self._views: path_type = self.check_path_type(data_path) # detect if this is a section or fov if path_type == 'FOV': # this is a FoV fov = FoV.from_directory(data_path, True) width = fov._width height = fov._height view = View.create(data_path, [fov], fov._width, fov._height, fov._tx, fov._ty, self) elif path_type == 'SECTION': section = Section.from_directory(data_path, True, True) width = section._width height = section._height view = View.create(data_path, section._fovs, section._width, section._height, section._tx, section._ty, self) # # and add to our views dictionary # self._views[data_path] = view else: view = self._views[data_path] meta_info = {} meta_info['width'] = view._width meta_info['height'] = view._height meta_info['layer'] = 0 meta_info['minLevel'] = 0 meta_info['maxLevel'] = 1 meta_info['tileSize'] = Constants.CLIENT_TILE_SIZE return meta_info
def from_directory(directory, calculate_bounding_box=False): ''' Loads a scan from a directory without loading any images. ''' sections = [] for i,s in enumerate(Util.listdir(directory)): section_path = os.path.join(directory, s) # if not os.path.isdir(section_path): # # sections always reside in directories # continue index_subdirs = i == 0 section = Section.from_directory(section_path, calculate_bounding_box, index_subdirs) sections.append(section) scan = Scan(directory, sections) return scan
def from_directory(directory, calculate_bounding_box=False): ''' Loads a scan from a directory without loading any images. ''' sections = [] for i, s in enumerate(Util.listdir(directory)): section_path = os.path.join(directory, s) # if not os.path.isdir(section_path): # # sections always reside in directories # continue index_subdirs = i == 0 section = Section.from_directory(section_path, calculate_bounding_box, index_subdirs) sections.append(section) scan = Scan(directory, sections) return scan