require(rshape) extract_mean_for_roi<-function(covariate_table, mask_file, threshold, float_attribute_id=NULL, can_use_c_code=TRUE, reader_use_mandatory=TRUE) { print("Starting analysis") print(Sys.time()) # Read table my_data<-read.table(covariate_table, header=TRUE) # Get the mask mask<-getAttributeMask(mask_file, threshold) if(is.null(mask)){ warning("Couldn't load mask file in anova_shape_masked_permute"); return(); } if(sum(mask)==0){ warning("No points in the mask exceeded the specified threshold") return() } # Get 4th dimension values values<-read_frame_shape_point_masked_attribute_values(my_data, mask, float_attribute_id=float_attribute_id, can_use_c_code=can_use_c_code, reader_use_mandatory=reader_use_mandatory) if(is.null(values)){ warning(paste("failed to load the Shape files specified in '", covariate_table, "'", sep="")); return(); } cat("Here are your average ROI values") cat("\n") for (i in 1:dim(values$atts)[1]){ cat(mean(values$atts[i,])) cat("\n") } } extract_mean_for_roi("List_of_ucf_files.txt", "ROI.ucf", 0.5)