Thank you Daniel! It works. But I have a problem with a certain type of 3d+time dataset, when the automask effectively masks out the entire brain and leaves me staring a large blood vessel with high correlation. Is there a way of turning off the automask portion of the script? Thanks again. Giri