Skip to content

Commit

Permalink
support .snirf files in openneuro
Browse files Browse the repository at this point in the history
  • Loading branch information
magland committed Feb 17, 2025
1 parent f61c925 commit 815860d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changes

## February 17, 2025
- Added SNIRF file support with HDF5 viewer integration
- Added loading indicator when expanding directories in the file browser
- Added WAV file plugin with audio playback and waveform visualization
- Updated URL query parameter mapping between v1 to v2
Expand Down
7 changes: 6 additions & 1 deletion src/pages/common/DatasetWorkspace/plugins/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import edfPlugin from "./edf";
import niftiPlugin from "./nifti";
import tsvPlugin from "./tsv";
import wavPlugin from "./wav";
import snirfPlugin from "./snirf";

// Register plugins in order of priority
export const initializePlugins = () => {
Expand All @@ -14,6 +15,10 @@ export const initializePlugins = () => {
registerPlugin(jsonPlugin);
registerPlugin(edfPlugin);
registerPlugin(niftiPlugin);
registerPlugin(wavPlugin); // Add WAV plugin before default
registerPlugin(wavPlugin);

// https://neurosift.app/openneuro-dataset/ds005927?tab=sub-001/sub-001_task-breathhold_nirs.snirf|0eb79a7df397c7d5229dc3cb59cdeb791a4b23e3
registerPlugin(snirfPlugin);

registerPlugin(defaultPlugin);
};
15 changes: 15 additions & 0 deletions src/pages/common/DatasetWorkspace/plugins/snirf/SnirfView.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { FunctionComponent } from "react";
import { DatasetPluginProps } from "../pluginInterface";
import Hdf5View from "../../../../NwbPage/Hdf5View";

const SnirfView: FunctionComponent<DatasetPluginProps> = ({ file, width }) => {
// SNIRF files are HDF5 files, so we can use the Hdf5View component directly
// file.urls[0] contains the URL to the SNIRF file
return (
<div>
<Hdf5View nwbUrl={file.urls[0]} width={width || 800} isExpanded={true} />
</div>
);
};

export default SnirfView;
11 changes: 11 additions & 0 deletions src/pages/common/DatasetWorkspace/plugins/snirf/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { DatasetPlugin } from "../pluginInterface";
import SnirfView from "./SnirfView";

export const snirfPlugin: DatasetPlugin = {
name: "snirf",
type: ["*.snirf"],
component: SnirfView,
priority: 1,
};

export default snirfPlugin;

0 comments on commit 815860d

Please sign in to comment.