Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

CBF: realignment parameters #102

Closed
dalejn opened this issue Feb 12, 2018 · 1 comment
Closed

CBF: realignment parameters #102

dalejn opened this issue Feb 12, 2018 · 1 comment

Comments

@dalejn
Copy link

dalejn commented Feb 12, 2018

Use CBF time series to derive the global signal and the mean signals in wm and csf.
For motion parameters, extract the parameters of the even volumes (control volumes) after doing motion correction for the whole ASL time series. Maybe using the mean of the odd and even volumes is a better choice

@dalejn
Copy link
Author

dalejn commented Feb 12, 2018


setwd("/Users/student/Desktop/dale/realignment")

# starting with each subject's 80x6 realignment.1D file
filenames <- list.files(pattern="realignment.1D")

# grab subject IDs and dates
names <- substr(filenames, 1, 33)

for(i in names){
  # read in the realignment files with 40 tag-control CBF pairs
  filepath <- file.path(paste(i,".1D",sep=""))
  assign(i, read.table(filepath, sep = "", header=FALSE, skip=0))

  # grab only odd rows, i.e. only the 40 tag images
  odd <- get(i)
  odd <- odd[seq(1, nrow(odd), 2), ]
  
  # grab only even rows, i.e. only the 40 control images
  even <- get(i)
  even <- even[seq(2, nrow(even), 2), ]
  
  # average to generate 40 averaged tag-control realignment parameters
  mean <- (odd + even)/2
  
  # write even/control image realignment parameters in new directory
  write.table(
    even, sep = "  ",
    file = paste("controlCBFonly/control",i,'1D',sep='.'),
    col.names = FALSE,
    row.names = FALSE)
 
  # write averaged tag-control realignment parameters in new directory
  write.table(
    mean, sep = "  ",
    file = paste("meanCBF/mean",i,'1D',sep='.'),
    col.names = FALSE,
    row.names = FALSE)
}

@dalejn dalejn closed this as completed Feb 14, 2018
rciric added a commit that referenced this issue Feb 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant