Tiled
Image tiling module
- class PixelValueModel(*, values: list[float | None])[source]
Bases:
BaseModel
Pydantic model class for VisiOmatic pixel values.
- classmethod construct(_fields_set: SetStr | None = None, **values: Any) Model
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = 'allow' was set since it adds all passed values
- copy(*, include: AbstractSetIntStr | MappingIntStrAny | None = None, exclude: AbstractSetIntStr | MappingIntStrAny | None = None, update: DictStrAny | None = None, deep: bool = False) Model
Duplicate a model, optionally choose which fields to include, exclude and change.
- Parameters:
include -- fields to include in new model
exclude -- fields to exclude from new model, as with values this takes precedence over include
update -- values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data
deep -- set to True to make a deep copy of the model
- Returns:
new model instance
- dict(*, include: AbstractSetIntStr | MappingIntStrAny | None = None, exclude: AbstractSetIntStr | MappingIntStrAny | None = None, by_alias: bool = False, skip_defaults: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) DictStrAny
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- json(*, include: AbstractSetIntStr | MappingIntStrAny | None = None, exclude: AbstractSetIntStr | MappingIntStrAny | None = None, by_alias: bool = False, skip_defaults: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Callable[[Any], Any] | None = None, models_as_dict: bool = True, **dumps_kwargs: Any) str
Generate a JSON representation of the model, include and exclude arguments as per dict().
encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().
- class PixelModel(*, x: int, y: int, values: list[float | None])[source]
Bases:
BaseModel
Pydantic model class for pixels.
- Parameters:
- classmethod construct(_fields_set: SetStr | None = None, **values: Any) Model
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = 'allow' was set since it adds all passed values
- copy(*, include: AbstractSetIntStr | MappingIntStrAny | None = None, exclude: AbstractSetIntStr | MappingIntStrAny | None = None, update: DictStrAny | None = None, deep: bool = False) Model
Duplicate a model, optionally choose which fields to include, exclude and change.
- Parameters:
include -- fields to include in new model
exclude -- fields to exclude from new model, as with values this takes precedence over include
update -- values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data
deep -- set to True to make a deep copy of the model
- Returns:
new model instance
- dict(*, include: AbstractSetIntStr | MappingIntStrAny | None = None, exclude: AbstractSetIntStr | MappingIntStrAny | None = None, by_alias: bool = False, skip_defaults: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) DictStrAny
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- json(*, include: AbstractSetIntStr | MappingIntStrAny | None = None, exclude: AbstractSetIntStr | MappingIntStrAny | None = None, by_alias: bool = False, skip_defaults: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Callable[[Any], Any] | None = None, models_as_dict: bool = True, **dumps_kwargs: Any) str
Generate a JSON representation of the model, include and exclude arguments as per dict().
encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().
- class ProfileModel(*, profile: list[PixelModel])[source]
Bases:
BaseModel
Pydantic model class for VisiOmatic profiles.
- Parameters:
profile (list[PixelModel]) -- List of pixel models.
- classmethod construct(_fields_set: SetStr | None = None, **values: Any) Model
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = 'allow' was set since it adds all passed values
- copy(*, include: AbstractSetIntStr | MappingIntStrAny | None = None, exclude: AbstractSetIntStr | MappingIntStrAny | None = None, update: DictStrAny | None = None, deep: bool = False) Model
Duplicate a model, optionally choose which fields to include, exclude and change.
- Parameters:
include -- fields to include in new model
exclude -- fields to exclude from new model, as with values this takes precedence over include
update -- values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data
deep -- set to True to make a deep copy of the model
- Returns:
new model instance
- dict(*, include: AbstractSetIntStr | MappingIntStrAny | None = None, exclude: AbstractSetIntStr | MappingIntStrAny | None = None, by_alias: bool = False, skip_defaults: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) DictStrAny
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- json(*, include: AbstractSetIntStr | MappingIntStrAny | None = None, exclude: AbstractSetIntStr | MappingIntStrAny | None = None, by_alias: bool = False, skip_defaults: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Callable[[Any], Any] | None = None, models_as_dict: bool = True, **dumps_kwargs: Any) str
Generate a JSON representation of the model, include and exclude arguments as per dict().
encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().
- class TiledModel(*, type: str, version: str, full_size: Tuple[int, ...], tile_size: Tuple[int, ...], tile_levels: int, channels: int, bits_per_channel: int, brightness: float, contrast: float, color_saturation: float, gamma: float, quality: int, header: dict, images: List[ImageModel])[source]
Bases:
BaseModel
Pydantic tiled model class.
- Parameters:
type (str) -- Name of the web service.
version (str) -- Version of the web service.
full_size (List[int]) -- Full raster size, FITS style (x comes first).
tile_size (List[int]) -- Tile size, FITS style.
tile_levels (int) -- Number of levels in the image pyramid.
channels (int) -- Number of channels.
bits_per_channel (int) -- Number of bits per pixel.
brightness (float) -- Relative tile brightness (black level).
contrast (float) -- Relative tile contrast.
color_saturation (float) -- Tile color saturation.
gamma (float) -- Tile display gamma.
quality (int) -- JPEG quality (0-100).
header (dict) -- Image header keyword/value pairs.
images (List[ImageModel]) -- List of image model objects.
- classmethod construct(_fields_set: SetStr | None = None, **values: Any) Model
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = 'allow' was set since it adds all passed values
- copy(*, include: AbstractSetIntStr | MappingIntStrAny | None = None, exclude: AbstractSetIntStr | MappingIntStrAny | None = None, update: DictStrAny | None = None, deep: bool = False) Model
Duplicate a model, optionally choose which fields to include, exclude and change.
- Parameters:
include -- fields to include in new model
exclude -- fields to exclude from new model, as with values this takes precedence over include
update -- values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data
deep -- set to True to make a deep copy of the model
- Returns:
new model instance
- dict(*, include: AbstractSetIntStr | MappingIntStrAny | None = None, exclude: AbstractSetIntStr | MappingIntStrAny | None = None, by_alias: bool = False, skip_defaults: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) DictStrAny
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- json(*, include: AbstractSetIntStr | MappingIntStrAny | None = None, exclude: AbstractSetIntStr | MappingIntStrAny | None = None, by_alias: bool = False, skip_defaults: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Callable[[Any], Any] | None = None, models_as_dict: bool = True, **dumps_kwargs: Any) str
Generate a JSON representation of the model, include and exclude arguments as per dict().
encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().
- class Tiled(filename: str, extnum: int | None = None, tilesize: Tuple[int, int] = (256, 256), minmax: Tuple[int, int] | None = None, brightness: float | None = None, contrast: float | None = None, color_saturation: float | None = None, gamma: float | None = None, quality: int | None = None, nthreads: int | None = None)[source]
Bases:
object
Class for the tiled image pyramid to be visualized.
- Parameters:
extnum (int, optional) -- Extension number (for Multi-Extension FITS files).
tilesize (tuple[int, int], optional) -- shape of the served tiles.
minmax (tuple[float, float], optional) -- Intensity cuts of the served tiles.
brightness (float, optional) -- Relative tile black level of the served tiles.
contrast (float, optional) -- Relative tile contrast of the served tiles.
color_saturation (float, optional) -- Default color saturation of the served tiles.
gamma (float, optional) -- Display gamma of the served tiles.
nthreads (int, optional) -- Number of compute threads for parallelized operations.
- compute_nlevels() int [source]
Return the number of image resolution levels.
- Returns:
nlevels (int) -- Number of image resolution levels in the pyramid.
- compute_grid_shape(level: int = 0) Tuple[int, int, int] [source]
Return the number of tiles per axis at a given image resolution level.
- Returns:
shape (tuple[int, int, int]) -- Number of tiles.
- compute_tile_bordershape(level=0) Tuple[int, int, int] [source]
Return the border shape of tiles at a given image resolution level.
- Returns:
shape (tuple[int, int, int]) -- Border shape.
- get_model() TiledModel [source]
Return a Pydantic model of the tiled object.
- Returns:
model (TiledModel) -- Pydantic model instance of the tiled object
- make_header() <module 'astropy.io.fits.header' from '/usr/lib64/python3.12/site-packages/astropy/io/fits/header.py'> [source]
Generate a FITS header with a global WCS for the mosaic.
- Returns:
header (~astropy.io.fits.Header) -- FITS header for the mosaic.
- get_iipheaderstr() str [source]
Generate an IIP image header.
- Returns:
header (str) -- IIP image header.
- convert_tile(tile: ndarray, channel: int | None = None, minmax: Tuple[Tuple[int, float, float], ...] | None = None, mix: Tuple[Tuple[int, float, float, float], ...] | None = None, brightness: float | None = None, contrast: float | None = None, gamma: float | None = None, colormap: str = 'grey', invert: bool = False) ndarray [source]
Process the dynamic range of a tile.
- Parameters:
tile (ndarray) -- Input tile.
channel (int, optional) -- Image channel
minmax (list[float, float], optional) -- Tile intensity cuts.
mix (list[int, float, float, float], optional) -- Tile slice RGB colors.
brightness (float, optional) -- Relative tile brightness (black level).
contrast (float, optional) -- Relative tile contrast.
gamma (float, optional) -- Inverse tile display gamma.
colormap (str, optional) -- Colormap: 'grey' (default), 'jet', 'cold', or 'hot'.
invert (bool, optional) -- Invert the colormap.
- Returns:
tile (~numpy.ndarray) -- Processed tile.
- get_tile(tilelevel: int, tileindex: int, channel: int | None = None, minmax: Tuple[Tuple[int, float, float], ...] | None = None, mix: Tuple[Tuple[int, float, float, float], ...] | None = None, brightness: float | None = None, contrast: float | None = None, gamma: float | None = None, colormap: str = 'grey', invert: bool = False, quality: int | None = None) bytes [source]
Generate a JPEG bytestream from a tile.
- Parameters:
tilelevel (int) -- Tile resolution level.
tileindex (int) -- Tile index.
channel (int) -- Data channel (first channel is 1)
minmax (list[float, float], optional) -- Tile intensity cuts.
brightness (float, optional) -- Relative tile brightness.
contrast (float, optional) -- Relative tile contrast.
gamma (float, optional) -- Inverse tile display gamma.
colormap (str, optional) -- Colormap: 'grey' (default), 'jet', 'cold', or 'hot'.
invert (bool, optional) -- Invert the colormap.
quality (int, optional) -- JPEG quality (0-100)
- Returns:
tile (bytes) -- JPEG bytestream of the tile.
- get_pixel_values(channels: Tuple[int], pos: Tuple[int, int]) PixelValueModel [source]
Get pixel values at the given pixel coordinates in merged frame.
- get_profiles(channels: Tuple[int, ...] | None, pos1: Tuple[int, int], pos2: Tuple[int, int]) ProfileModel [source]
Get image profile(s) between the given pixel coordinates in the merged frame.
- Parameters:
- Returns:
profile (ProfileModel) -- Profile pydantic model of pixel value(s) along the line.
- pickledTiled(filename: str, **kwargs) Tiled [source]
Return pickled Tiled object if available, or initialized otherwise.
- get_object_filename(image_filename: str) str [source]
Return the name of the file containing the pickled Tiled object.
- Parameters:
filename (Image) -- Full image filename.
- Returns:
filename (str) -- Pickled object filename.
- get_data_filename(image_filename: str) str [source]
Return the name of the file containing the memory-mapped image data.
- Parameters:
filename (Image) -- Full image filename.
- Returns:
filename (str) -- Filename of the memory-mapped image data.