readImagefromTXT {imcRtools} | R Documentation

## Reads one or multiple .txt files into a CytoImageList object

### Description

Reader function to generate `Image` objects in form of a `CytoImageList` container from .txt files.

### Usage

    readImagefromTXT(
      path,
      pattern = ".txt$",
      channel_pattern = "[A-Za-z]{1,2}[0-9]{2,3}Di",
      index_names = c("X", "Y"),
      BPPARAM = SerialParam()
    )

### Arguments

`path` | Full path to where the individual .txt files are located. This is usualy the path where the .mcd file is located.
`pattern` | pattern to select which files should be read in (default `".txt$"`).
`channel_pattern` | regular expression to select the channel names from the files.
`index_names` | exact names of the columns storing the x and y coordinates of the image
`BPPARAM` | parameters for parallelized reading in of images. This is only recommended for very large images.

### Value

returns a `CytoImageList` object containing one `Image` object per .txt file.

### Imaging mass cytometry .txt files

As part of the raw data folder, the Hyperion imaging system writes out one .txt file per acquisition. These files store the ion counts per pixel and channel.

This function reads these .txt files into a single `CytoImageList` object for downstream analysis. The `pattern` argument allows selection of all .txt files or a specific subset of files. The `channelNames` of the `CytoImageList` object are determined by the `channel_pattern` argument.

### Author(s)

Nils Eling (nils.eling@dqbm.uzh.ch)

### See Also

`CytoImageList` for the container

`MulticoreParam` for parallelized processing

`Image` for the multi-channel image object

`vignette("cytomapper")` for visualization of multi-channel images

### Examples

    path <- system.file("extdata/mockData/raw", package = "imcRtools")

    # Read in all images
    x <- readImagefromTXT(path)
    x

    # Read in specific files
    y <- readImagefromTXT(path, pattern = "ROI_002")
    y

    # Read in other channelNames
    z <- readImagefromTXT(path, channel_pattern = "[A-Za-z]{2}[0-9]{3}")
    z

[Package imcRtools version 1.0.2 Index]