flame.image.FLAMEImage

class flame.image.FLAMEImage(impath: str, jsonext: str, checkChannels: bool = True, overrideNChannels: int | None = None, checkFrames: bool = True, overrideNFrames: int | None = None, checkZs: bool = False, requireBidirectionalCorrection: bool = False)[source]

Bases: object

__init__(impath: str, jsonext: str, checkChannels: bool = True, overrideNChannels: int | None = None, checkFrames: bool = True, overrideNFrames: int | None = None, checkZs: bool = False, requireBidirectionalCorrection: bool = False) None[source]

FLAMEImage object.

Parameters:
  • impath (str): the absoulte path to the provided image, expected to be in tif format.

  • jsonext (str): the expected string for the json paired with the image tif.

  • checkChannels (bool): whether to confirm the number of channels listed in the JSON matches the tif data (DEFAULT = True).

  • overrideNChannels (None, int): if None, don’t override #channels. If not None, will override #channels with provided value.

  • checkFrames (bool): whether to confirm the number of frames listed in the JSON matches the tif data (DEFAULT = True).

  • overrideNFrames (None, int): if None, don’t override #frames. If not None, will override #frames with provided value

  • checkZs (bool): whether to confirm the number of Zs listed in the JSON matches the tif data (DEFAULT = False).

NOTE: overrideNZs is not required because tifffile package does not check for number of Zs when unpacking a tif of size NYX to ZFCYX. This means that with NChannel and NFrame overrides being set, the number of Zs will be dynamically unpacked based on N (the number of pages in the raw tiff file).

Attributes:
  • logger (Logger): the logger object with the name “main”

  • impath (str): the absolute path to the provided image

  • jsonpath (str): the path to the JSON corresponding to the tiff. Dynamically determined using params impath and jsonext.

  • tileData (TileData): the TileData object created from jsonpath

  • imageData (None or np.array): the placeholder variable for image data if opened

  • isOpen (bool): whether the tif data is loaded into the imageData attribute

  • checkChannels, checkFrames, checkZs (bool): see above. Used in checkForCompleteness() to validate the tif data.

Methods:
  • get_json_path(ext: str) -> str: returns the json path given the impath and provided json extension

  • openImage() -> None: loads image data from impath into imageData attribute. Sets isOpen attribute to True.

  • closeImage() -> None: cleans image data from imageData attribute and system memory. Sets isOpen to False.

  • raw() -> np.array: returns raw image data from tif as numpy array

  • checkForCompleteNess() -> None: will throw FlameImageError if tif at provided path has shape inconsistent with tileData.

  • getFrames(start: int, end: int, op: str = “add”) -> np.array: aggregate frames from [start:end] using operation ‘op’.

Methods

__init__(impath, jsonext[, checkChannels, ...])

FLAMEImage object.

checkForCompleteness()

Caution!! Assumes image will be in *XY format * is the wildcard dimension, which theoretically could contain intercolated Z, channel, and frame information

closeImage()

get_frames(start_end[, op])

Description: Merge the frames of a FLAME image using a provided operator.

get_json_path(ext)

openImage()

Will open the image into the memory of the object.

raw()

checkForCompleteness() None[source]

Caution!! Assumes image will be in *XY format * is the wildcard dimension, which theoretically could contain intercolated Z, channel, and frame information

get_frames(start_end: tuple[int], op: str = 'add') numpy.typing.NDArray[source]

Description: Merge the frames of a FLAME image using a provided operator.

Args:
  • start_end (tuple[int]): Must be of length 2. Starting and ending frame indices to be merged.

  • op (str) def=”add”: The operation to merge the selected frames. default (and only currently accepted option) is “add” for addition.

Returns:
openImage() None[source]

Will open the image into the memory of the object.