Skip to content

Commit

Permalink
Update fmriprep_func.R
Browse files Browse the repository at this point in the history
  • Loading branch information
CogBrainHealthLab authored Jul 12, 2024
1 parent c775082 commit 1e51340
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/fmriprep_func.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ extract_headmotion=function(filename="motiondat.csv")
colnames(motiondat) = c("subj_task", "no.frames", "FD", "RMSD","FD.20", "RMSD.25")

for (fileno in 1:NROW(filelist)) {
cat(paste(filelist[fileno],"\n"))
cat(paste0(filelist[fileno],"\n"))
confounds = read.table(file = filelist[fileno],sep = "\t", header = TRUE)
confounds[confounds == "n/a"] = NA
motiondat$RMSD[fileno] = mean(as.numeric(confounds$rmsd),na.rm = T)
Expand All @@ -42,6 +42,7 @@ extract_headmotion=function(filename="motiondat.csv")
motiondat$FD.20[fileno] = NROW(which(confounds$framewise_displacement >0.2))/nrow(confounds)
}
write.csv(motiondat, file = filename)
cat(paste0("headmotion data saved to ",filename))
}
########################################################################################################
########################################################################################################
Expand Down

0 comments on commit 1e51340

Please sign in to comment.