Re: Help with macro iterating slices of a stack

Posted by gnelson on
URL: http://imagej.273.s1.nabble.com/Help-with-macro-iterating-slices-of-a-stack-tp5023279p5023282.html

Hi Pedro,

Spookily I was doing something very similar on Friday in the same manner as Philippe suggests.  My stack ended up with about 40,000 rows of objects found over my timeseries.  In these cases, R is your friend, not spreadsheets ( https://cran.r-project.org ).  I wrote this code (and learned a bit about how easy regression curves are to do with ggplot2 too) as a simple r script to start analysis based on mean area  covered per timepoint- super easy and very quick (and you can see I added other calculations per timepoint into the new data table- you could add more- see https://www.rdocumentation.org/packages/dplyr/versions/0.7.8/topics/summarise ):

*Summarise data for multiple objects per image slice in r*
library(dplyr)

library(ggplot2)
mika <-read.csv("/Users/glyn_nelson/Documents/mikolaj_noLargeVesicles.csv", header=T, sep="\t")

mika_mean <-mika %>%
  group_by(slice) %>%
  summarise(tot=sum(Area), avg=mean(Area), SD=sd(Area), count=n()) %>%
  mutate(total_calc=avg*count)

ggplot(mika_mean, aes(x=slice, y=avg)) +
  geom_point(color='#2980B9', size = 4) +
  geom_smooth(method=lm, color='#2C3E50')

--
Apologies, almost off topic, but it saves so much time compared to messing with spreadhseets with so much data!

Glyn.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html