Visualise ROI masks in v3.6

26 views
Skip to first unread message

Matthew Smith

unread,
Jun 27, 2024, 8:42:54 AM6/27/24
to Cardinal MSI Help
Hello,

I am struggling to visualise my selected ROIs as masks over my image with v3.6.

With the previous version I used:
levels = makeFactor(L1 = ..., L2 = ..., ...)
image(MSIobject, levels ~ x * y, key=T)

However, I now get the error:
Error in rep.int(list(X), nrow(vals)) : invalid type (NULL) for 'times' (must be a vector)
If I attach it to the spectra data I can generate the masks, but I lose the factor names
spectra(cal_mix, "levels") = t(levels)

Is there a better way to do this?

Best wishes,
Matt

kbemis

unread,
Jun 27, 2024, 2:10:37 PM6/27/24
to Cardinal MSI Help
Add the variable as a column to the pixelData.

pData(MSIobject)$levels <- levels
image(MSIobject, "levels") # simplest way
image(MSIobject, levels ~ x * y, i=NULL) # alternative way

These should work. Passing just a character vector as the 2nd argument will look for the column(s) in pixelData. If using a formula, setting i=NULL says to look in pixelData rather than spectraData (where i is used to resolve the rows of the intensity matrix).

The code for correctly resolving names in the formula that aren't part of the object were very subject to breaking, so 3.6 now has stricter rules for resolving these names as above.

You can find an example here:

-Kylie

Matthew Smith

unread,
Jun 28, 2024, 4:26:34 AM6/28/24
to Cardinal MSI Help

Perfect, that has resolved it. Thanks :)
Reply all
Reply to author
Forward
0 new messages