On Nov 2, 2012, at 6:40 AM, jforien wrote:
> Dear all,
>
> I have a stack of 121 images and a text file of 121 values on individual
> line. Value of the first line correspond to the first slice, value of the
> second line corrrespond to the second slice and so on.
>
> I would like to multiply each slices of the stack with their respective
> values contained in the .txt file.
>
> Does anyone know a method to do it in ImageJ?
Here is a macro that does this:
path = getDirectory("home") + "values.txt";
values = split(File.openAsString(path), "\n");
n = values.length;
if (n!=nSlices)
exit("Number of values != stack size");
for (i=0; i<n; i++) {
setSlice(i+1);
run("Multiply...", "value="+values[i]+" slice");
}
-wayne
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html