R/readImagefromTXT.R
readImagefromTXT.Rd
Reader function to generate Image
objects
in form of a CytoImageList
container from .txt files.
readImagefromTXT(
path,
pattern = ".txt$",
channel_pattern = "[A-Za-z]{1,2}[0-9]{2,3}Di",
index_names = c("X", "Y"),
BPPARAM = SerialParam()
)
Full path to where the individual .txt files are located. This is usualy the path where the .mcd file is located.
pattern to select which files should be read in (default
".txt$"
).
regular expression to select the channel names from the files.
exact names of the columns storing the x and y coordinates of the image
parameters for parallelized reading in of images. This is only recommended for very large images.
returns a CytoImageList
object containing one
Image
object per .txt file.
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.
CytoImageList
for the container
MulticoreParam
for parallelized processing
Image
for the multi-channel image object
vignette("cytomapper")
for visualization of multi-channel images
path <- system.file("extdata/mockData/raw", package = "imcRtools")
# Read in all images
x <- readImagefromTXT(path)
x
#> CytoImageList containing 3 image(s)
#> names(3): 20210305_NE_mockData2_ROI_001_1 20210305_NE_mockData2_ROI_002_2 20210305_NE_mockData2_ROI_003_3
#> Each image contains 5 channel(s)
#> channelNames(5): Ag107Di Pr141Di Sm147Di Eu153Di Yb172Di
# Read in specific files
y <- readImagefromTXT(path, pattern = "ROI_002")
y
#> CytoImageList containing 1 image(s)
#> names(1): 20210305_NE_mockData2_ROI_002_2
#> Each image contains 5 channel(s)
#> channelNames(5): Ag107Di Pr141Di Sm147Di Eu153Di Yb172Di
# Read in other channelNames
z <- readImagefromTXT(path, channel_pattern = "[A-Za-z]{2}[0-9]{3}")
z
#> CytoImageList containing 3 image(s)
#> names(3): 20210305_NE_mockData2_ROI_001_1 20210305_NE_mockData2_ROI_002_2 20210305_NE_mockData2_ROI_003_3
#> Each image contains 5 channel(s)
#> channelNames(5): Ag107 Pr141 Sm147 Eu153 Yb172