imctools.converters

export_acquisition_csv(root_folder, output_folder, output_name='acquisition_metadata')

Export CSV file with merged acquisition metadata from all session subfolders.

Parameters
  • root_folder (Union[str, Path]) – The path to the folders containing the OME-TIFFs.

  • output_folder (Union[str, Path]) – Folder where the metadata CSV file should be stored in.

  • output_name – Filename of the acquisition metadata CSV file.

mcdfolder_to_imcfolder(input, output_folder, create_zip=False, parse_txt=False)

Converts folder (or zipped folder) containing raw acquisition data (mcd and txt files) to IMC folder containing standardized files.

Parameters
  • input (Union[str, Path]) – Input folder / .zip file with raw .mcd/.txt acquisition data files.

  • output_folder (Union[str, Path]) – Path to the output folder.

  • create_zip (bool) – Whether to create an output as .zip file.

  • parse_txt (bool) – Always use TXT files if present to get acquisition image data.

omefile_2_analysisfolder(filename, output_folder, basename, panel_csv_file=None, metalcolumn='Metal Tag', usedcolumn='ilastik', bigtiff=False, sort_channels=True, dtype=None)

Converts single OME-TIFF file to folder compatible with IMC segmentation pipeline.

Parameters
  • filename (Union[str, Path]) – Path to input OME-TIFF file.

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

  • basename (str) – Basename of the acquisition.

  • panel_csv_file (Union[str, Path, None]) – Name of the CSV file that contains the channels to be written out.

  • metalcolumn (str) – Column name of the metal names.

  • usedcolumn (str) – Column that should contain booleans (0, 1) if the channel should be used, i.e. “ilastik”.

  • bigtiff – Whether to save TIFF files in BigTIFF format.

  • sort_channels – Whether to sort channels by mass.

  • dtype (Optional[Type]) – Output Numpy data type.

omefolder_to_analysisfolder(input_folder, output_folder, panel_csv_file, analysis_stacks, metalcolumn='Metal Tag', dtype=<class 'numpy.uint16'>)

Convert OME tiffs to analysis tiffs that are more compatible with tools. A CSV with a boolean column can be used to select subsets of channels or metals from the stack. The channels of the tiff will have the same order as in the csv.’

Parameters
  • input_folder (Union[str, Path]) – Input folder

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

  • panel_csv_file (Union[str, Path]) – Name of the CSV file that contains the channels to be written out.

  • analysis_stacks (Sequence[Tuple[str, str]]) – Array of analysis stack definitions in a tuple format (column, suffix).

  • metalcolumn (str) – Column name of the metal names.

  • dtype – Output numpy dtype

omefile_to_histocatfolder(filepath, base_folder, mask_file=None, dtype=None)

Converts single OME-TIFF file to a folder compatible with HistoCAT software.

Parameters
  • filepath (Union[str, Path]) – Path to OME-TIFF input file.

  • base_folder (Union[str, Path]) – Base output folder.

  • mask_file (Union[str, Path, None]) – Path to mask file.

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

omefile_to_tifffolder(filepath, output_folder, basename=None, dtype=None)

Saves planes of single OME-TIFF file to a folder containing standard TIFF (ImageJ-compatible) files.

Parameters
  • filepath (Union[str, Path]) – Path to OME-TIFF input file.

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

  • basename (Optional[str]) – Basename for generated output files.

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

omefolder_to_histocatfolder(input_folder, output_folder, mask_folder=None, mask_suffix='_mask.tiff', dtype=None)

Converts all OME-TIFF files in input folder to a folder compatible with HistoCAT software.

Parameters
  • input_folder (Union[str, Path]) – Input folder.

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

  • mask_folder (Union[str, Path, None]) – Folder containing the masks, or single mask file.

  • mask_suffix – Mask suffix.

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

v1_to_v2(input_folder, output_folder)

Converts IMC folder from v1 to v2 format.

Parameters
  • input_folder (Union[str, Path]) – Input folder (with IMC v1 data).

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