Commit 3cac7be0 authored by Jim Ulle's avatar Jim Ulle
Browse files

fixed some linting errors

parent 30f98e6e
var express = require('express');
var controller = require('./mri.controller');
var upload_controller = require('./upload.controller');
const express = require('express');
const multer = require('multer');
var multer = require('multer');
var router = express.Router();
const router = express.Router();
const controller = require('./mri.controller');
const uploadController = require('./upload.controller');
router.get('', controller.validator, controller.mri);
router.get('/json', controller.validator, tokenAuthentication, controller.api_mri_get);
router.post('/json', controller.validator_post, tokenAuthentication, controller.api_mri_post);
router.get('/upload', upload_controller.token);
router.get('/upload', uploadController.token);
router.post('/upload',
multer({ dest: './tmp/'}).array('atlas'),
upload_controller.validator,
upload_controller.other_validations,
upload_controller.upload);
multer({dest: './tmp/'}).array('atlas'),
uploadController.validator,
uploadController.other_validations,
uploadController.upload);
router.get('/reset', controller.reset);
module.exports = router;
\ No newline at end of file
module.exports = router;
var express = require('express');
var controller = require('./project.controller');
const express = require('express');
const controller = require('./project.controller');
var router = express.Router();
const router = express.Router();
//
router.get('/new', controller.newProject);
router.get('/json', tokenAuthentication, controller.api_projectAll);
router.get('/json/:projectName', controller.validator , tokenAuthentication, controller.api_project);
router.get('/json/:projectName/files', controller.validator , tokenAuthentication, controller.api_projectFiles);
router.get('/json/:projectName', controller.validator, tokenAuthentication, controller.api_project);
router.get('/json/:projectName/files', controller.validator, tokenAuthentication, controller.api_projectFiles);
router.post('/json/:projectName', controller.validator, tokenAuthentication, controller.post_project);
router.delete('/json/:projectName', controller.validator, tokenAuthentication, controller.delete_project);
router.get('/:projectName', controller.validator, controller.project);
router.get('/:projectName/settings', controller.validator, controller.settings);
module.exports = router;
\ No newline at end of file
module.exports = router;
var express = require('express');
var controller = require('./user.controller');
const express = require('express');
const controller = require('./user.controller');
var router = express.Router();
const router = express.Router();
router.get('/json', controller.api_userAll);
router.get('/json/:userName', controller.validator , controller.api_user);
router.get('/json/:userName/files', controller.validator , controller.api_userFiles);
router.get('/json/:userName/atlas', controller.validator , controller.api_userAtlas);
router.get('/json/:userName/projects', controller.validator , controller.api_userProjects);
router.get('/:userName', controller.validator , controller.user);
router.get('/json/:userName', controller.validator, controller.api_user);
router.get('/json/:userName/files', controller.validator, controller.api_userFiles);
router.get('/json/:userName/atlas', controller.validator, controller.api_userAtlas);
router.get('/json/:userName/projects', controller.validator, controller.api_userProjects);
router.get('/:userName', controller.validator, controller.user);
module.exports = router;
\ No newline at end of file
module.exports = router;
var fs = require('fs');
var zlib = require('zlib');
var fileType=require("file-type");
// const fs = require('fs');
// const zlib = require('zlib');
// const fileType = require('file-type');
var MRILoader = function() {
const MRILoader = function () {
/*
var loadNifti = function(nii) {
var vox_offset=352;
var sizeof_hdr=nii.readUInt32LE(0);
var dimensions=nii.readUInt16LE(40);
var mri={};
mri.hdr=nii.slice(0,vox_offset);
mri.dim=[];
......@@ -49,20 +49,20 @@ var loadNifti = function(nii) {
default:
console.log("ERROR: Unknown dataType: "+mri.datatype);
}
return mri;
}
var loadBrainNifti = function(nii,callback) {
var brain=loadNifti(nii);
var i,sum=0,min,max;
min=brain.data[0];
max=min;
for(i=0;i<brain.dim[0]*brain.dim[1]*brain.dim[2];i++) {
sum+=brain.data[i];
if(brain.data[i]<min) min=brain.data[i];
if(brain.data[i]>max) max=brain.data[i];
}
......@@ -77,7 +77,7 @@ var loadBrainMGZ = function(data,callback) {
var hdr_sz=284;
var brain={};
var datatype;
brain.dim=[];
brain.dim[0]=data.readInt32BE(4);
brain.dim[1]=data.readInt32BE(8);
......@@ -87,7 +87,7 @@ var loadBrainMGZ = function(data,callback) {
brain.pixdim[0]=data.readFloatBE(30);
brain.pixdim[1]=data.readFloatBE(34);
brain.pixdim[2]=data.readFloatBE(38);
var tmp
switch(datatype) {
case 0: // MGHUCHAR
......@@ -119,7 +119,7 @@ var loadBrainMGZ = function(data,callback) {
max=min;
for(i=0;i<brain.dim[0]*brain.dim[1]*brain.dim[2];i++) {
sum+=brain.data[i];
if(brain.data[i]<min) min=brain.data[i];
if(brain.data[i]>max) max=brain.data[i];
}
......@@ -139,7 +139,7 @@ this.loadBrain = function(path,callback) {
datagz=fs.readFileSync(path);
var ft=fileType(datagz);
var ext=path.split('.').pop();
switch(ft.ext) {
case 'gz': {
switch(ext) {
......
......@@ -38,6 +38,7 @@
"struct": "0.0.11",
"url": "^0.11.0",
"validator": "^6.0.0",
"webpage": "^0.3.0",
"ws": "^1.1.1"
},
"devDependencies": {
......
function startIntro(){
var intro = introJs();
function startIntro() {
const intro = introJs();
intro.setOptions({
steps: [
{
intro: "Welcome to BrainBox."
+ "BrainBox allows you to visualise and segment collaboratively "
+ "any brain MRI dataset available online. Follow this tutorial "
+ "to learn how to enter data into BrainBox, view it, edit it, "
+ "and create collaborative segmentation projects. BrainBox is an "
+ "open project – you will learn how to help us improving it by "
+ "reporting bugs and suggestions to our GitHub repository"
intro: 'Welcome to BrainBox.' +
'BrainBox allows you to visualise and segment collaboratively ' +
'any brain MRI dataset available online. Follow this tutorial ' +
'to learn how to enter data into BrainBox, view it, edit it, ' +
'and create collaborative segmentation projects. BrainBox is an ' +
'open project – you will learn how to help us improving it by ' +
'reporting bugs and suggestions to our GitHub repository'
},
{
element: "#url",
intro: "This is BrainBox's URL field. You can paste here a link "
+ "to any MRI on the web. Currently, BrainBox supports Nifti "
+ "format (.nii.gz files) and MGH format (.mgz files). Any link "
+ "on the Web should work, from Zenodo, FigShare, DropBox, Amazon, "
+ "etc. If you want to try BrainBox but you don't have any link to "
+ "an MRI, you can select a brain from the \"Take me to a brain\" "
+ "list, or browse among the community created projects.",
element: '#url',
intro: 'This is BrainBox\'s URL field. You can paste here a link ' +
'to any MRI on the web. Currently, BrainBox supports Nifti ' +
'format (.nii.gz files) and MGH format (.mgz files). Any link ' +
'on the Web should work, from Zenodo, FigShare, DropBox, Amazon, ' +
'etc. If you want to try BrainBox but you don\'t have any link to ' +
'an MRI, you can select a brain from the "Take me to a brain" ' +
'list, or browse among the community created projects.',
position: 'top'
},
{
element: '#go',
intro: "Once you have entered the link to an MRI in the URL field "
+ "click the <b>Go</b> button to go to BrainBox's viewer"
intro: 'Once you have entered the link to an MRI in the URL field ' +
'click the <b>Go</b> button to go to BrainBox\'s viewer'
}
]
});
......
var page = require('webpage').create();
const page = require('webpage').create();
//viewportSize being the actual size of the headless browser
page.viewportSize = { width: 1024, height: 768 };
// viewportSize being the actual size of the headless browser
page.viewportSize = {width: 1024, height: 768};
//the clipRect is the portion of the page you are taking a screenshot of
page.clipRect = { top: 0, left: 0, width: 1024, height: 768 };
// the clipRect is the portion of the page you are taking a screenshot of
page.clipRect = {top: 0, left: 0, width: 1024, height: 768};
page.open('http://brainbox.dev', function(status) {
if (status !== 'success') {
page.open('http://brainbox.dev', function (status) {
if (!(status === 'success')) {
console.log('Unable to access network');
} else {
// a screenshot of the home page
page.render('index.jpg');
// log the title
var title = page.evaluate(function() {
const title = page.evaluate(function () {
return document.title;
});
console.log(title);
}
phantom.exit();
});
\ No newline at end of file
});
var assert = require("assert");
describe('Array', function(){
describe('#indexOf()', function(){
it('should return -1 when the value is not present', function(){
assert.equal(-1, [1,2,3].indexOf(4)); // 4 is not present in this array so indexOf returns -1
})
})
const assert = require('assert');
describe('Array', function () {
describe('#indexOf()', function () {
it('should return -1 when the value is not present', function () {
assert.equal(-1, [1, 2, 3].indexOf(4)); // 4 is not present in this array so indexOf returns -1
});
});
});
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment