:class:`~.SampleBaseImage` =================================================================================================================================================== .. py:class:: astropathdb.db_io._sample_utils.SampleBaseImage(astrodb, sampleid) :single-line-parameter-list: Helper class for the lazy image loading. Functionality is driven through :meth:`~.SampleBaseImage.build_multiscale_datatree_image` which returns a multiscale datatree image that can be directly added to a :class:`~spatialdata.SpatialData` object. :param sampleid: A ``sampleid`` for the image. :param astrodb: The :class:`.AstroDB` to use as the query engine. :class:`~.astropathdb.db_io._sample_utils.SampleBaseImage` *Attributes* --------------------------------------------------------------------------------------------------------------------------------------------------- .. autoapisummary:: :signatures: none astropathdb.db_io._sample_utils.SampleBaseImage.DB_LEVELS :class:`~.astropathdb.db_io._sample_utils.SampleBaseImage` *Methods* --------------------------------------------------------------------------------------------------------------------------------------------------- .. autoapisummary:: :signatures: none astropathdb.db_io._sample_utils.SampleBaseImage.build_multiscale_datatree_image :class:`~.astropathdb.db_io._sample_utils.SampleBaseImage` *References* --------------------------------------------------------------------------------------------------------------------------------------------------- .. py:currentmodule:: astropathdb.db_io._sample_utils.SampleBaseImage *Attribute Reference* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. py:attribute:: DB_LEVELS :type: ClassVar[int] :value: 9 *Method Reference* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. py:method:: build_multiscale_datatree_image(tile_dims = None) :single-line-parameter-list: Build a multiscale dask datatree image for a sample's image pyramid. The scales are from 0 (highest resolution) to 9 (lowest resolution) and named 'scaleX', with X indicating the resolution (ex. ``scale0``). .. note:: The scale is reversed from what is in the database where the scales are 9 to 0 (highest to lowest resolution). :param tile_dims: A list of two dataframes specifying the image dimensions for the sample. The dataframe should have columns x,y,level for distinct combinations. The second should have a single column ``ztype`` for the distinct image z layers, in any order (Defaults to ``None`` and will be automatically grabbed from the database). :returns: A multiscale image in DataTree format where the image itself is a Dask object which queries the regions when requested. Its channels are the ``ztype`` layers in ascending order. *Private Attribute Reference* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. py:attribute:: __astrodb .. py:attribute:: __sampleid *Private Method Reference* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. py:method:: __hex_to_image(x, image_dtype = np.int8) :single-line-parameter-list: :staticmethod: Convert image hex string to an image. :param x: The hex string to convert to an image. :param image_dtype: The data type of the input image (Defaults to ``int8``). .. py:method:: __organize_chunk(img_dict, start_positions, chunk_size, num_tiles, z_range) :single-line-parameter-list: Organize the image chunk from the query into a usable (z,y,x) image. :param img_dict: A dictionary mapping of the query with keys (x,y,z) and values holding the image query results :param start_positions: Starting tile positions for the mapping. :param chunk_size: The actual chunk sizes in y and x directions :param num_tiles: The number of tiles in the query, used to get edges :param z_range: The z range of the tiles :returns: A numpy array the size of the input chunk .. py:method:: __preprocess_img_result(q_result) :single-line-parameter-list: :staticmethod: Pre-process the query result into a dictionary for faster access. Create a dictionary to store (x, y, z) -> img for fast access .. py:method:: __query_img(start_positions, end_positions, level) :single-line-parameter-list: .. py:method:: __retrieve_chunk(level, start_positions, chunk_size, z_range) :single-line-parameter-list: .. py:method:: __find_chunk_size(idx, max_shape) :single-line-parameter-list: :staticmethod: .. py:method:: _create_dask_img(image_tiles, level, z_range, image_edge) :single-line-parameter-list: .. py:method:: _add_scale(shape, level, z_range) :single-line-parameter-list: .. py:method:: _get_sample_img_dims() :single-line-parameter-list: