Skip to content

Commit 6f860d5

Browse files
pgroveslmarini
andauthored
Adds MRI previewer for NIFTY (.nii) file format. (#241)
* Adds MRI previewer for NIFTY (.nii) file format. * deleted vim swap files * Added application/x-gzip to file types on which nii previewer runs on. * Added changelog and contributors. Co-authored-by: Luigi Marini <[email protected]> Co-authored-by: Luigi Marini <[email protected]>
1 parent 5dbbbef commit 6f860d5

File tree

9 files changed

+3617
-1
lines changed

9 files changed

+3617
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
88

99
## Unreleased
1010

11+
### Added
12+
- MRI previewer for NIFTY (.nii) files.
13+
1114
### Fixed
1215
- Send email to all admins in a single email when a user submits 'Request access' for a space
1316
- Send email to all admins and request user in a single email when any admin accepts/rejects 'Request access' for a space [#330](https://github.com/clowder-framework/clowder/issues/330)

CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Following is a list of contributors in alphabetical order:
3131
- Mike Lambert
3232
- Nicholas Tenczar
3333
- Nishant Nayudu
34+
- Peter Groves
3435
- Rob Kooper
3536
- Rui Liu
3637
- Sandeep Puthanveetil Satheesan

conf/mimetypes.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,5 @@ mimetype.nra=application/simsnra
134134
mimetype.spe=application/simsspe
135135
mimetype.Spe=application/simsspe
136136
mimetype.xrdml=application/xray-xrdml
137-
mimetype.xnra=application/simsxnra
137+
mimetype.xnra=application/simsxnra
138+
mimetype.nii=image/nii
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#MRI previewer based on the Papaya JS library
2+
3+
## Papaya Library
4+
Papaya is a javascript component for viewing MRI images. This integration only
5+
currently supports NIFTI images (.nii and .nii.gz files).
6+
7+
Homepage: https://rii-mango.github.io/Papaya/
8+
Live demo: https://papaya.greenant.net/
9+
Source: https://github.com/rii-mango/Papaya
10+
11+
## Clowder Previewer
12+
13+
![Clowder MRI Previewer Screenshot](clowder-mri-papaya-screenshot.png)
14+
15+
TODO: Support for DICOM images is possible, but the integration is harder b/c
16+
a single DICOM volume is a directory full of image files which must be queried
17+
for through Clowder and then fed to the jquery component.
18+
19+
## Build
20+
21+
The assets in this previewer (clowder/public/javascripts/previewers/mri-papaya)
22+
can be replicated with the following procedure. The BUILD_SHA below is from May 5, 2019, which
23+
was the HEAD of the project's `master` branch as of April 15 2021.
24+
25+
Note that the `-nojquery` flag must be included or it will bundle a version of jquery that is
26+
incompatible with Clowder's.
27+
28+
```
29+
BUILD_SHA=782a19341af77a510d674c777b6da46afb8c65f1
30+
git clone [email protected]:rii-mango/Papaya.git
31+
cd Papaya
32+
git checkout $BUILD_SHA
33+
./papaya-builder.sh -nojquery
34+
```
35+
36+
The assets will then be in the `build/` directory
37+
149 KB
Loading
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
(function ($, Configuration) {
2+
3+
var scriptElem = document.createElement("script");
4+
scriptElem.type = "text/javascript";
5+
scriptElem.src = Configuration.previewer + "/papaya.js";
6+
$(Configuration.tab).append(scriptElem);
7+
8+
var styleSheetLink = document.createElement("link");
9+
styleSheetLink.rel = 'stylesheet';
10+
styleSheetLink.href = Configuration.previewer + "/papaya.css";
11+
$(Configuration.tab).append(styleSheetLink);
12+
13+
var params = [];
14+
var papayaDivId = "papayaMain";
15+
params['images'] = [Configuration.url];
16+
17+
//force the bottom control bar always on or the buttons will pop up in a weird place in the page
18+
params['showControlBar'] = true;
19+
20+
//If you don't want the bottom controls, do this instead of showControlBar
21+
//params['showControls'] = false;
22+
23+
var papayaDiv = document.createElement("div")
24+
papayaDiv.setAttribute("id", papayaDivId);
25+
$(Configuration.tab).append(papayaDiv);
26+
papaya.Container.addViewer(papayaDivId, params);
27+
28+
}(jQuery, Configuration));
29+
30+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "interactive_mri_viewer_for_nii_files",
3+
"main": "mri-papaya.js",
4+
"file": true,
5+
"contentType": ["image/nii", "application/x-gzip"]
6+
}

public/javascripts/previewers/mri-papaya/papaya.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)