1. Segment clusters from binary mask:

    1. fsl-cluster --in=FLAIR_lesion_mask.nii.gz --thresh=1 --mm > fsl_clusters.txt
  2. Get the COG coordinates from the fsl_clusters.txt and make them into a space separated file that can be loaded into FSLeyes:

    1. awk 'BEGIN {FS="\\t"; OFS=" "} NR>1 {print $7 ,$8, $9, $1}' fsl_clusters.txt > output_clusters.txt
    2. alternatively: awk 'NR==1 || $2 > 60' sub-1.txt | awk 'BEGIN {FS="\\t"; OFS=" "} NR>1 {print $7 ,$8, $9, $1}’
  3. Launch FSLeyes with the desired image

  4. Load output_clusters.txt into location:

    Screenshot 2023-07-18 at 14.18.59.png

  5. Now you can iterate through every lesion by clicking on the lesion coordinates and assess the lesion by passing in it’s type:

Screenshot 2023-07-18 at 14.21.52.png

  1. After going through all the lesions, just save the file as lesions_assessed.txt and convert space separated .txt to .csv:
    1. tr ' ' ',' < lesions_assessed.txt > lesions_assessed.csv
  2. What you can also do is to create another csv file where all the unique values from the 5th column will be counted and this should give you the count of assessed lesions:
    1. cut -d',' -f5 lesions_assessed.csv | sort | uniq -c > unique_values.csv
  3. Important!
    1. Every time you click on the image in FSLeyes you create a new coordinate in the list, however the script is designed in such a way that only the coordinates with comment ‘lesion’ are the original one created from the binary lesion mask.
    2. When assessing the lesion double click on the comment and after a single space add the type of the lesion, that way the 5th column in the lesions_assessed.csv will always contain the values that you are interested in and unique_values.csv will not be corrupted.
    3. If you want to use this on QSM, first I would register FLAIR to first volume of magnitude images used to create QSM and use the obtained matrix to register FLAIR binary lesion mask to QSM and only then use the cluster function on it. It will prevent the misalignment of images and it might be handy to also load FLAIR into FSLeyes.