Submodules of the Import Module
xASL_imp_Anonymize.m
Format:
xASL_imp_Anonymize(imPar)
Description:
Run defacing.
- Iterate over list of subjects
- Get subject labels
- 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.
- Go through all studies
- Convert only those containing raw data
-
- Clean the old data
-
- Run the legacy conversion: Check if a dataPar is provided, otherwise use the defaults
- 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.
- Create summary file
- Report totals
xASL_imp_DCM2NII.m
Format:
xASL_imp_DCM2NII(imPar, x)
Description:
Run the dcm2nii part of the import.
- Initialize defaults of dcm2nii
- Create the basic folder structure for sourcedata & derivative data
- Here we try to fix backwards compatibility, but this may break
- Redirect output to a log file
- Start with defining the subjects, visits, sessions (i.e. BIDS runs) and scans (i.e. ScanTypes) by listing or typing
- Sanity check for missing elements
- 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.
- Read study file
- Specify paths
- Finalize the directories
- Specify the tokens
- 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.
- Run DCM2NII for one individual subject
- Iterate over visits
- Loop through all sessions
- Iterate over scans
-
- Initialize variables (scanID, summary_line, first_match)
-
- Convert scan ID to a suitable name and set scan-specific parameters
-
- Minimalistic feedback of where we are
-
- Now pick the matching one from the folder list
-
- Determine input and output paths
-
- Start the conversion if this scan should not be skipped
-
- Store JSON files
-
- 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
-
- Make a copy of analysisdir in sourcedir
-
- 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.
- Fallbacks
- Fill NIfTI Table
- Get ASL context if possible
- Only try shuffling if you dont know the ASL context already
- Merge NIfTIs if there are multiples for ASL or M0, merge multiple files
- 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.
- Load the study parameters + dataset description
- Create the study description output and verify that all is there
- 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.
- Initialize
- Process all the anatomical files
- Process the perfusion files (iterate over sessions)
-
- Make a subject directory
-
- 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.