Skip to content

Commit b55f163

Browse files
committed
merge master
1 parent 9e1d8ce commit b55f163

File tree

33 files changed

+460
-1101
lines changed

33 files changed

+460
-1101
lines changed

code/plugins/reformat_plugin.py

+13-49
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,7 @@
33
import shutil
44

55
# open a text file ending with .md and append a paragraph to it
6-
def reformat_plugin(dirpath, plugin_name):
7-
plugins_dir = '../../plugins'
8-
index_file = os.path.join(plugins_dir, 'index.md')
9-
shutil.copyfile(os.path.join(dirpath, 'README.md'), index_file)
10-
with open(index_file) as f:
11-
text = f.read()
12-
append_text = '''---
13-
layout: default
14-
title: {plugin_name}
15-
long_title: {plugin_name}
16-
parent: Plugins
17-
---
18-
'''.format(plugin_name=plugin_name)
19-
text = append_text + text
20-
with open(index_file, 'w') as out:
21-
out.write(text)
22-
23-
# open a text file ending with .md and append a paragraph to it
24-
# Usage: python test.py <filename>.md
25-
def append_to_file(filepath, filename, parent, output_file):
6+
def reformat_wiki_pages(filepath, filename, parent, output_file):
267
with open(filepath) as f:
278
text = f.read()
289
append_text = '''---
@@ -42,53 +23,36 @@ def reformat_plugin_dir(plugin_input_dir, plugin_name, order, plugin_type='wiki'
4223
plugin_output_dir = os.path.join('../../plugins', plugin_name)
4324
if not os.path.exists(plugin_output_dir):
4425
os.makedirs(plugin_output_dir)
26+
4527
# copy image directory from input to output dir
4628
if os.path.exists(os.path.join(plugin_input_dir, 'images')):
4729
shutil.copytree(os.path.join(plugin_input_dir, 'images'), os.path.join(plugin_output_dir, 'images'), dirs_exist_ok=True)
4830

4931
index_file = os.path.join(plugin_output_dir, 'index.md')
50-
if plugin_type == 'wiki':
51-
shutil.copyfile(os.path.join(plugin_input_dir, 'Home.md'), index_file)
52-
with open(index_file) as f:
53-
text = f.read()
54-
append_text = '''---
32+
shutil.copyfile(os.path.join(plugin_input_dir, 'README.md'), index_file)
33+
with open(index_file) as f:
34+
text = f.read()
35+
append_text = '''---
5536
layout: default
5637
title: {plugin_name}
5738
long_title: {plugin_name}
5839
parent: Plugins
59-
categories: plugins
6040
has_children: true
6141
nav_order: {order}
6242
---
6343
To view the plugin source code, please visit the plugin's [GitHub repository](https://github.com/sccn/{plugin_name}).
6444
6545
'''.format(plugin_name=plugin_name, order=order)
66-
text = append_text + text
67-
with open(index_file, 'w') as out:
68-
out.write(text)
46+
text = append_text + text
47+
with open(index_file, 'w') as out:
48+
out.write(text)
6949

70-
for root, dirs, files in os.walk(plugin_input_dir):
50+
if plugin_type == 'wiki':
51+
wiki_plugin_input_dir = plugin_input_dir + '.wiki'
52+
for root, dirs, files in os.walk(wiki_plugin_input_dir):
7153
for file in files:
7254
if file.endswith('.md') and not file.startswith('index') and not file.startswith('Home'):
73-
append_to_file(os.path.join(plugin_input_dir, file), file.strip('.md'), plugin_name, os.path.join(plugin_output_dir, file))
74-
else:
75-
shutil.copyfile(os.path.join(plugin_input_dir, 'README.md'), index_file)
76-
with open(index_file) as f:
77-
text = f.read()
78-
append_text = '''---
79-
layout: default
80-
title: {plugin_name}
81-
long_title: {plugin_name}
82-
parent: Plugins
83-
nav_order: {order}
84-
---
85-
To view the plugin source code, please visit the plugin's [GitHub repository](https://github.com/sccn/{plugin_name}).
86-
87-
'''.format(plugin_name=plugin_name, order=order)
88-
text = append_text + text
89-
with open(index_file, 'w') as out:
90-
out.write(text)
91-
55+
reformat_wiki_pages(os.path.join(wiki_plugin_input_dir, file), file.strip('.md'), plugin_name, os.path.join(plugin_output_dir, file))
9256
# main
9357
def main():
9458
if len(sys.argv) != 5:

code/plugins/update_plugins.py

+21-10
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,15 @@ def update_repo(repo, order, plugin_type='readme'):
1717
os.chdir(repo_path)
1818
run_command('git pull')
1919
else:
20-
if plugin_type == "wiki":
21-
run_command(f'git clone https://github.com/sccn/{repo}.wiki.git {repo_path}')
20+
run_command(f'git clone https://github.com/sccn/{repo}.git {repo_path}')
21+
22+
if plugin_type == "wiki":
23+
wiki_repo_path = f"{repo_path}.wiki"
24+
if os.path.exists(wiki_repo_path):
25+
os.chdir(wiki_repo_path)
26+
run_command('git pull')
2227
else:
23-
run_command(f'git clone https://github.com/sccn/{repo}.git {repo_path}')
28+
run_command(f'git clone https://github.com/sccn/{repo}.wiki.git {wiki_repo_path}')
2429

2530
os.chdir(current_dir)
2631
script = 'reformat_plugin.py'
@@ -31,20 +36,26 @@ def update_repo(repo, order, plugin_type='readme'):
3136
# if 'github' not in current directory, create it
3237
if not os.path.exists('github'):
3338
os.makedirs('github')
34-
if len(sys.argv) == 0:
39+
wiki_plugins = ['SIFT', 'get_chanlocs', 'NFT', 'PACT', 'nsgportal', 'clean_rawdata']
40+
readme_plugins = ['ARfitStudio', 'roiconnect', 'EEG-BIDS', 'trimOutlier', 'groupSIFT', 'nwbio', 'ICLabel', 'dipfit', 'eegstats', 'PowPowCAT', 'PACTools', 'zapline-plus', 'amica', 'fMRIb', 'relica', 'std_dipoleDensity', 'imat', 'viewprops', 'cleanline','NIMA', 'firfilt']
41+
if len(sys.argv) == 1:
3542
order = 1
36-
wiki_plugins = ['SIFT', 'get_chanlocs', 'NFT', 'PACT', 'nsgportal', 'clean_rawdata']
3743
for plugin in wiki_plugins:
3844
update_repo(plugin, order, 'wiki')
3945
order += 1
40-
readme_plugins = ['ARfitStudio', 'roiconnect', 'EEG-BIDS', 'trimOutlier', 'groupSIFT', 'nwbio', 'ICLabel', 'dipfit', 'eegstats', 'PowPowCAT', 'PACTools', 'zapline-plus', 'amica', 'fMRIb', 'relica', 'std_dipoleDensity', 'imat', 'viewprops', 'cleanline','NIMA', 'firfilt']
4146
for plugin in readme_plugins:
4247
update_repo(plugin, order, "readme")
4348
order += 1
44-
elif len(sys.argv) == 3:
49+
elif len(sys.argv) == 2:
4550
plugin_name = sys.argv[1]
46-
plugin_type = sys.argv[2]
47-
update_repo(plugin_name, 1, plugin_type)
51+
if plugin_name not in wiki_plugins and plugin_name not in readme_plugins:
52+
print(f"Plugin {plugin_name} not found.")
53+
sys.exit(1)
54+
55+
plugin_type = 'wiki' if plugin_name in wiki_plugins else 'readme'
56+
plugin_order = wiki_plugins.index(plugin_name) + 1 if plugin_type == 'wiki' else len(wiki_plugins) + readme_plugins.index(plugin_name) + 1
57+
58+
update_repo(plugin_name, plugin_order, plugin_type)
4859
else:
49-
print('Usage: python update_plugins.py <plugin_name> <plugin_type>')
60+
print('Usage: python update_plugins.py <plugin_name>')
5061
sys.exit(1)

