Skip to content
Open
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
6 changes: 6 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
skip = .git*,*.pdf,.codespellrc
check-hidden = true
# ignore-regex =
# ignore-words-list =
25 changes: 25 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Codespell configuration is within .codespellrc
---
name: Codespell

on:
push:
branches: [master]
pull_request:
branches: [master]

permissions:
contents: read

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Annotate locations with typos
uses: codespell-project/codespell-problem-matcher@v1
- name: Codespell
uses: codespell-project/actions-codespell@v2
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ repos:
rev: 19.3b0
hooks:
- id: black

- repo: https://github.com/codespell-project/codespell
# Configuration for codespell is in .codespellrc
rev: v2.4.0
hooks:
- id: codespell
4 changes: 2 additions & 2 deletions Brainhack_2019_Issue.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Name of your awesome project
Script to Export Freesurfer-based Parcellation/Segmentation Stats and Provenance as JSON-LD and NIDM
## Project Description
This project ultimately aims to facilitate both query and analysis of parcellation/segmentation based regional statistics across popular softwares such as [Freesurfer](https://surfer.nmr.mgh.harvard.edu/), [FSL](https://fsl.fmrib.ox.ac.uk/fsl/fslwiki), and [ANTS](http://stnava.github.io/ANTs/). Currently each software produces its own output format and brain region labels are specific to the atlas used in generating the regional statistics. This makes life difficult when trying to search for "nucleaus accumbens" volume, for example, across the different software products. Further, knowing which version of the software tool used and what atlas and version of the atlas in a structured representation facilitating query is lacking. To this end we propose augmenting the various segmentation tools with scripts that will: (1) map atlas-specific anatomical nomeclature to anatomical concepts hosted in terminology resources (e.g. InterLex); (2) capture better structured provenance about the input image(s) and the atlases used for the segmentation; (3) export the segmentation results and the provenance as either [JSON-LD](https://json-ld.org/), [NIDM](http://nidm.nidash.org/) which can then link the derived data to broader records of the original project metadata, or as an additional component of a BIDS derivative.
This project ultimately aims to facilitate both query and analysis of parcellation/segmentation based regional statistics across popular software such as [Freesurfer](https://surfer.nmr.mgh.harvard.edu/), [FSL](https://fsl.fmrib.ox.ac.uk/fsl/fslwiki), and [ANTS](http://stnava.github.io/ANTs/). Currently each software produces its own output format and brain region labels are specific to the atlas used in generating the regional statistics. This makes life difficult when trying to search for "nucleaus accumbens" volume, for example, across the different software products. Further, knowing which version of the software tool used and what atlas and version of the atlas in a structured representation facilitating query is lacking. To this end we propose augmenting the various segmentation tools with scripts that will: (1) map atlas-specific anatomical nomeclature to anatomical concepts hosted in terminology resources (e.g. InterLex); (2) capture better structured provenance about the input image(s) and the atlases used for the segmentation; (3) export the segmentation results and the provenance as either [JSON-LD](https://json-ld.org/), [NIDM](http://nidm.nidash.org/) which can then link the derived data to broader records of the original project metadata, or as an additional component of a BIDS derivative.

We aim to tackle this problem in steps. For this hackathon project we'll be focusing on conversion from Freesurfer's [mri_segstats](https://surfer.nmr.mgh.harvard.edu/fswiki/mri_segstat) program output along with some additional parsing/conversion of Freesurfer log files.

## Skills required to participate
Python and structural neuroimaging experience. If one has experience with [rdflib](https://github.com/RDFLib/rdflib) or [PROV](https://github.com/trungdong/prov) that would also be helpful. A good appreciation of Japanese sake may also help for late night discussion.

## Integration
This project will need expertise in programming, structural neuroimaging, and anatomy. To make this project sucessful we need individuals who have skills in any of these domains to help with: (1) understand Freesurfer's segmentation results format and log files; (2) programming up a script in Python; (3) understand anatomy well enough to select the proper anatomical concept that maps to a specific atlas designation of a region and ***can define new anatomy terms where needed, linking them to broader concepts*** to facilitate segmentation results queries across softwares.
This project will need expertise in programming, structural neuroimaging, and anatomy. To make this project successful we need individuals who have skills in any of these domains to help with: (1) understand Freesurfer's segmentation results format and log files; (2) programming up a script in Python; (3) understand anatomy well enough to select the proper anatomical concept that maps to a specific atlas designation of a region and ***can define new anatomy terms where needed, linking them to broader concepts*** to facilitate segmentation results queries across software.

## Preparation material
* [Freesurfer](https://surfer.nmr.mgh.harvard.edu/)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Making Freesurfer FAIR
Script to Export Freesurfer-based Parcellation/Segmentation Stats and Provenance as JSON-LD and NIDM
## Project Description
This project ultimately aims to facilitate both query and analysis of parcellation/segmentation based regional statistics across popular softwares such as [Freesurfer](https://surfer.nmr.mgh.harvard.edu/), [FSL](https://fsl.fmrib.ox.ac.uk/fsl/fslwiki), and [ANTS](http://stnava.github.io/ANTs/). Currently each software produces its own output format and brain region labels are specific to the atlas used in generating the regional statistics. This makes life difficult when trying to search for "nucleus accumbens" volume, for example, across the different software products. Further, knowing which version of the software tool used and what atlas and version of the atlas in a structured representation facilitating query is lacking. To this end we propose augmenting the various segmentation tools with scripts that will: (1) map atlas-specific anatomical nomeclature to anatomical concepts hosted in terminology resources (e.g. InterLex); (2) capture better structured provenance about the input image(s) and the atlases used for the segmentation; (3) export the segmentation results and the provenance as either [JSON-LD](https://json-ld.org/), [NIDM](http://nidm.nidash.org/) which can then link the derived data to broader records of the original project metadata, or as an additional component of a BIDS derivative.
This project ultimately aims to facilitate both query and analysis of parcellation/segmentation based regional statistics across popular software such as [Freesurfer](https://surfer.nmr.mgh.harvard.edu/), [FSL](https://fsl.fmrib.ox.ac.uk/fsl/fslwiki), and [ANTS](http://stnava.github.io/ANTs/). Currently each software produces its own output format and brain region labels are specific to the atlas used in generating the regional statistics. This makes life difficult when trying to search for "nucleus accumbens" volume, for example, across the different software products. Further, knowing which version of the software tool used and what atlas and version of the atlas in a structured representation facilitating query is lacking. To this end we propose augmenting the various segmentation tools with scripts that will: (1) map atlas-specific anatomical nomeclature to anatomical concepts hosted in terminology resources (e.g. InterLex); (2) capture better structured provenance about the input image(s) and the atlases used for the segmentation; (3) export the segmentation results and the provenance as either [JSON-LD](https://json-ld.org/), [NIDM](http://nidm.nidash.org/) which can then link the derived data to broader records of the original project metadata, or as an additional component of a BIDS derivative.

We aim to tackle this problem in steps. For this hackathon project we'll be focusing on conversion from Freesurfer's [mri_segstats](https://surfer.nmr.mgh.harvard.edu/fswiki/mri_segstat) program output along with some additional parsing/conversion of Freesurfer log files. The conversion is driven by a function which queries InterLex and develops a JSON structure which defines the atlas terminology and the measures being output.

Expand All @@ -17,7 +17,7 @@ Python and structural neuroimaging experience. If one has experience with [rdfl
- JB Poline

## Integration
This project will need expertise in programming, structural neuroimaging, and anatomy. To make this project sucessful we need individuals who have skills in any of these domains to help with: (1) understand Freesurfer's segmentation results format and log files; (2) programming up a script in Python; (3) understand anatomy well enough to select the proper anatomical concept that maps to a specific atlas designation of a region and ***can define new anatomy terms where needed, linking them to broader concepts*** to facilitate segmentation results queries across softwares.
This project will need expertise in programming, structural neuroimaging, and anatomy. To make this project successful we need individuals who have skills in any of these domains to help with: (1) understand Freesurfer's segmentation results format and log files; (2) programming up a script in Python; (3) understand anatomy well enough to select the proper anatomical concept that maps to a specific atlas designation of a region and ***can define new anatomy terms where needed, linking them to broader concepts*** to facilitate segmentation results queries across software.

## Preparation material
* [Freesurfer](https://surfer.nmr.mgh.harvard.edu/)
Expand Down Expand Up @@ -62,7 +62,7 @@ optional arguments:
sidecar file with those mappings for automated runs of future CSV files with the same set of variables.
-subjid SUBJID, --subjid SUBJID
If a path to a URL or a stats fileis supplied via the -f/--seg_file parameters then -subjid parameter must be set
withthe subject identifier to be used in the NIDM files
with the subject identifier to be used in the NIDM files
-o OUTPUT_DIR, --output OUTPUT_DIR
Output filename with full path
-j, --jsonld If flag set then NIDM file will be written as JSONLD instead of TURTLE
Expand Down
2 changes: 1 addition & 1 deletion segstats_jsonld/fs_to_nidm.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def map_csv_variables_to_freesurfer_cdes(df,id_field,outdir,csv_file,json_map=No

def url_validator(url):
'''
Tests whether url is a valide url
Tests whether url is a valid url
:param url: url to test
:return: True for valid url else False
'''
Expand Down
6 changes: 3 additions & 3 deletions segstats_jsonld/mapping_data/FreeSurferColorLUT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
169 Left-Basal-Ganglia 236 13 127 0
176 Right-Basal-Ganglia 236 13 126 0

# Label names and colors for Brainstem consituents
# Label names and colors for Brainstem constituents
# No. Label Name: R G B A
170 brainstem 119 159 176 0
171 DCG 119 0 176 0
Expand Down Expand Up @@ -432,14 +432,14 @@
# created by mri_aparc2aseg in which the aseg cortex label is replaced
# by the labels in the aparc. It also supports wm labels that will
# eventually be created by mri_aparc2aseg. Otherwise, the aseg labels
# do not change from above. The cortical lables are the same as in
# do not change from above. The cortical labels are the same as in
# colortable_desikan_killiany.txt, except that left hemisphere has
# 1000 added to the index and the right has 2000 added. The label
# names are also prepended with ctx-lh or ctx-rh. The white matter
# labels are the same as in colortable_desikan_killiany.txt, except
# that left hemisphere has 3000 added to the index and the right has
# 4000 added. The label names are also prepended with wm-lh or wm-rh.
# Centrum semiovale is also labled with 5001 (left) and 5002 (right).
# Centrum semiovale is also labeled with 5001 (left) and 5002 (right).
# Even further below are the color tables for aparc.a2005s and aparc.a2009s.

#No. Label Name: R G B A
Expand Down