Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
"Language: Python":
- changed-files:
- any-glob-to-any-file: '**/*.py'

"Package: EEG chunker":
- changed-files:
- any-glob-to-any-file: 'python/loris_eeg_chunker/**'
2 changes: 1 addition & 1 deletion install/templates/environment_template
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ source ${MINC_TOOLKIT_DIR}/minc-toolkit-config.sh
umask 0002

# export PATH, PERL5LIB, TMPDIR and LORIS_CONFIG variables
export PATH=/opt/${PROJECT}/bin/mri:/opt/${PROJECT}/bin/mri/uploadNeuroDB:/opt/${PROJECT}/bin/mri/uploadNeuroDB/bin:/opt/${PROJECT}/bin/mri/dicom-archive:/opt/${PROJECT}/bin/mri/python/scripts:/opt/${PROJECT}/bin/mri/tools:/opt/${PROJECT}/bin/mri/python/loris_eeg_chunker:${MINC_TOOLKIT_DIR}/bin:/usr/local/bin/tpcclib:$PATH
export PATH=/opt/${PROJECT}/bin/mri:/opt/${PROJECT}/bin/mri/uploadNeuroDB:/opt/${PROJECT}/bin/mri/uploadNeuroDB/bin:/opt/${PROJECT}/bin/mri/dicom-archive:/opt/${PROJECT}/bin/mri/python/scripts:/opt/${PROJECT}/bin/mri/tools:${MINC_TOOLKIT_DIR}/bin:/usr/local/bin/tpcclib:$PATH
export PERL5LIB=/opt/${PROJECT}/bin/mri/uploadNeuroDB:/opt/${PROJECT}/bin/mri/dicom-archive:$PERL5LIB
export TMPDIR=/tmp
export LORIS_CONFIG=/opt/${PROJECT}/bin/mri/config
Expand Down
9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,21 @@ license-files = ["LICENSE"]
requires-python = ">= 3.11"
dependencies = [
"boto3==1.35.99",
"google",
"mat73",
"matplotlib",
"mne",
"mne-bids>=0.14",
"mysqlclient",
"nibabel",
"nilearn",
"nose",
"numpy",
"protobuf>=3.0.0",
"pybids==0.17.0",
"pydicom",
"python-dateutil",
"scikit-learn",
"scipy",
"sqlalchemy>=2.0.0",
"virtualenv",
"loris-eeg-chunker @ {root:uri}/python/loris_eeg_chunker",
]

[project.optional-dependencies]
Expand All @@ -42,10 +39,12 @@ dev = [
[project.urls]
Homepage = "https://github.com/aces/loris-mri"

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.build.targets.wheel]
packages = [
"python/lib",
"python/loris_eeg_chunker",
"python/tests",
]

Expand Down
13 changes: 7 additions & 6 deletions python/lib/physiological.py
Original file line number Diff line number Diff line change
Expand Up @@ -1234,12 +1234,13 @@ def create_chunks_for_visualization(self, physio_file_id, data_dir):

# determine which script to run based on the file type
file_type = self.grep_file_type_from_file_id(physio_file_id)
if file_type == 'set':
script = os.environ['LORIS_MRI'] + '/python/loris_eeg_chunker/eeglab_to_chunks.py'
command = 'python ' + script + ' ' + full_file_path + ' --destination ' + chunk_root_dir
elif file_type == 'edf':
script = os.environ['LORIS_MRI'] + '/python/loris_eeg_chunker/edf_to_chunks.py'
command = 'python ' + script + ' ' + full_file_path + ' --destination ' + chunk_root_dir
match file_type:
case 'set':
script = 'eeglab-to-chunks'
case 'edf':
script = 'edf-to-chunks'

command = script + ' ' + full_file_path + ' --destination ' + chunk_root_dir

# chunk the electrophysiology dataset if a command was determined above
try:
Expand Down
2 changes: 2 additions & 0 deletions python/loris_eeg_chunker/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# LORIS EEG chunker

Set of scripts to chunk EEG data in smaller bits for the React viewer of LORIS.

These scripts were extracted on July 8th, 2019 from the master branch of the
Expand Down
28 changes: 28 additions & 0 deletions python/loris_eeg_chunker/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
[project]
name = "loris-eeg-chunker"
version = "27.0.0"
description = "The LORIS EEG chunker"
readme = "README.md"
license = "GPL-3.0-or-later"
requires-python = ">= 3.11"
dependencies = [
"google",
"mne",
"mne-bids>=0.14",
"numpy",
"protobuf>=3.0.0",
"scipy",
]

[project.scripts]
edf-to-chunks = "loris_eeg_chunker.scripts.edf_to_chunks:main"
eeglab-to-chunks = "loris_eeg_chunker.scripts.eeglab_to_chunks:main"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src/loris_eeg_chunker"]

[tool.ruff]
extend = "../../pyproject.toml"
src = ["src"]
exclude = ["protocol_buffers"]
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def load_channels(exclude):
return lambda path : mne.io.read_raw_edf(path, exclude=exclude, preload=False)


if __name__ == '__main__':
def main():
parser = argparse.ArgumentParser(
description='Convert .edf files to chunks for browser based visualisation.')
parser.add_argument('files', metavar='FILE', type=str, nargs='+',
Expand Down Expand Up @@ -87,3 +87,7 @@ def load_channels(exclude):
destination=args.destination,
prefix=args.prefix
)


if __name__ == '__main__':
main()
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def load_channels(path):
return mne.io.read_raw_eeglab(path, preload=False)


if __name__ == '__main__':
def main():
parser = argparse.ArgumentParser(
description='Convert .set files to chunks for browser based visualisation.')
parser.add_argument('files', metavar='FILE', type=str, nargs='+',
Expand Down Expand Up @@ -57,3 +57,7 @@ def load_channels(path):
destination=args.destination,
prefix=args.prefix
)


if __name__ == '__main__':
main()
2 changes: 1 addition & 1 deletion test/mri.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ RUN bash ./test/imaging_install_test.sh $DATABASE_NAME $DATABASE_USER $DATABASE_
# Setup the LORIS-MRI environment variables
ENV PROJECT=loris
ENV MINC_TOOLKIT_DIR=/opt/minc/1.9.18
ENV PATH=/opt/${PROJECT}/bin/mri:/opt/${PROJECT}/bin/mri/uploadNeuroDB:/opt/${PROJECT}/bin/mri/uploadNeuroDB/bin:/opt/${PROJECT}/bin/mri/dicom-archive:/opt/${PROJECT}/bin/mri/python/scripts:/opt/${PROJECT}/bin/mri/tools:/opt/${PROJECT}/bin/mri/python/loris_eeg_chunker:${MINC_TOOLKIT_DIR}/bin:/usr/local/bin/tpcclib:$PATH
ENV PATH=/opt/${PROJECT}/bin/mri:/opt/${PROJECT}/bin/mri/uploadNeuroDB:/opt/${PROJECT}/bin/mri/uploadNeuroDB/bin:/opt/${PROJECT}/bin/mri/dicom-archive:/opt/${PROJECT}/bin/mri/python/scripts:/opt/${PROJECT}/bin/mri/tools:${MINC_TOOLKIT_DIR}/bin:/usr/local/bin/tpcclib:$PATH
ENV PERL5LIB=/opt/${PROJECT}/bin/mri/uploadNeuroDB:/opt/${PROJECT}/bin/mri/dicom-archive:$PERL5LIB
ENV TMPDIR=/tmp
ENV LORIS_CONFIG=/opt/${PROJECT}/bin/mri/config
Expand Down
Loading