code/plugins/update_plugins.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
DIRECTORY="/path/to/directory"
4+
5+
if [ -d "$DIRECTORY" ]; then
6+
# Directory exists, pull changes
7+
cd "$DIRECTORY"
8+
git pull
9+
else
10+
# Directory doesn't exist, clone from GitHub
11+
git clone https://github.com/username/repository.git "$DIRECTORY"
12+
fi

plugins/ARfitStudio/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ layout: default
33
title: ARfitStudio
44
long_title: ARfitStudio
55
parent: Plugins
6+
has_children: true
67
nav_order: 7
78
---
89
To view the plugin source code, please visit the plugin's [GitHub repository](https://github.com/sccn/ARfitStudio).

plugins/EEG-BIDS/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ layout: default
33
title: EEG-BIDS
44
long_title: EEG-BIDS
55
parent: Plugins
6+
has_children: true
67
nav_order: 9
78
---
89
To view the plugin source code, please visit the plugin's [GitHub repository](https://github.com/sccn/EEG-BIDS).

plugins/ICLabel/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ layout: default
33
title: ICLabel
44
long_title: ICLabel
55
parent: Plugins
6+
has_children: true
67
nav_order: 13
78
---
89
To view the plugin source code, please visit the plugin's [GitHub repository](https://github.com/sccn/ICLabel).

plugins/NFT/index.md

+16-104
Original file line numberDiff line numberDiff line change
@@ -3,119 +3,31 @@ layout: default
33
title: NFT
44
long_title: NFT
55
parent: Plugins
6-
categories: plugins
76
has_children: true
87
nav_order: 3
98
---
109
To view the plugin source code, please visit the plugin's [GitHub repository](https://github.com/sccn/NFT).
1110

12-
### Open Source Matlab Toolbox for Neuroelectromagnetic Forward Head Modeling
11+
Pre-compiled binaries for the following 3rd party programs are distributed
12+
within the NFT toolbox for convinience of the users. The binaries are compiled
13+
for 32 and 64 bit Linux distributions.
1314

14-
![right](NFTsmall.jpg "wikilink")
15+
All of these programs have opensource licenses and provide full source-code.
16+
Please visit home-pages of individual programs for more information on usage,
17+
source-code and license information.
1518

16-
### What is NFT?
19+
ASC: Adaptive skeleton climbing
20+
homepage: http://www.cse.cuhk.edu.hk/~ttwong/papers/asc/asc.html
1721

18-
Neuroelectromagnetic Forward Modeling Toolbox (NFT) is a MATLAB toolbox
19-
for generating realistic head models from available data (MRI and/or
20-
electrode locations) and for computing numerical solutions for solving
21-
the forward problem of electromagnetic source imaging (Zeynep Akalin
22-
Acar & S. Makeig, 2010). NFT includes tools for segmenting scalp, skull,
23-
cerebrospinal fluid (CSF) and brain tissues from T1-weighted magnetic
24-
resonance (MR) images. The Boundary Element Method (BEM) is used for the
25-
numerical solution of the forward problem. After extracting the
26-
segmented tissue volumes, surface BEM meshes may be generated. When a
27-
subject MR image is not available, a template head model may be warped
28-
to 3-D measured electrode locations to obtain an individualized BEM head
29-
model. Toolbox functions can be called from either a graphic user
30-
interface (gui) compatible with EEGLAB (sccn.ucsd.edu/eeglab), or from
31-
the MATLAB command line. Function help messages and a user tutorial are
32-
included. The toolbox is freely available for noncommercial use and open
33-
source development under the GNU Public License.
22+
QSLIM: Quadric-based surface simplification
23+
homepage: http://mgarland.org/software/qslim.html
3424

35-
### Why NFT?
25+
BEM_MATRIX: The METU-FP Toolkit
26+
homepage: http://www.eee.metu.edu.tr/metu-fp/
3627

37-
The NFT is released under an open source license, allowing researchers
38-
to contribute and improve on the work for the benefit of the
39-
neuroscience community. By bringing together advanced head modeling and
40-
forward problem solution methods and implementations within an easy to
41-
use toolbox, the NFT complements EEGLAB, an open source toolkit under
42-
active development. Combined, NFT and EEGLAB form a freely available EEG
43-
(and in future, MEG) source imaging solution.
28+
PROCMESH: Mesh correction and processing. No web page yet. Please contact NFT developers for source code.
4429

