tomoscan.esrf.volume.tiffvolume.MultiTIFFVolume

class tomoscan.esrf.volume.tiffvolume.MultiTIFFVolume(file_path: Optional[str] = None, data: Optional[ndarray] = None, source_scan: Optional[TomoScanBase] = None, metadata: Optional[dict] = None, data_url: Optional[DataUrl] = None, metadata_url: Optional[DataUrl] = None, overwrite: bool = False, append: bool = False)

Bases: VolumeBase

Save tiff into a single tiff file

Parameters:

file_path (str) – path to the multiframe tiff file

__init__(file_path: Optional[str] = None, data: Optional[ndarray] = None, source_scan: Optional[TomoScanBase] = None, metadata: Optional[dict] = None, data_url: Optional[DataUrl] = None, metadata_url: Optional[DataUrl] = None, overwrite: bool = False, append: bool = False) None

Methods

__init__([file_path, data, source_scan, ...])

browse_data_files([url])

return a generator go through all the existings files associated to the data volume

browse_data_urls([url])

generator on data urls used.

browse_metadata_files([url])

return a generator go through all the existings files associated to the data volume

browse_slices([url])

generator of 2D numpy array representing a slice

check_can_provide_identifier()

clear_cache()

remove object stored in data and medatada

data_file_saver_generator(n_frames, ...)

Provide a helper class to dump data frame by frame.

deduce_data_and_metadata_urls(url)

compute data and metadata urls from 'parent url' :return: data_url: Optional[DataUrl], metadata_url: Optional[DataUrl]

example_defined_from_str_identifier()

example as string to explain how users can defined identifiers from a string

from_identifier(identifier)

Return the Dataset from a identifier

get_bounding_box([axis])

Return the bounding box covered by the Tomo object axis is expected to be in (0, 1, 2) or (x==0, y==1, z==2)

get_identifier()

dataset unique identifier.

get_min_max()

compute min max of the volume.

get_min_max_values([url])

compute min max over 'data' if exists else browsing the volume slice by slice

get_slice([index, axis, xy, xz, yz, url])

get_volume_shape([url])

load()

load_chunk(chunk[, url])

Load a sub-volume.

load_data([url, store])

load_metadata([url, store])

save([url])

save_data([url])

save data to the provided url or existing one if none is provided

save_metadata([url])

save metadata to the provided url or existing one if none is provided

select(volume[, xy, xz, yz, axis, index])

Attributes

EXTENSION

data

data_extension

data_url

extension

metadata

metadata_extension

metadata_url

overwrite

pixel_size

position

position are provided as a tuple using the same reference for axis as the volume data.

source_scan

url

voxel_size

voxel size as (axis 0 dim - aka z, axis 1 dim - aka y, axis 2 dim aka z)

browse_data_files(url=None)

return a generator go through all the existings files associated to the data volume

browse_data_urls(url=None)

generator on data urls used.

Parameters:

url – data url to be used. If not provided will take self.data_url

browse_metadata_files(url=None)

return a generator go through all the existings files associated to the data volume

browse_slices(url=None)

generator of 2D numpy array representing a slice

Parameters:

url – data url to be used. If not provided will browse self.data if exists else self.data_url

Warning:

this will get the slice from the data on disk and never use data property. so before browsing slices you might want to check if data is already loaded

clear_cache()

remove object stored in data and medatada

data_file_saver_generator(n_frames, data_url: DataUrl, overwrite: bool)

Provide a helper class to dump data frame by frame. For know the only possible interaction is Helper[:] = frame

Parameters:
  • n_frames (int) – number of frame the final volume will contain

  • data_url (DataUrl) – url to dump data

  • overwrite (bool) – overwrite existing file ?

deduce_data_and_metadata_urls(url: Optional[DataUrl]) tuple

compute data and metadata urls from ‘parent url’ :return: data_url: Optional[DataUrl], metadata_url: Optional[DataUrl]

static example_defined_from_str_identifier() str

example as string to explain how users can defined identifiers from a string

static from_identifier(identifier)

Return the Dataset from a identifier

get_bounding_box(axis: Optional[Union[str, int]] = None)

Return the bounding box covered by the Tomo object axis is expected to be in (0, 1, 2) or (x==0, y==1, z==2)

get_identifier() MultiTiffVolumeIdentifier

dataset unique identifier. Can be for example a hdf5 and en entry from which the dataset can be rebuild

get_min_max() tuple

compute min max of the volume. Can take some time but avoid to load the full volume in memory

get_min_max_values(url=None) tuple

compute min max over ‘data’ if exists else browsing the volume slice by slice

Parameters:

url – data url to be used. If not provided will take self.data_url

load_chunk(chunk, url=None)

Load a sub-volume.

Parameters:
  • chunk – tuple of slice objects indicating which chunk of the volume has to be loaded.

  • url – data url to be used. If not provided will take self.data_url

property position: Optional[tuple]

position are provided as a tuple using the same reference for axis as the volume data. position is returned as (axis_0_pos, axis_1_pos, axis_2_pos). Can also be see as (z_position, y_position, x_position)

save_data(url: Optional[DataUrl] = None) None

save data to the provided url or existing one if none is provided

save_metadata(url: Optional[DataUrl] = None) None

save metadata to the provided url or existing one if none is provided

property voxel_size: Optional[tuple]

voxel size as (axis 0 dim - aka z, axis 1 dim - aka y, axis 2 dim aka z)