Suggested Pipelines: Difference between revisions

From MEG Core
Jump to navigation Jump to search
Content added Content deleted
 
(70 intermediate revisions by 2 users not shown)
Line 1: Line 1:

== Master Pipeline ==

{{#mermaid:graph LR
{{#mermaid:graph LR
DoStuff --> DoMoreStuff;
DoStuff --> DoMoreStuff;
Line 5: Line 8:
}}
}}


== Basic Synthetic Aperture Magnetometry Workflow ==
== Basic MRI Pre-Processing Workflow ==

For any experiment where you wish to localize data to the brain, the first step is MRI pre-processing. First, MEG data must be co-registered to the space of the MRI, either by manually placing fiducial points on the MRI, or through a semi-automated method where a digital head shape is aligned with a head surface. (Other algorithmic techniques are possible, these will be discussed later). For the purpose of source space reconstruction, the head can be modeled either as a collection of spheres, one per channel, (MultiSphere) or in a realistic fashion using the Nolte model.


{{#mermaid:graph LR
{{#mermaid:graph LR

MRI["Structural MRI"] --> fids["Place Fiducials"];
MRI["Structural MRI"] --> shape["Register point clouds"];

subgraph MRI Preprocessing
subgraph MRI Preprocessing

MRI["Structural MRI"] --> hull(process with orthohull);
hull --> ortho["Processed MRI"];
fids --> hull["Process with orthohull"];
shape --> hull;

style hull fill:#fcf
click hull "https://megcore.nih.gov/index.php/Head_Localization_and_MRI_Coregistration" "orthohull documentation"
end

subgraph MultiSphere
hull --> localSpheres;
localSpheres --> MultiSphere["default.hdm"];
end

subgraph Nolte
hull --> Nolte["hull.shape"];
end
end
}}
}}


== Basic Resting State MEG processing ==
{{#mermaid:graph LR


Basic preprocessing of resting state MEG data includes filtering, and possibly artifact removal. Removing artifacts could consist of eliminating bad segments, or a more comprehensive process like ICA. When examining resting state data, the end goals is usually to examine either static measures of power, or connectivity. For connectivity, the output of SAM is a continuous time series, usually the Hilbert envelope of a band limited signal. Following calculation of this time series, other routines (such as ICA, seed based correlation, etc.) can be used to derive connectivity between regions.
marks --> Covariance;


{{#mermaid:graph LR
subgraph MEG Preprocessing
ThresholdDetect --> filter[Basic Filtering];
MEG["MEG Data"] --> Filtering;
subgraph PreProcessing
filter --> marks[Create Markers];
Filtering --> Art["Artifact Removal"];
filter --> meg;
end
end


subgraph MEG Data Statistics
subgraph SAM PreProcessing
Art --> sam_cov
meg[MEG Data] --> Filter[Band-pass<br>filter];
Filter --> Covariance;
sam_cov --> sam_wts
style sam_cov fill:#fcf
style sam_wts fill:#fcf
click sam_cov "https://megcore.nih.gov/index.php/Sam_cov" "sam_cov documentation"
click sam_wts "https://megcore.nih.gov/index.php/Sam_wts" "sam_wts documentation"
end
end


subgraph Power
sam_wts --> sam["sam_3d/sam_3dc"];

style sam fill:#fcf
click sam "https://megcore.nih.gov/index.php/Sam_3d_and_sam_3dc" "sam_3d/sam_3dc documentation"
end
subgraph Connectivity
sam_wts --> sam_power;
style sam_power fill:#fcf
click sam_power "https://megcore.nih.gov/index.php/Sam_power" "sam_power documentation"
end
}}
}}

==Basic Task Based MEG Pipeline==

In a task based analysis, you start with raw MEG data, as wells as data from the ADC channels - triggers, stimuli, and responses. Both of these must be pre-processed. Once your MEG data is marked appropriately, you can begin a SAM analysis. If you are interested in time-locked (evoked or event-related) signals, you can use either [[sam_4d_and_sam_4dc|sam_4d or sam_4dc]] or [[sam_ers_and_sam_ersc|sam_ers or sam_ersc]], depending on exactly what you want as output. Alternatively, if you do not expect your signals to be time-locked, you can examine changes in induced power using [[sam_3d_and_sam_3dc|sam_3d or sam_3dc]].


