Failure to plot high resolution images

30 views
Skip to first unread message

Matthew Smith

unread,
Mar 22, 2024, 5:39:25 AMMar 22
to Cardinal MSI Help
Hello,

Love using this package, such flexibility and functionality.

I have started to encounter a problem as I generate ion images with a large number of pixels - i.e large tissue with high spatial resolution.

I get the error screen: 'R Session Aborted \n R enountered a fatal error. \n The session was terminated.' 

I believe this is a memory issue as it only happens when there's many pixels to plot and it is intermitent on the same image.

However, this seems to be an issue with the way the image is plotted within R since my PC should easily be capable of plotting the images.

Are there ways to make this work? Parallelising the plotting somehow for instance. I notice that removing contrast.enhance and smooth.image makes it work, but presumably because the image has less entropy so is computationally easier...?


p.s I notice I get a similar issue if I try to plot in a for loop:

# Individual plots

for(feat_ind in 1:nrow(fData(tissue_subset))) {

  image_name = sprintf("%s/%s.png",
                       folder,
                       gsub("[/]", "-_-", fData(tissue_subset)$name[feat_ind]))

  png(filename = image_name, width = 500, height = 400,)
  Cardinal::image(tissue_subset,
                  contrast.enhance="histogram",
                  smooth.image = "adaptive", 
                  superpose = FALSE,
                  feature =fData(tissue_subset)@mz[feat_ind])
  dev.off()

}

Reply all
Reply to author
Forward
0 new messages