kuwisdelu / Cardinal

Mass spectrometry imaging toolbox
http://www.cardinalmsi.org
36 stars 14 forks source link

image() after cbind() #24

Closed goterm closed 1 year ago

goterm commented 1 year ago

Hi,

I have combined 10 runs (imzML files exported from SCiLS Lab - Bruker): > binned An object of class 'MSContinuousImagingExperiment' <2001 feature, 2079 pixel> imaging dataset imageData(1): intensity featureData(0): pixelData(3): 3DPositionX 3DPositionY 3DPositionZ metadata(11): ibd binary type universally unique identifier ... files name run(10): 50um_l_p1 50um_l_p2 ... 50um_t_p4 50um_t_p5 raster dimensions: 17 x 16 x 1 coord(3): x = 1..17, y = 1..16, z = 0..0 mass range: 400 to 1000 centroided: FALSE

when I run > image(binned)

the image is printed on screen but all the pixels of each of the run are superimposed. any workaround on how this issue can be solved?

ty

cbielow commented 1 year ago

I had the same issue. Turns out that you need to remove the z coordinate (which miraculously causes image() to superimpose): i.e.

coord(binned) = coord(binned)[, 1:2] ## remove empty z-axis

(this works on the combined experiment, as well as on a single one).

It's a workaround, but it would be nice to have it fixed (or at least a debug message when invoking image()), to know what is going on.

Here is a small code snippet to reproduce the issue:


mse <- simulateImage(preset=1, npeaks=10, nruns=2, baseline=1)
cm = coord(mse)
cm$z = 0
coord(mse) = cm    # this erroneously causes superimpose
image(mse, mz=1200)
``