I'm using a beginner's manual (https://apps.dtic.mil/dtic/tr/fulltext/u2/1079243.pdf) in order to count cells from a microscope image using Rstudio. After installing the BiocManager and EBImage package, the manual recommends:
Install.packages("tiff")
Install.packages("pixmap")
Install.packages("rtiff")
However, the 'rtiff' package is not available for the new version of R 4.0.3 (2020-10-10). So I couldn't install it:
Warning in install.packages :
package ‘rtiff’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
The manual continues loading the packages, creating the appropriate file paths and directories for the dataset:
library("tiff")
library("pixmap")
library("rtiff")
map_path <- "C:/Cellcounting/Analysis/Images/"
map_savdir <- "C:/Cellcounting/Analysis/Mapped_image"
map_files <- list.files(map_path, pattern="tif", full.name=F)
image_path <- "C:/Cellcounting/Analysis/Mapped_image/"
image_savdir <- "C:/Cellcounting/Analysis/Image_analysis"
image_files <- list.files(image_path, pattern="tiff", full.name=F)
csv_path <- "C:/Cellcounting/Analysis/Image_matrices"
Then, I should create the following for loop to convert images into pixel maps:
for (i in 1: length (map_files)) {
mapped_image <- paste0 (sub (". tif", replacement = "", x = map_files [i]), "_ mapped.tiff")
map1 <- readTiff (paste0 (map_path, map_files [i]))
map2 <- as.matrix (map1 @ red)
map2 [map2 <0.3] <- 0
writeTiff (map2, paste0 (map_savdir, "/", mapped_image))
}
At this point I get the following error, which I assume is because I was unable to install the 'rtiff' package:
Error in readTiff (paste0 (map_path, map_files [i])):
could not find function "readTiff"
What I can do? Is there an alternative to rtiff?
Thanks in advance,