45-
The toolbox implements the major aspects of realistic head modeling and
46-
forward problem solution from available subject information:
30+
MATITK: Matlab and ITK
31+
homepage: http://www.sfu.ca/~vwchu/matitk.html
4732

48-
1. Segmentation of T1-weighted MR images: The preferred method of
49-
generating a realistic head model is to use a 3-D whole-head
50-
structural MR image of the subject's head. The toolbox can generate
51-
a segmentation of scalp, skull, CSF and brain tissues from a
52-
T1-weighted image.
53-
54-
2. High-quality BEM meshes: The accuracy of the BEM solution depends on
55-
the quality of the underlying mesh that models tissue
56-
conductance-change boundaries. To avoid numerical instabilities, the
57-
mesh must be topologically correct with no self-intersections. It
58-
should represent the surface using high-quality elements while
59-
keeping the number of elements as small as possible. The NFT can
60-
create high-quality linear surface BEM meshes from the head
61-
segmentation.
62-
63-
3. Warping a template head model: When a whole-head structural MR image
64-
of the subject is not available, a semi-realistic head model can be
65-
generated by warping a standard template BEM mesh to the digitized
66-
electrode coordinates (instead of vice versa).
67-
68-
4. Registration of electrode positions with the BEM mesh: The digitized
69-
electrode locations and the BEM mesh must be aligned to compute
70-
accurate forward problem solutions and lead field matrices.
71-
72-
5. Accurate high-performance forward problem solution: The NFT uses a
73-
high-performance BEM implementation from the open source METU-FP
74-
Toolkit for bioelectromagnetic field computations.
75-
76-
### Required Resources
77-
78-
Matlab 7.0 or later running under any operating system (Linux, Windows).
79-
A large amount of RAM is useful - at least 2 GB (4-8 GB recommended for
80-
forward problem solution of realistic head models). The Matlab Image
81-
Processing toolbox is also recommended.
82-
83-
### NFT Reference Paper
84-
85-
Zeynep Akalin Acar & Scott Makeig, [Neuroelectromagnetic Forward Head
86-
Modeling
87-
Toolbox](http://sccn.ucsd.edu/%7Escott/pdf/Zeynep_NFT_Toolbox10.pdf).
88-
<em>Journal of Neuroscience Methods</em>, 2010
89-
90-
Download
91-
--------
92-
93-
To download the NFT, go to the [NFT download
94-
page](http://sccn.ucsd.edu/nft/).
95-
96-
NFT User's Manual
97-
-----------------
98-
99-
- [Chapter 01: Getting Started with NFT](Chapter_01_Getting_Started_with_NFT "wikilink")
100-
- [Chapter 02: Head Modeling from MR Images](Chapter_02_Head_Modeling_from_MR_Images "wikilink")
101-
- [Chapter 03: Forward Model Generation](Chapter_03_Forward_Model_Generation "wikilink")
102-
- [Chapter 04: NFT Examples](Chapter_04_NFT_Examples "wikilink")
103-
- [Chapter 05: NFT Commands and Functions](Chapter_05_NFT_Commands_and_Functions "wikilink")
104-
- [Appendix A: BEM Mesh Format](NFT_Appendix_A)
105-
- [Appendix B: Function Reference](NFT_Appendix_B)
106-
- [Appendix C: Effect of brain-to-skull conductivity ratio estimate](NFT_Appendix_C)
107-
108-
109-
- [Click here to download the NFT User Manual as a PDF book](NFT_Tutorial.pdf)
110-
111-
<div align=right>
112-
113-
Creation and documentation by:
114-
115-
Zeynep Akalin Acar
116-
117-
Project Scientist
118-
119-
120-
121-
</div>
33+
Note: The MATITK shared libraries are installed in the 'mfiles' directory.

plugins/NIMA/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ layout: default
33
title: NIMA
44
long_title: NIMA
55
parent: Plugins
6+
has_children: true
67
nav_order: 26
78
---
89
To view the plugin source code, please visit the plugin's [GitHub repository](https://github.com/sccn/NIMA).

0 commit comments

Comments
 (0)