diff --git a/controller/mri/index.js b/controller/mri/index.js index 718fe4cdac30e8b050ab56e30a1b3bd174d2452c..ca33f9c35165557a0fa85550ed20d896781ee57f 100644 --- a/controller/mri/index.js +++ b/controller/mri/index.js @@ -1,22 +1,20 @@ const express = require('express'); -const controller = require('./mri.controller'); -const upload_controller = require('./upload.controller'); - const multer = require('multer'); - 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); + uploadController.validator, + uploadController.other_validations, + uploadController.upload); router.get('/reset', controller.reset); diff --git a/js/mri-loader.js b/js/mri-loader.js index 9064ea0e45758aee6fa571aee6c297582bb11a67..b421944bb50bc3ade24c70288f755b440bc59eb4 100644 --- a/js/mri-loader.js +++ b/js/mri-loader.js @@ -1,6 +1,6 @@ -const fs = require('fs'); -const zlib = require('zlib'); -const fileType = require('file-type'); +// const fs = require('fs'); +// const zlib = require('zlib'); +// const fileType = require('file-type'); const MRILoader = function () { diff --git a/package.json b/package.json index b8ad9a14dae42d765a8c60007ea6cc46f1789508..91fdb6b7a302d6266ab52d35860c1cedff6fb037 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/public/js/brainbox-intro.js b/public/js/brainbox-intro.js index 1bdcd674dd006178a5dc7b45c824c4c8ec39d17a..68f41a8cbb2c460ed19564db09590e2dfdc93a1e 100644 --- a/public/js/brainbox-intro.js +++ b/public/js/brainbox-intro.js @@ -1,31 +1,31 @@ -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 Go button to go to BrainBox's viewer" + intro: 'Once you have entered the link to an MRI in the URL field ' + + 'click the Go button to go to BrainBox\'s viewer' } ] }); diff --git a/test/client.js b/test/client.js index 45408c1ab7ea1edf56f8870c54ed95b2c3c0f405..b2088f85aa0fd4d63680ddc11956d48580ca9b98 100644 --- a/test/client.js +++ b/test/client.js @@ -1,24 +1,24 @@ -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 +}); diff --git a/test/test.js b/test/test.js index eeff2364290bc8fb072ef69dacbfa2ac21993eb4..008368d5c3adcce53e339cecf1023ff75c88e2e7 100644 --- a/test/test.js +++ b/test/test.js @@ -1,8 +1,9 @@ -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 + }); + }); });