Differences between revisions 3 and 4
Deletions are marked like this. Additions are marked like this.
Line 31: Line 31:
#! /bin/tcsh -ef # /bin/tcsh -ef

See also AdniReconNotes

Notes on how to download ADNI subject data and incorporate into our local copy, which is found here:

cd /autofs/cluster/con_002/users/ADNI

The main ADNI site is here: http://adni.loni.ucla.edu/

It is necessary to obtain an account with them in order to download data from the LONI site, which is here: https://ida.loni.ucla.edu/login.jsp?project=ADNI

T2/PD data

  • on the LONI ADNI page, click on Search->Advanced Search

  • for 'month 0' scans, select both Screening and Baseline, or select one of the other months (for longitudinal scans)
  • enter '*PD*T2*' in the MRI Series Description text box
  • select PD and T2 weighting
  • select Image count All
  • click the SEARCH button
  • now you will need to save the matches, to do this you will need to select each scan on every page of the results (there could be 20 or more pages of results, because the stupid interface seems to display only 20 at a time). click the 'Click here to select all series on the page' checkbox, but then uncheck duplicate scans for the same subject.
  • before going to the next page, click Add to Collection. if this is the first page of the search, then create a new collection name (say, 'Month_6_PDT2'). Click Add.
  • repeat the 'select all', 'unselect duplicates', 'add to collection' step for each page of the search results (warning! this is mind numbingly boring, tedious and time consuming!)
  • once the image collection is done, click on Download->Image Collections, in My Collections, find the collection you just created and select 'not downloaded'

  • select the 'All' checkbox
  • select the 'Nifti' radio button
  • click DOWNLOAD, this brings-up a java box which then prompts for a directory. once that is selected, then it will being downloading, which could take days....
  • by default, the java thing puts the files in a directory named ADNI... rename that to something appropriate, in this example, to "Month_6_PDT2"
  • within this dir, the .xml files contain info on the PD and T2 files, and the name itself contains unique identifying info for each file, so a script is necessary to extract all this and mri_convert the nifti file. that script looks like this:

# /bin/tcsh -ef

# the adni root dir
set ADNI=(/autofs/cluster/con_002/users/ADNI)

# the month we're working with (be sure to update this var!!!!!!)
set m=(_m6)

foreach f (`ls *.xml`)

# find out which image type this .xml file describes (PD or T2)
set weighting=(`grep Weighting $f | awk 'BEGIN { FS = "[<>]" } ; {printf $3}'`)

# chop-off .xml extension
set ff=(`basename $f .xml`)

# extract subject name
set subjid=(`echo $ff | awk 'BEGIN { FS = "_" } ; {printf $4}'`)

# extract unique identifier for this file
set uid=(`echo $ff | awk 'BEGIN { FS = "_I" } ; {printf $2}'`)

# convert file, storing into main adni dir
set niifile=(`find | grep "_S_${subjid}" | grep "_I${uid}" | grep "\.nii"`)
set origdir=($ADNI/${subjid}${m}/mri/orig)
if ( -e $origdir) then
    mri_convert $niifile $origdir/${weighting}.mgz
endif

end
  • In this script, be sure to update the 'm' var to the proper month if reusing this script on a different month!

AdniDownloadNotes (last edited 2021-05-03 08:50:44 by DevaniCordero)