Index

BrainPET Reconstruction Algorithms


/!\ This page is only to process PET-MR data acquired using BrainPET (Bay 6) scanner at the Athinoula A. Martinos Center for Biomedical Imaging.

For questions/feedback, please contact Meena M. Makary (mmakary@mgh.harvard.edu) and Dr. Catana (ccatana@mgh.harvard.edu) OR preferably use this Teams Channel Positron


Aether-Mirror Version

This version mirrors the attenuation map generation and reconstruction algorithms that were used on Aether. We recommend to use this version only for continuation studies. Scripts are located inside: /autofs/cluster/petcore/PET_computer_backup/brainPET_code/Aether-Mirror. You will have to cd to this folder before running any of the functions below.

PseudoCT mu-map generation

This function generates pseudoCT mu-map using SPM8 atlas-based method (David Izquierdo-Garcia et al.)

(!) For full instructions type: perl brainPET_pCT_AeMir.pl -h

DESCRIPTION
                This function generates pseudoCT mu-map using SPM8 atlas-based
                method (David Izquierdo-Garcia et al.) It gives identical 
                output as Aether output and should only be used for continuation studies.
                For new studies, you should use functions located inside ../brainPET_code/
  
                This functions works with both dcm or nifti file as input.

OPTIONS
                -i, --mprage_dir        Full directory where the .dcm or .nii file exist
                                        /autofs/cluster/<space>/..../<SUBJID>/MR/MPRAGE \n
                -f, --file_name         The name of the nii file or the first dcm file
                                        (add the file name with its extension).\n
                -c, --coil_choice       Numerical coil ID as follows:
                                          0 : CP Coil + 8 Ch-Coil (bay 6 optm)
                                          1 : Small Monkey Coil + CP (bay6)
                                          2 : Large Monkey Coil + CP (bay6)
                                          3 : CP Coil + 8 Ch-Coil (bay8)
                                          4 : CP Coil Only (bay8)
                                          5 : CP Coil + 8 Ch-Coil (bay 8 optm)
                                          6 : CP Coil + 32 Ch-Coil (bay6)
                                          7 : No Hardware\n
                ** All input arguments are mandatory. 

                Ex1: perl brainPET_pCT_AeMir.pl -i /<DIR>/<SUJID>/MR/MPRAGE -f 107000-000005-000001.dcm -c 0
                Ex2: perl brainPET_pCT_AeMir.pl -i /<DIR>/<SUJID>/MR_PET -f cp_iso_mprage.nii -c 0
                
                Imp1: The r-l flip is applied only to .dcm input but not to .nii input (see Imp2)
                Imp2: If you input a nifti file, it should be named as cp_iso_mprage.nii
                and it should be r-l flipped (i.e., it is the output of a previously ran
                pesudo CT).

                Meena M. Makary, Ph.D (mmakary\@mgh.harvard.edu) 
                Athinoula A. Martinos Center for Biomedical Imaging
                Mass. General Hospital, Harvard Medical School
                Last Updated: Jan 28, 2021
                Version: 2.0\n"

perl brainPET_pCT_AeMir.pl -i /<DIR>/<SUJID>/MR/MPRAGE -f 107000-000005-000001.dcm -c 0

where 107000-000005-000001.dcm is the file name of the first dcm file.

perl brainPET_pCT_AeMir.pl -i /<DIR>/<SUJID>/MR_PET -f cp_iso_mprage.nii -c 0

Single Frame Dual Pass

This function generates single-frame PET image files from list-mode data. It assumes a particular folder structure for it to work: Parent Folder: MR, MR_PET (> mu_maps > mu_map), PET > (list mode data). From the list mode data, TAC will generate images with a user defined duration for a number of selectable isotopes. It first reconstructs PET frames using the native position of mu-map (1st pass) and later registers the mu-map to the position of late PET window (e.g. 60-90 for PBR28) before the 2nd pass of reconstruction. The resulting images can be viewed as either SUV, bqml, or nas images. Mu maps must be present.

(!) For full instructions type: perl brainPET_recon_2passSF_AeMir.pl -h

perl brainPET_recon_2passSF_AeMir.pl -i /<path>/<SUBJ_ID> -s 3600 -d 1800 -e 5 -p 0 -r 0

This will reconstruct dual-pass single (60-90) mins frame for [11C] list mode data.

Dynamic Frame Reconstruction (TAC)

This function generates single frame PET image files from list mode data. It assumes a particular folder structure for it to work: Parent Folder: MR, MR_PET (> mu_maps > mu_map), PET > (list mode data). From the list mode data, TAC will generate images with a user defined duration for a number of selectable isotopes. The resulting images can be viewed as either SUV, bqml, or nas images. Mu maps must be present.

(!) For full instructions type: perl brainPET_recon_DF_AeMir.pl -h

perl brainPET_recon_DF_AeMir.pl -i /<full_path>/<subj_id>/PET -f Frame1.lst -d dynamic_frame_list.txt -e 5 -s '[1 0 1]' -t 0.8

This will reconstruct dynamic frame PET image according to frames length indicated in dynamic_frame_list.txt (which should be located inside PET folder) for [11C] list mode data (Frame1.lst). It will output both SUV and SUV_BQML.

Supporting Functions

Download and Organize MR and PET Data

This function to creates subject directory and its PET/MR/MR_PET sub-directories, download its MR and/or PET data, and unpack & organize MR data. You can download old and recently acquired data (see the note below for old data download). It also allows you to QC TOI/ScanID/ScanDate/PI through terminal output.

(!) For full instructions type: perl brainPET_mrpet_dwnld_unpack.pl -h

perl brainPET_mrpet_dwnld_unpack.pl -d /<DIR> -s <SubjID> -id <ScanID> -mr 1 -pet 1

To download an old subject (acquired more than 4 years ago), please do the following:

  1. ssh to pinto.nmr.mgh.harvard.edu

  2. cd to where the code is located
  3. type: bash (and hit enter)
  4. re-run the script

The script automatically detects if the subject is old or recently acquired and an error message will pop up with instructions in case of an old subject.

Denoise MPRAGE

This function performs thresholding-based denoising for the MPRAGE image to clean it for better pseudo-CT results. Use it only if the mprage is noisy. It works only with nifti (.nii) file as input. It takes a denoising threshold (intensity) to remove noise in the image, and a Gauss smoothing factor (mm) to facilitate denoising.

(!) For full instructions type: perl brainPET_denoise_mprage.pl -h

perl brainPET_denoise_mprage.pl -i /<DIR>/<SUBJID>/MR_PET/cp_iso_mprage.nii -t 25 -s 0

Outputs: cp_iso_mprage_denoised_thres<>_smooth<>mm.nii and scp_iso_mprage.nii (this is the smoothed version of the input image, it should be identical to the input if the smoothing was set to 0). The output is saved in the same folder as the input.

ifile2nifti

This function converts brainPET ifile to nifit format.

(!) For full instructions type: perl brainPET_ifile2nifti.pl -h

perl brainPET_ifile2nifti.pl -i /<DIR>/file.i

Development Version

UNDER CONSTRUCTION !!