Good coding practice
Make sure to manage spaces, only a space after a comma ‘,’ . avoid unnecessary/unused temporary variables . Use parameter/variable names that are often used, rather than creating your own. When providing an option, make this a clear Boolean (e.g. by prefixing the variable by "b" and using "true" or "false" rather than "0" or "1", and manage the default option. Use full readable words for variables, e.g. "Kurtosis" is better than "Kurtss". After a %% or % you need to have a single space and start with capital. The space is required by Matlab to correctly recognise the comment. If you want this to be seen in the code manual, you need either.
%% THIS IS INTERPRETED AS HEADER or %%, % THIS IS INTERPRETED AS COMMENT
I realize we should be posting here much more frequent. It is the busy life of a researcher... While our ExploreASL manuscript is in revision, and we are working on the ASL-BIDS definition, I got a request for the ability to easily manipulate NIfTIs as e.g. fslmerge allows. This is often needed to fix the data structure differences between vendors. The following is a simple but effective tool:
1) initialise ExploreASL (run ExploreASL_Master without the data processing)
2) load a NIfTI as image series:
Im = xASL_io_Nifti2Im(‘PathToNIfTI’);
NewIm = Im(:,:,:,[1 31 2 32 etc]); % here the fourth dim is the resorting of the image volume series
Where OldPath and NewPath can be the same, and the same as the original image you loaded.
For the meaning of the specific arguments you can look up the function header, e.g. help xASL_io_SaveNifti.
These scripts are based on SPM scripts, and have extra functionality to work between OSes, transparantly use .nii and .nii.gz, etc.
Compiled ExploreASL for Windows, please test it by downloading it, unzipping it and running RunExploreASL.bat. Make sure you test it in Windows 10, and your dataset needs to have the ExploreASL structure (soon to be replaced by BIDS structure). You can test it with THIS TestDataSet, by running its .JSON file. Make sure to first install the Matlab Runtime, which you can download HERE. Choose the version fitting with Matlab version mentioned in the foldername (currently R2018a, or 9.4). When the program is done, try making sense of each processing step by going through the ExploreASL WalkThrough.
The ExploreASL software is moved from a private to a public GitHub, and tagged as version 0.9.9, also downloadable at this website as zip-file. We are pending review of ExploreASL at Neuroimage, after which we will tag version 1.0.0.
Luigi Lorenzini is working on "ExploreQC", we will test several QC parameters in different scantypes. While reading his code, I had the following (generic) comments that are useful for all (Matlab) students learning how to code:
GetFileList & GetFsList are ideal scripts for using regular expressions to acquire a custom selection of files. However, this creates some processing overhead, which I now replaced with exist(), which goes much faster, especially in loops over subjects.
CAT12 or SPM12 segmentation. While CAT12 segmentation outperforms SPM12 significantly, especially in subjects with non-standard brains, sometimes CAT12 doesn't work with the data at hand. In this case, xASL will automatically proceed with SPM12. Also, SPM12 can be forced by setting: symbols.Segment_SPM12 to true, this will disable CAT12 segmentation & use SPM12 instead
Try ConvertDicomFolderStructure.m if you have DICOM folders or files in which the FileNames or DirectoryNames don't tell what images they contain. This script goes through all DICOMs in subdirectories, looks in their series or acquisition description and resorts all DICOM files in new directories that contain the sequence names.
symbols.SavePWI4D allows now to quantify 4D timeseries (keep each subtraction for time-series analyses, in addition to saving a averaged/paired subtraction CBF image