{{#mermaid:graph LR
{{#mermaid:graph LR
MEG["MEG Data"] --> Filtering;
subgraph Synthetic Aperture Magnetometry

Markers --> Beamformer;
subgraph MEG PreProcessing
Covariance --> Beamformer;
Filtering --> Art["Artifact Removal"];
ortho[Processed MRI] --> Beamformer;
end
Beamformer --> image["3D Images"];

ADC["ADC/Trigger Channels"] --> thresholdDetect;

subgraph ADC PreProcessing
thresholdDetect --> add_markers;
end

subgraph SAM PreProcessing
add_markers--> sam_cov;
Art --> sam_cov;
sam_cov --> sam_wts;
style sam_cov fill:#fcf
style sam_wts fill:#fcf
click sam_cov "https://megcore.nih.gov/index.php/Sam_cov" "sam_cov documentation"
click sam_wts "https://megcore.nih.gov/index.php/Sam_wts" "sam_wts documentation"
end

subgraph Induced Power
sam_wts --> sam_3d["sam_3d/sam_3dc"];
style sam_3d fill:#fcf
click sam_3d "https://megcore.nih.gov/index.php/sam_3d_and_sam_3dc" "sam_3d/sam_3dc documentation"
end

subgraph Evoked/Event Related
sam_wts --> sam_ers["sam_ers/sam_ersc"];
sam_wts --> sam_4d["sam_4d/sam_4dc"];
style sam_ers fill:#fcf
click sam_ers "https://megcore.nih.gov/index.php/sam_ers_and_sam_ersc" "sam_ers/sam_ersc documentation"
style sam_4d fill:#fcf
click sam_4d "https://megcore.nih.gov/index.php/sam_4d_and_sam_4dc" "sam_4d/sam_4dc documentation"
end
end
}}
}}
== Localizing Epileptiform Activity ==

This describes localizing epileptiform activity from continuous datasets using excess kurtosis. First, a SAM analysis is performed with a relatively narrow bandwidth, 20-70Hz. The program sam_epi is used to produce images of kurtosis, and NIFTIpeak is used to find extrema in the images that may indicate voxels which contain spikes. Once targets are identified, the SAM analysis is essentially run again, this time with a wide bandwidth, on only those specific targets. DataEditor can read the weights for those targets and compute "virtual sensors" at those voxel locations. The epileptologist can then examine the time series and mark epileptic spikes.


{{#mermaid:graph LR
{{#mermaid:graph LR

subgraph SAM
MEG

MEG["MEG Data"] --> sam_cov;

subgraph Phase I: Filter 20-70Hz
sam_cov --> sam_wts;
sam_cov --> sam_wts;
sam_wts --> sam_3d;
sam_wts --> sam_epi;
style sam_cov fill:#fcf
sam_3d --> AFNI;
click sam_cov "https://megcore.nih.gov/index.php/Sam_cov" "sam_cov documentation"
AFNI --> sam_wts;
style sam_wts fill:#fcf
AFNI --> sam_cov;
click sam_wts "https://megcore.nih.gov/index.php/Sam_wts" "sam_wts documentation"
end
end

sam_epi --> NIFTIPeak["NIFTIPeak <br>Target <br>Identification"]
NIFTIPeak --> sam_cov2["sam_cov"]
style sam_epi fill:#fcf
click sam_epi "https://megcore.nih.gov/index.php/sam_epi" "sam_epi documentation"
style NIFTIPeak fill:#fcf
click NIFTIPeak "https://megcore.nih.gov/index.php/NIFTIPeak" "NIFTIPeak.py documentation"

subgraph Phase II: Filter 1-150Hz
sam_cov2 --> sam_wts2["sam_wts"]
style sam_cov2 fill:#fcf
click sam_cov2 "https://megcore.nih.gov/index.php/Sam_cov" "sam_cov documentation"
style sam_wts2 fill:#fcf
click sam_wts2 "https://megcore.nih.gov/index.php/Sam_wts" "sam_wts documentation"
end
sam_wts2 --> DataEditor["DataEditor <br> Spike Identification"]

}}
}}


== Advanced Coregistration SAM Pipeline ==
# Create covariance matrices using sam_cov.

# Compute beamformer weights with sam_wts.
There is a limit to the accuracy with which MEG and MRI data can be coregistered using fiducial markers alone. One significant confounding issue is that the brain will be in a slightly different position inside the head in a seated position vs. a supine position. This pipeline describes using sam_coreg to refine the approximate fiducial placements. Once sam_coreg has been performed, the user can either do a traditional analysis using the SAM tools discussed previously, or make use of the programs that leverage the cortical data (patch_wts and roi_wts).
# sam_3d uses the weights to compute volumetric images of activity estimates.

