Repository navigation
Preprocessing Rat Structural in vivo
This preprocessing is for the 3D FLASH T2w sequence with 2 repetitions 160 m^3 obtained with Paravision 6. However, any number of repetitions would work as the script does not care.
This preprocessing will prepare the data for the MBM pydpiper aka Deformation Brain Morphometry pipeline.
- Bruker to NIFTI BIDS format.
- Averaging repetitions to improve SNR.
- Run N4 Bias Field Correction
https://github.com/GarzaLab/scripts/tree/master/rodent_dbm
We use the app brkraw from this URL.
You need to download all raw folders from the experiment to one single folder or ZIP file. Make a folder for your bids output.
I advice you check each raw folder, to be sure you have all the data. To do this, use the brkraw gui. It is important to use the flag --ignore-rescale for all our data.
Example:
brkraw gui --ignore-rescale -i raw/20191018_141708_B03GarzaAlcohol_I2BA_003_1_1 -o Model20p_bids
After checking your data, run the bids_helper, edit the XLSX and JSON files then run bids_converter.
Example:
brkraw bids_helper -j raw Model20p_bids
You will get 2 files on the $PWD folder, Model20p_bids.xlsx and Model20p_bids.json. Edit the XLSX to fit your data. The columns you need to edit are: SubjID, SessID, task (if you have fMRI), modality. For SubjID you will always get the prefix sub-, keep that in mind. SessID can be anything numbers or letters. task and modality must adhere to BIDS Data Structure. You can modify other columns, just leave RawData untouched.
Once the XLSX file is modified, if you have fMRI you will have to go to the JSON and modify the task from there.
After this, now you can run the bids_convert to convert all files to NIFTI in neat BIDS format.
Example:
brkraw bids_convert -j Model20p_bids.json -o Model20p_bids --ignore-rescale raw Model20p_bids.xlsx
Here is the output tree. Your data needs to be similar to this otherwise it won't run:
Model20p_bids/data
data
├── sub-10
│ ├── ses-1
│ │ ├── anat
│ │ │ ├── sub-10_ses-1_T1w.json
│ │ │ ├── sub-10_ses-1_T1w.nii.gz
│ │ │ ├── sub-10_ses-1_T2w.json
│ │ │ └── sub-10_ses-1_T2w.nii.gz
│ │ ├── fmap
│ │ │ ├── sub-10_ses-1_fieldmap.json
│ │ │ ├── sub-10_ses-1_fieldmap.nii.gz
│ │ │ └── sub-10_ses-1_magnitude.nii.gz
│ │ └── func
│ │ ├── sub-10_ses-1_task-rest_run-1_bold.json
│ │ └── sub-10_ses-1_task-rest_run-1_bold.nii.gz
│ └── ses-2
│ ├── anat
│ │ ├── sub-10_ses-2_T1w.json
│ │ ├── sub-10_ses-2_T1w.nii.gz
│ │ ├── sub-10_ses-2_T2w.json
│ │ └── sub-10_ses-2_T2w.nii.gz
│ ├── fmap
│ │ ├── sub-10_ses-2_fieldmap.json
│ │ ├── sub-10_ses-2_fieldmap.nii.gz
│ │ └── sub-10_ses-2_magnitude.nii.gz
│ └── func
│ ├── sub-10_ses-2_task-rest_run-1_bold.json
│ └── sub-10_ses-2_task-rest_run-1_bold.nii.gz
Use this guide:
https://github.com/GarzaLab/Documentation/wiki/Average-T1w-or-T2w-repetitions-Bruker-7T
bash rat-invivo-average.sh subject session modality
Remember you need to pad the Fischer atlas if you are using that one:
ImageMath 3 Fischer344_template_pad.mnc PadImage Fischer344_template.mnc 20
The run the preprocessing script in your average.mnc file for each subject.
The Average script should've created the folder derivatives/${subject}/${session}/preproc. I suggest you run the following script with the output pointing to the same folder.
bash rat-preprocessing-v6.sh input.mnc output.mnc
For example:
bash rat-preprocessing-v6.sh /media/egarza/Elements2/projects/INB/GARZALAB/Pilotos/Prueba_DBM/derivatives/sub-5/ses-1/preproc/average.mnc /media/egarza/Elements2/projects/INB/GARZALAB/Pilotos/Prueba_DBM/derivatives/sub-5/ses-1/preproc/sub-5_ses-1_pp.mnc
Your files should be ready, with a mask.
This files can now go to the Two Level DBM.
Average 3 subjects with 2 sessions each.
for i in data/sub-*; do rat-invivo-average.sh $(basename $i) ses-1 T1w; bash rat-invivo-average.sh $(basename $i) ses-2 T1w; done
Preprocess 3 subjects with 2 sessions each.
for i in data/sub-*; do bash rat-preprocessing-v6.sh derivatives/$(basename $i)/ses-1/preproc/average.mnc derivatives/$(basename $i)/ses-1/preproc/$(basename $i)_ses-1_pp.mnc; bash rat-preprocessing-v6.sh derivatives/$(basename $i)/ses-2/preproc/average.mnc derivatives/$(basename $i)/ses-2/preproc/$(basename $i)_ses-2_pp.mnc; done
Check your images one by one for errors.
- Home
- SUDMEX_CONN
- Bruker
- MINC
- AFNI
- fMRIprep
- DeepLabCut
- CONN
- Lab Methods
- Blood Alcohol Concentration (BAC)
- Conditioned Place Preference (CPP)
- Elevated Plus Maze (EPM)
- Outline IA2BC
- Intermittent Access Two Bottle Choice (IA2BC)
- Fixed Brains for MRI
- Novel Object Recognition (NOR)
- Aproximaciones sucesivas con morfina
- Surgical implantation of Chronic Neural Carbon Fiber Electrodes
- DBM
- Axolotl
- FSL
- MRIQC
- Preprocessing rats
- Preprocessing extras
- BIDS
- Niagara
- TIPS