This is the first time for me to ask a question, hopefully I wrote my script in correct way. I wanted to analyze my immunofluorescence images, each images have 2 different colors for same cells, and basically I want to show all the cells with blue stain which is stained by every cells, and pixel differences of green between images. I load the merged image which include blue and green stains. I used colocr package. However R doesn't recognize the blue stain, I confirm by looking images if all cells have blue. So I was wondering if anyone know what it is the solution to show blue stain. I attached my script below
Thank you
library(imager)
library(magick)
library(colocr)
library(imagerExtra)
>image <- image_load(system.file('extdata', 'image.tif', package = 'colocr')) # merge
>image1 <- imager::channel(image, 1) # blue
>image2 <- imager::channel(image, 2) # green
>par(mfrow = c(1,3), mar = rep(1,4))
>plot(image, axes = FALSE, main = 'Merged')
>plot(image1, axes = FALSE, main = 'blue')
>plot(image2, axes = FALSE, main = 'green')
Created on 2022-04-29 by the reprex package (v2.0.1)
CodePudding user response:
Are you sure you have the index of the green and blue channels correct? Often channel 1 is red and channel 2 is green. To remove doubt, you could use imager::G
to extract the green channel and imager::B
to get the blue channel:
library(imager)
library(magick)
library(colocr)
library(imagerExtra)
image <- image_load(system.file('extdata', 'example1.png', package = 'colocr'))
image1 <- B(image) # blue
image2 <- G(image) # green
par(mfrow = c(1,3), mar = rep(1,4))
plot(image, axes = FALSE, main = 'Merged')
plot(image1, axes = FALSE, main = 'blue')
plot(image2, axes = FALSE, main = 'green')
Created on 2022-04-29 by the reprex package (v2.0.1)