Skip to content

Submodules of the Import Module


xASL_imp_Anonymize.m

Format:

xASL_imp_Anonymize(imPar)

Description:

Run defacing.

  1. Iterate over list of subjects
  2. Get subject labels
  3. Process all anatomical files (xASL\_spm\_deface)

xASL_imp_AppendNiftiParameters.m

Format:

s = xASL_imp_AppendNiftiParameters(nii_files)

Description:

Append Nifti Parameters.


xASL_imp_AppendParmsParameters.m

Format:

[s, FieldNames] = xASL_imp_AppendParmsParameters(parms)

Description:

Append Parms Parameters.


xASL_imp_BIDS2Legacy.m

Format:

[x] = xASL_imp_BIDS2Legacy(x);

Description:

BIDS to Legacy conversion script which calls xASL_bids_BIDS2Legacy.

  1. Go through all studies
  2. Convert only those containing raw data
    1. Clean the old data
    1. Run the legacy conversion: Check if a dataPar is provided, otherwise use the defaults
  3. Overwrite DataParPath

xASL_imp_CatchErrors.m

Format:

[dcm2niiCatchedErrors] = xASL_imp_CatchErrors(WarningID, WarningMessage, WarningLine, WarningFileName, WarningPath, scan_name, scanpath, destdir, dcm2niiCatchedErrors, imPar, StackIn)

Description:

Catch reported warnings/errors, print them if verbose, & add them to a structure of warnings/errors to be stored for later QC.


xASL_imp_CreateSummaryFile.m

Format:

xASL_imp_CreateSummaryFile(imPar, PrintDICOMFields, x, fid_summary)

Description:

Create summary file.

  1. Create summary file
  2. Report totals

xASL_imp_DCM2NII.m

Format:

xASL_imp_DCM2NII(imPar, x)

Description:

Run the dcm2nii part of the import.

  1. Initialize defaults of dcm2nii
  2. Create the basic folder structure for sourcedata & derivative data
  3. Here we try to fix backwards compatibility, but this may break
  4. Redirect output to a log file
  5. Start with defining the subjects, visits, sessions (i.e. BIDS runs) and scans (i.e. ScanTypes) by listing or typing
  6. Sanity check for missing elements
  7. Import subject by subject, visit by visit, session by session, scan by scan

xASL_imp_DCM2NII_Initialize.m

Format:

imPar = xASL_imp_DCM2NII_Initialize(studyPath, imParPath)

Description:

Initialize DCM2NII.

  1. Read study file
  2. Specify paths
  3. Finalize the directories
  4. Specify the tokens
  5. Specify the additional details of the conversion

xASL_imp_DCM2NII_Subject.m

Format:

[imPar, summary_lines, PrintDICOMFields, globalCounts, scanNames, dcm2niiCatchedErrors, pathDcmDict] = xASL_imp_DCM2NII_Subject(x, imPar, iSubject, matches, dcm2niiCatchedErrors)

Description:

Run DCM2NII for one individual subject.

  1. Run DCM2NII for one individual subject
  2. Iterate over visits
  3. Loop through all sessions
  4. Iterate over scans
    1. Initialize variables (scanID, summary_line, first_match)
    1. Convert scan ID to a suitable name and set scan-specific parameters
    1. Minimalistic feedback of where we are
    1. Now pick the matching one from the folder list
    1. Determine input and output paths
    1. Start the conversion if this scan should not be skipped
    1. Store JSON files
    1. In case of a single NII ASL file loaded from PAR/REC, we need to shuffle the dynamics from CCCC...LLLL order to CLCLCLCL... order
    1. Make a copy of analysisdir in sourcedir
    1. Store the summary info so it can be sorted and printed below

xASL_imp_DCM2NII_Subject_CopyAnalysisDir.m

Format:

xASL_imp_DCM2NII_Subject_CopyAnalysisDir(nii_files, bClone2Source)

Description:

Make a copy of analysisdir in sourcedir.


xASL_imp_DCM2NII_Subject_ShuffleTheDynamics.m

Format:

[nii_files, summary_line, globalCounts, ASLContext] = xASL_imp_DCM2NII_Subject_ShuffleTheDynamics(globalCounts, scanpath, scan_name, nii_files, iSubject, iSession, iScan)

Description:

Shuffle the dynamics.

  1. Fallbacks
  2. Fill NIfTI Table
  3. Get ASL context if possible
  4. Only try shuffling if you dont know the ASL context already
  5. Merge NIfTIs if there are multiples for ASL or M0, merge multiple files
  6. Extract relevant parameters from nifti header and append to summary file

xASL_imp_DCM2NII_Subject_StartConversion.m

Format:

[imPar, globalCounts, x, summary_line, destdir, scanpath, scan_name, dcm2niiCatchedErrors, nii_files, first_match] = xASL_imp_DCM2NII_Subject_StartConversion(imPar, globalCounts, x, bSkipThisOne, summary_line, destdir, scanpath, scan_name, dcm2niiCatchedErrors)

Description:

Start of DCM2NII subject conversion.


xASL_imp_DCM2NII_Subject_StoreJSON.m

Format:

[parms, pathDcmDict] = xASL_imp_DCM2NII_Subject_StoreJSON(imPar, SavePathJSON, first_match, bUseDCMTK, pathDcmDict)

Description:

Store JSON.


xASL_imp_NII2BIDS.m

Format:

xASL_imp_NII2BIDS(imPar, studyPath, studyParPath)

Description:

Run the NII2BIDS conversion.

  1. Load the study parameters + dataset description
  2. Create the study description output and verify that all is there
  3. Go through all subjects and check all the M0 and ASLs and modify the JSONs

xASL_imp_NII2BIDS_Subject.m

Format:

xASL_imp_NII2BIDS_Subject(imPar, bidsPar, studyPar, listSubjects, iSubject)

Description:

Run NII to ASL-BIDS for one individual subject.

  1. Initialize
  2. Process all the anatomical files
  3. Process the perfusion files (iterate over sessions)
    1. Make a subject directory
    1. Iterate over runs

xASL_imp_NII2BIDS_SubjectSession.m

Format:

[imPar, bidsPar, studyPar, iSubject, fSes, listSubjects, subjectLabel] = xASL_imp_NII2BIDS_SubjectSession(imPar, bidsPar, studyPar, iSubject, fSes, listSubjects, subjectLabel, kk)

Description:

NII2BIDS conversion for a single sessions.


xASL_imp_NII2BIDS_SubjectSessionRun.m

Format:

[imPar, bidsPar, studyPar, subjectLabel, sessionLabel, listSubjects, fSes, inSessionPath, outSessionPath, nSes, iSubject] = xASL_imp_NII2BIDS_SubjectSessionRun(imPar, bidsPar, studyPar, subjectLabel, sessionLabel, listSubjects, fSes, inSessionPath, outSessionPath, nSes, iSubject, kk, mm)

Description:

NII2BIDS conversion for a single sessions, single run.


xASL_imp_NII2BIDS_Subject_DefineM0Type.m

Format:

[studyPar, bidsPar, jsonLocal, inSessionPath, subjectLabel, sessionLabel, bJsonLocalM0isFile] = xASL_imp_NII2BIDS_Subject_DefineM0Type(studyPar, bidsPar, jsonLocal, inSessionPath, subjectLabel, sessionLabel)

Description:

Define M0 Type.