Plotting Different Smoothing Algorithms

27 views
Skip to first unread message

Даниил Соболев

unread,
Jul 5, 2024, 9:09:10 AM7/5/24
to Cardinal MSI Help
Dear Kylie Bemis,

Thank you for developing such convenient package. I have some problems with plotting several images using such lines of code:
```p1 <- smooth(roi_raw, method="gaussian") |>
  plot(coord=list(x=1800, y=3175), xlim=c(885, 900), ylim=c(0,20), linewidth=1, fig.height=7, fig.width=9)

p2 <- smooth(roi_raw, method="sgolay") |>
  plot(coord=list(x=1800, y=3175), xlim=c(885, 900), ylim=c(0,20), linewidth=1, fig.height=7, fig.width=9)

# p3 <- smooth(roi_raw, method="bilateral") |>
  # plot(coord=list(x=1800, y=3175), xlim=c(885, 900), ylim=c(0,20), linewidth=1, fig.height=7, fig.width=9)

p4 <- smooth(roi_raw, method="diff") |>
  plot(coord=list(x=1800, y=3175), xlim=c(885, 900), ylim=c(0,20), linewidth=1, fig.height=7, fig.width=9)

p5 <- smooth(roi_raw, method="guide") |>
  plot(coord=list(x=1800, y=3175), xlim=c(885, 900), ylim=c(0,20), linewidth=1, fig.height=7, fig.width=9)

p6 <- smooth(roi_raw, method="pag") |>
  plot(coord=list(x=1800, y=3175), xlim=c(885, 900), ylim=c(0,20), linewidth=1, fig.height=7, fig.width=9)

p7 <- smooth(roi_raw, method="adaptive") |>
  plot(coord=list(x=1800, y=3175), xlim=c(885, 900), ylim=c(0,20), linewidth=1, fig.height=7, fig.width=9)

p8 <- smooth(roi_raw, method="ma") |>
  plot(coord=list(x=1800, y=3175), xlim=c(885, 900), ylim=c(0,20), linewidth=1, fig.height=7, fig.width=9)

plots_list <- list(p1, p2, p4, p5, p6, p7, p8)

matter::as_facets(plots_list, nrow = length(plots_list),
                  labels=c("Gaussian", "Savitsky-Golay", "Nonlinear Diffusion", "Guide filter", "Peak aware guided filter", "Adaptive", "Moving Average"), drop = T)
```

It prints the picture in attachments.
However, it does not look quite the same as you have described it in your manual (see an attachment).

Can you explain such difference? Maybe I have dont something wrong?
Comparison of Snoothing.jpeg
Screenshot 2024-07-05 at 16.08.29.png

kbemis

unread,
Jul 13, 2024, 6:23:54 PM7/13/24
to Cardinal MSI Help
The issue seems to be the processed plot is ignoring the dataset's pixel names.

I am working on a fix that will be available in Cardinal 3.6.4 in the next week or two.

In the meantime (since your pixel names do not seem very important), you should be able to simply do:

pixelNames(roi_raw) <- NULL 

before any processing or plotting, which should give the intended behavior with default-generated pixel names.

-Kylie
Reply all
Reply to author
Forward
0 new messages