Submodules of the Import Module
xASL_bids_AddGeneratedByField.m
Format:
xASL_bids_AddGeneratedByField(x, pathJSONin[, pathJSONout])
Description:
Add the generated by field to the struct.
xASL_bids_BIDS2Legacy.m
Format:
[dataPar] = xASL_bids_BIDS2Legacy(pathStudy, x[, bOverwrite, dataPar])
Description:
This function converts BIDS rawdata (in pathStudy/rawdata/) to xASL legacy derivative format (e.g. pathStudy/derivatives/ExploreASL/)
Can be updated step-by-step when ExploreASL's derivative structure moves to BIDS NB: ask how Visits/session layer is defined in bids-matlab (should be separate layer within subjects, but now isn't?)
This function performs the following steps:
- Parse a folder using bids-matlab
- Define Subject
- Define SubjectVisit
- Parse modality
- Parse scantype
- Compile paths for copying
- Manage sidecars to copy
- Copy files
- Parse M0
- Create DataPar.json
- Copy participants.tsv
- Add dataset_description.json
- Clean up
xASL_bids_BIDS2Legacy_CompilePathsForCopying.m
Format:
[bidsPar, TypeIs, pathOrig, pathDest] = xASL_bids_BIDS2Legacy_CompilePathsForCopying(bidsPar, TypeIs, ModalityIs, RunIs, iSubjSess, BIDS, TypeRunIndex, ModalityFields, pathLegacy_SubjectVisit)
Description:
Compile paths for BIDS to Legacy copying.
xASL_bids_BIDS2Legacy_ManageSidecars.m
Format:
[bidsPar, pathOrig, pathDest, TypeIs] = xASL_bids_BIDS2Legacy_ManageSidecars(bidsPar, pathOrig, pathDest, TypeIs)
Description:
Manage JSON sidecars for BIDS2Legacy conversion.
xASL_bids_BIDS2Legacy_ParseModality.m
Format:
xASL_bids_BIDS2Legacy_ParseModality(BIDS, bidsPar, SubjectVisit, iSubjSess, ModalitiesUnique, nModalities, bOverwrite, pathLegacy_SubjectVisit)
Description:
Parse modality for BIDS to Legacy conversion.
xASL_bids_BIDS2Legacy_ParseScanType.m
Format:
xASL_bids_BIDS2Legacy_ParseScanType(modalityConfiguration, SubjectVisit, RunsUnique, RunsAre, bOverwrite, Reference, bidsPar, ModalityIs, iSubjSess, BIDS, ModalityFields, pathLegacy_SubjectVisit)
Description:
Parse scan type during BIDS to Legacy conversion.
xASL_bids_BIDS2xASL_CopyFile.m
Format:
xASL_bids_BIDS2xASL_CopyFile(pathOrig, pathDest, bOverwrite)
Description:
Copy files for BIDS to Legacy conversion.
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.
- Input check
- Start with checking dataset_description.json & rawdata
-
- The input is dataset_description.json in the rawdata folder
-
- The input is dataPar.json or sourceStructure.json - have to look for a rawdata folder
- Run the legacy conversion: Check if a dataPar is provided, otherwise use the defaults
- Overwrite DatasetRoot
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_CheckIfFME.m
Format:
[resultJSON, bTimeEncoded, bTimeEncodedFME] = xASL_imp_DCM2NII_CheckIfFME(nii_files, bTimeEncoded, bTimeEncodedFME)
Description:
Check if the current sequence is a FME (Fraunhofer Mevis) time encoded sequence.
xASL_imp_DCM2NII_ReorderTimeEncoded.m
Format:
xASL_imp_DCM2NII_ReorderTimeEncoded(nii_files, bTimeEncoded, resultJSON)
Description:
Reorder TEs and PLDs accordingly for time encoded sequences.
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
- 9 Copy single dicom as QC placeholder
-
- Store the summary info so it can be sorted and printed below
xASL_imp_DCM2NII_Subject_SortASLVolumes.m
Format:
[x, nii_files, summary_line, globalCounts, ASLContext] = xASL_imp_DCM2NII_Subject_SortASLVolumes(x, globalCounts, scanpath, scan_name, nii_files, iSubject, iSession, iScan)
Description:
Sort ASL Volumes.
- 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_Deface.m
Format:
xASL_imp_Deface(imPar)
Description:
Run defacing.
- Iterate over list of subjects
- Get subject labels
- Process all anatomical files (
xASL\_spm\_deface
)
xASL_imp_Initialize.m
Format:
imPar = xASL_imp_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_NII2BIDS.m
Format:
x = xASL_imp_NII2BIDS(x, 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_Run.m
Format:
x = xASL_imp_NII2BIDS_Run(x, bidsPar, studyPar, subjectSessionLabel, inSessionPath, outSessionPath, listRuns, iRun)
Description:
NII2BIDS conversion for a single sessions, single runs.
- Convert anat files
- Convert perf files
xASL_imp_NII2BIDS_RunAnat.m
Format:
xASL_imp_NII2BIDS_RunAnat(bidsPar, studyPar, subjectSessionLabel, outSessionPath, listRuns, iRun, nameSubjectSession)
Description:
NII2BIDS conversion for a single sessions, single run.
xASL_imp_NII2BIDS_RunPerf.m
Format:
xASL_imp_NII2BIDS_RunPerf(bidsPar, studyPar, subjectSessionLabel, inSessionPath, outSessionPath, listRuns, iRun)
Description:
NII2BIDS conversion for a single sessions, single run.
- Define the pathnames
- Load the JSONs and NIfTI information
- BIDSify ASL
- Prepare the link to M0 in ASL.json
- BIDSify M0
- Save all ASL files (JSON, NIFTI, CONTEXT) to the BIDS directory
xASL_imp_NII2BIDS_Session.m
Format:
x = xASL_imp_NII2BIDS_Session(x, imPar, bidsPar, studyPar, listSessions, nameSubjectSession, bidsLabel, iSession)
Description:
NII2BIDS conversion for a single sessions.
- Make a subject directory
- Iterate over runs
xASL_imp_NII2BIDS_Subject.m
Format:
x = xASL_imp_NII2BIDS_Subject(x, imPar, bidsPar, studyPar, nameSubject)
Description:
Run NII to ASL-BIDS for one individual subject.
- Initialize
- Process the anat & perfusion files
-
- Make a subject directory
-
- Iterate over sessions
-
- Iterate over runs
xASL_imp_NII2BIDS_Subject_DefineM0Type.m
Format:
[jsonLocal, bJsonLocalM0isFile] = xASL_imp_NII2BIDS_Subject_DefineM0Type(studyPar, bidsPar, jsonLocal, pathM0, linkM0prefix)
Description:
Define M0 Type
xASL_imp_UpdateDatasetRoot.m
Format:
[x] = xASL_imp_UpdateDatasetRoot(x, studyPath)
Description:
Update x.opts.DatasetRoot to dataset_description.json after NII2BIDS conversion