This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Brainvoyager batch script for functional MRI data (.fmr) preprocessing. | |
// | |
// For more information, check the scripting guide: | |
// http://support.brainvoyager.com/automation-aamp-development/46-writing-scripts/133-scripting-reference-guide.html | |
var bvqx = BrainVoyagerQX; | |
bvqx.PrintToLog("---"); | |
//---------------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Batch script for VTC creation. | |
// From native functional data space to an anatomical data to ACPC and to TAL | |
// | |
// For more information, check the scripting guide: | |
// http://support.brainvoyager.com/automation-aamp-development/46-writing-scripts/133-scripting-reference-guide.html | |
var bvqx = BrainVoyagerQX; | |
bvqx.PrintToLog("---"); | |
//---------------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Test GL volume tool with MRI data.""" | |
from pyqtgraph.Qt import QtCore, QtGui | |
import pyqtgraph.opengl as gl | |
import numpy as np | |
from nibabel import load | |
# get MRI data | |
nii = load('/path/to/your/file/T1w.nii.gz') | |
data = nii.get_data() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Dilation, erosion, opening, closing operations on binary nifti files.""" | |
import os | |
import numpy as np | |
from scipy.ndimage import morphology | |
from nibabel import load, save, Nifti1Image | |
# Load data | |
nii = load('/path/to/your/file.nii.gz') | |
basename = nii.get_filename().split(os.extsep, 1)[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Connected clusters cluster size thresholding commandline interface.""" | |
import os | |
import argparse | |
import numpy as np | |
from nibabel import load, save, Nifti1Image | |
from skimage.measure import label | |
parser = argparse.ArgumentParser() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Convert Brainvoyager VMP files to nii using neuroelf. | |
% Select VMR | |
[vmr_fileName, vmr_pathName] = uigetfile('.vmr'); | |
vmr = xff(fullfile(vmr_pathName, vmr_fileName)); | |
% Select VMP | |
[vmp_fileName, vmp_pathName] = uigetfile('.vmp'); | |
vmp = xff(fullfile(vmp_pathName, vmp_fileName)); | |
map_index = 1; % change this is you have multiple maps in one vmp file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Convert Brainvoyager VMR or V16 files to nii using Neuroelf (v1.1 rc2). | |
[fileName, pathName] = uigetfile('.v16'); | |
vmr = xff(fullfile(pathName, fileName)); | |
vmr.ExportNifti(fullfile(pathName, [fileName(1:end-4),'.nii']) ); | |
disp('Done.') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Delete unwanted volumes from timeseries data (Brainvoyager, FMR format). | |
clear all; | |
% Enter FMR file path and volume indices to be erased | |
fmr_path = '/path/to/your/file.fmr'; | |
vol_erase = [50:60, 100:103]; | |
% Load FMR (headers) and STC (data) | |
fmr = xff(fmr_path); | |
data = fmr.Slice.STCData(:, :, :, :); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Convert nifti to fmr and change the orientations. | |
% This scripts requires neuroelf. | |
% | |
% NOTES | |
% ----- | |
% If you are getting erro about `Dyn3DToFMR`: | |
% 1. Clone the recent neuroelf version from <https://github.com/neuroelf/neuroelf-matlab> (this is written on 2020/04/28). | |
% 2. Copy `hdr_Dyn3DToFMR.m` file from neuroelf/_todo/@xff/private/ directory and paste in into neuroelf/@xff/private/ directory. | |
% 3. Comment out the following line fmrc.FirstDataSourceFile = hdrs.F; because otherwise it produces an error. | |
% 4. Add this modified neuroelf's path to your MATLAB. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear all; | |
srf_path ='/path/to/mesh.srf'; | |
srf = xff(srf_path); | |
out = [srf_path(1:end-4), '_POIcut.srf']; | |
poi = xff('/path/ro/areas.poi'); | |
poi_idx = 1; | |
% (optional) cut smp |