# View them with AFNI.
{{#mermaid:graph LR
# It didn't work, go back and try again.

# Nope, still didn't work, try this instead.
MRI["Structural MRI"] --> fids["Place Approximate <br> Fiducials"];

subgraph MRIproc
fids --> FreeSurfer
FreeSurfer --> FSNormals.py
style FSNormals.py fill:#fcf
click FSNormals.py "https://megcore.nih.gov/index.php/FSNormals.py" "FSNormals.py documentation"
end

FSNormals.py --> sam_coreg
MEG-->sam_cov
style sam_cov fill:#fcf
click sam_cov "https://megcore.nih.gov/index.php/Sam_cov" "sam_cov documentation"

subgraph MEGproc
sam_cov-->sam_coreg
sam_coreg--> patch_wts
sam_coreg--> roi_wts
sam_coreg--> sam_wts
style sam_coreg fill:#fcf
click sam_coreg "https://megcore.nih.gov/index.php/sam_coreg" "sam_coreg documentation"
style patch_wts fill:#fcf
click patch_wts "https://megcore.nih.gov/index.php/patch_wts" "patch_wts documentation"
style roi_wts fill:#fcf
click roi_wts "https://megcore.nih.gov/index.php/roi_wts" "roi_wts documentation"
style sam_wts fill:#fcf
click sam_wts "https://megcore.nih.gov/index.php/sam_wts" "sam_wts documentation"
end

subgraph SAM
sam_wts-->sam_3d["sam_3d or sam_3dc"]
sam_wts-->sam_4d["sam_4d or sam_4dc"]
sam_wts-->sam_ers["sam_ers or sam_ersc"]
sam_wts-->sam_power["sam_power"]
style sam_3d fill:#fcf
click sam_3d "https://megcore.nih.gov/index.php/sam_3d_and_sam_3dc" "sam_3d documentation"
style sam_4d fill:#fcf
click sam_4d "https://megcore.nih.gov/index.php/sam_4d_and_sam_4dc" "sam_4d documentation"
style sam_ers fill:#fcf
click sam_ers "https://megcore.nih.gov/index.php/roi_wts" "sam_ers documentation"
style sam_power fill:#fcf
click sam_power "https://megcore.nih.gov/index.php/sam_power" "sam_power documentation"
end
}}

Latest revision as of 14:29, 20 March 2019

Master Pipeline

Basic MRI Pre-Processing Workflow

For any experiment where you wish to localize data to the brain, the first step is MRI pre-processing. First, MEG data must be co-registered to the space of the MRI, either by manually placing fiducial points on the MRI, or through a semi-automated method where a digital head shape is aligned with a head surface. (Other algorithmic techniques are possible, these will be discussed later). For the purpose of source space reconstruction, the head can be modeled either as a collection of spheres, one per channel, (MultiSphere) or in a realistic fashion using the Nolte model.

Basic Resting State MEG processing

Basic preprocessing of resting state MEG data includes filtering, and possibly artifact removal. Removing artifacts could consist of eliminating bad segments, or a more comprehensive process like ICA. When examining resting state data, the end goals is usually to examine either static measures of power, or connectivity. For connectivity, the output of SAM is a continuous time series, usually the Hilbert envelope of a band limited signal. Following calculation of this time series, other routines (such as ICA, seed based correlation, etc.) can be used to derive connectivity between regions.

Basic Task Based MEG Pipeline

In a task based analysis, you start with raw MEG data, as wells as data from the ADC channels - triggers, stimuli, and responses. Both of these must be pre-processed. Once your MEG data is marked appropriately, you can begin a SAM analysis. If you are interested in time-locked (evoked or event-related) signals, you can use either sam_4d or sam_4dc or sam_ers or sam_ersc, depending on exactly what you want as output. Alternatively, if you do not expect your signals to be time-locked, you can examine changes in induced power using sam_3d or sam_3dc.

Localizing Epileptiform Activity

This describes localizing epileptiform activity from continuous datasets using excess kurtosis. First, a SAM analysis is performed with a relatively narrow bandwidth, 20-70Hz. The program sam_epi is used to produce images of kurtosis, and NIFTIpeak is used to find extrema in the images that may indicate voxels which contain spikes. Once targets are identified, the SAM analysis is essentially run again, this time with a wide bandwidth, on only those specific targets. DataEditor can read the weights for those targets and compute "virtual sensors" at those voxel locations. The epileptologist can then examine the time series and mark epileptic spikes.

Advanced Coregistration SAM Pipeline

There is a limit to the accuracy with which MEG and MRI data can be coregistered using fiducial markers alone. One significant confounding issue is that the brain will be in a slightly different position inside the head in a seated position vs. a supine position. This pipeline describes using sam_coreg to refine the approximate fiducial placements. Once sam_coreg has been performed, the user can either do a traditional analysis using the SAM tools discussed previously, or make use of the programs that leverage the cortical data (patch_wts and roi_wts).