Login  Register

Re: Plotting mean of an ROI and saving to excel

Posted by DanielatAmthorLab on Jan 21, 2015; 10:20pm
URL: http://imagej.273.s1.nabble.com/Plotting-mean-of-an-ROI-and-saving-to-excel-tp5011245p5011308.html

Michael:

I tried some of that code you wrote, and it partially did what I needed it to.
Here are the changes I made.

for (H=0; H<ROIlist.length; H++){
 	//roiManager("Select", H);
 	thisROI=ROIlist[H];
 	ROInam=replace(thisROI, ".roi", "");//get a name for current ROI
	//create an excel file to save data to.
 	f = File.open(dir2+savfnamstart+"To"+namlng+ROInam+".xls");
	textline="";
	for (i=0; i<inlist.length; i++) {
		open(dir1+inlist[i]);
		roiManager("select", H);
		getStatistics(area, mean);
		textline=textline + mean + "\t";
		close();
	}
	print(f,textline);
	File.close(f);	 
}



Kay

I would like to be able to do it all in one script, especially in one imagej macro script. (because I have almost no python ability whatsoever. :/  )

with those adjustments above, it will write the mean value of the selected ROI into a txt / excel file, but it only does it for what seems to be the first frame of each video. What I need is a file for each ROI. Each one of those files will have the mean of every frame of the videos. So if I ran the script on 3 videos and used 2 ROIs I would end up with two excel files (one for each ROI). If I opened one of those excel files I would have 3 columns with the mean of each frame of that video (column1 has values of video1, column2 has video 2, etc.).


Thank you both so much for your help! I hope I did not take too long in getting back.