imctools.data

imctools.data.acquisition

class AblationImageType(value)

Before / after ablation types of images

BEFORE = 'before'
AFTER = 'after'
class AcquisitionDict
slide_id: int
id: int
origin: str
source_path: str
max_x: int
max_y: int
signal_type: Optional[str]
segment_data_format: Optional[str]
ablation_frequency: Optional[float]
ablation_power: Optional[float]
start_timestamp: Optional[str]
end_timestamp: Optional[str]
movement_type: Optional[str]
ablation_distance_between_shots_x: Optional[float]
ablation_distance_between_shots_y: Optional[float]
template: Optional[str]
roi_start_x_pos_um: Optional[float]
roi_start_y_pos_um: Optional[float]
roi_end_x_pos_um: Optional[float]
roi_end_y_pos_um: Optional[float]
description: Optional[str]
has_before_ablation_image: bool
has_after_ablation_image: bool
metadata: Optional[Dict[str, str]]
is_valid: bool
class Acquisition(slide_id, id, origin, source_path, max_x, max_y, signal_type=None, segment_data_format=None, ablation_frequency=None, ablation_power=None, start_timestamp=None, end_timestamp=None, movement_type=None, ablation_distance_between_shots_x=None, ablation_distance_between_shots_y=None, template=None, roi_start_x_pos_um=None, roi_start_y_pos_um=None, roi_end_x_pos_um=None, roi_end_y_pos_um=None, description=None, has_before_ablation_image=False, has_after_ablation_image=False, metadata=None, is_valid=True)

IMC acquisition as a collection of acquisition channels.

symbol = 'a'
static from_dict(d)

Recreate an object from dictionary

property metaname

Meta name fully describing the entity

property n_channels

Number of channels

property channel_names

Channel names

property channel_labels

Channel labels

property channel_masses

Channel masses

get_name_indices(names)

Returns a list with the indices from names

get_mass_indices(masses)

Returns the channel indices from the queried mass

get_csv_dict()

Returns dictionary for CSV tables

imctools.data.acquisitiondata

class AcquisitionData(acquisition, image_data)

Container for IMC acquisition binary image data.

property acquisition

Acquisition metadata

property image_data

Binary image data as numpy array

to_xarray()

Get binary image data as xarray

property is_valid
property n_channels

Number of channels

property channel_names

Channel names

property channel_labels

Channel labels

property channel_masses

Channel masses

get_image_stack_by_indices(indices)

Get image stack by channel indices

get_image_by_index(index)

Get channel image by its index

get_image_stack_by_names(names)

Get image stack by channel names

get_image_by_name(name)

Get channel image by its name

get_image_stack_by_labels(labels)

Get image stack by channel labels

get_image_by_label(label)

Get channel image by its label

save_ome_tiff(filename, names=None, masses=None, xml_metadata=None, dtype=None)

Save OME TIFF file.

Parameters
  • filename (Union[str, Path]) – .ome.tiff file name.

  • names (Optional[Sequence[str]]) – Channel names (metals / tags).

  • masses (Optional[Sequence[str]]) – Channel masses.

  • xml_metadata (Optional[str]) – Original MCD-XML metadata.

  • dtype (Optional[object]) – Output numpy format.

save_tiff(filename, names=None, imagej=False, bigtiff=False, dtype=None, compression=0)
save_tiffs(output_folder, names=None, masses=None, basename=None, imagej=True, bigtiff=False, dtype=None, compression=0)

Save ImageJ TIFF files in a folder.

Parameters
  • output_folder (Union[str, Path]) – Output folder.

  • names (Optional[Sequence[str]]) – Channel names (metals / tags).

  • masses (Optional[Sequence[str]]) – Channel masses.

  • basename (Optional[str]) – Base file name.

  • imagej – Save TIFF file compatible with ImageJ format.

  • bigtiff – BigTIFF format.

  • dtype (Optional[object]) – Output numpy format.

  • compression (int) – Compression level.

imctools.data.channel

class ChannelDict
acquisition_id: int
id: int
order_number: int
name: str
label: Optional[str]
mass: Optional[int]
min_intensity: Optional[float]
max_intensity: Optional[float]
metadata: Optional[Dict[str, str]]
class Channel(acquisition_id, id, order_number, name, label=None, mass=None, min_intensity=None, max_intensity=None, metadata=None)

IMC acquisition channel. Represents an image intensity.

symbol = 'c'
static from_dict(d)

Recreate an object from dictionary

property metaname

Meta name fully describing the entity

get_csv_dict()

Returns dictionary for CSV tables

imctools.data.panorama

class PanoramaDict
slide_id: int
id: int
image_type: str
description: str
x1: float
y1: float
x2: float
y2: float
x3: float
y3: float
x4: float
y4: float
rotation_angle: float
metadata: Optional[Dict[str, str]]
class Panorama(slide_id, id, image_type, description, x1, y1, x2, y2, x3, y3, x4, y4, rotation_angle, metadata=None)

Panoramic image (manually attached or automatically generated).

symbol = 'p'
static from_dict(d)

Recreate an object from dictionary

property metaname

Meta name fully describing the entity

get_csv_dict()

Returns dictionary for CSV tables

imctools.data.session

class SessionDict
id: str
name: str
imctools_version: str
created: str
metadata: Optional[Dict[str, Any]]
slides: List[imctools.data.slide.SlideDict]
acquisitions: List[imctools.data.acquisition.AcquisitionDict]
panoramas: List[imctools.data.panorama.PanoramaDict]
channels: List[imctools.data.channel.ChannelDict]
class Session(id, name, imctools_version, created, metadata=None)

IMC session data. Container for all slides, acquisitions, panoramas, etc.

static from_dict(d)

Recreate an object from dictionary

get_csv_dict()

Returns dictionary for CSV tables

save(filepath)

Save session data in JSON format.

Parameters

filepath (str) – Output JSON file path

save_meta_csv(output_folder)

Writes the metadata as CSV tables

static load(filepath)

Load IMC session data from JSON file

Parameters

filepath (Union[str, Path]) – Input JSON file path.

property metaname

Meta name fully describing the entity

property acquisition_ids
Return type

Tuple[int, …]

imctools.data.slide

class SlideDict
session_id: str
id: int
description: Optional[str]
width_um: Optional[int]
height_um: Optional[int]
has_slide_image: Optional[bool]
metadata: Optional[Dict[str, str]]
class Slide(session_id, id, description=None, width_um=None, height_um=None, has_slide_image=None, metadata=None)

IMC slide (container for IMC acquisitions, panoramas and other entities).

symbol = 's'
static from_dict(d)

Recreate an object from dictionary

property metaname

Meta name fully describing the entity

property name

Slide name (if available)

property uid

Slide UUID (if available)

property filename

Slide original source filename (if available)

property sw_version

CyTOF software version (if available)

get_csv_dict()

Returns dictionary for CSV tables