Skip to content

Commit

Permalink
Mirror 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
birm committed Mar 25, 2020
1 parent 2a989c8 commit 06228ae
Show file tree
Hide file tree
Showing 14 changed files with 445 additions and 77 deletions.
1 change: 1 addition & 0 deletions Deps/auth_service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ RUN mkdir /root/src
COPY . /root/src
WORKDIR /root/src

RUN npm config set unsafe-perm true
RUN npm install
RUN npm install -g forever
EXPOSE 8010
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# QuIP Distribution
# QUIP/caMicroscope Distribution

[![Build Status](https://travis-ci.org/camicroscope/Distro.svg?branch=master)](https://travis-ci.org/camicroscope/Distro)

QuIP 3.X distribution
caMicroscope 3.X distribution


run with `docker-compose -f caMicroscope.yml up`
Expand Down Expand Up @@ -54,3 +54,6 @@ Running QuIP with PathDB (https://github.com/SBU-BMI/PathDB):

## Support
Feel free to add any support inquiry as a github issue to this repository. Other feedback can be given via [this form](https://docs.google.com/forms/d/e/1FAIpQLScL91LxrpAZjU88GBZP9gmcdgdf8__uNUwhws2lzU6Lr4qNwA/viewform).

## Open Source Development
We have a discussion mailing list! Stop by and discuss all things caMicroscope. https://groups.google.com/forum/#!forum/camicroscope
4 changes: 2 additions & 2 deletions caMicroscope.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ services:
volumes:
- ./images/:/images/
viewer:
build: "https://github.com/camicroscope/caMicroscope.git#v3.5.10"
build: "https://github.com/camicroscope/caMicroscope.git#v3.6.0"
container_name: ca-front
restart: unless-stopped
volumes:
- ./config/login.html:/var/www/html/login.html
- ./config/login.html:/usr/local/apache2/htdocs/login.html
logging:
driver: none
loader:
Expand Down
14 changes: 14 additions & 0 deletions config/bindaas_projects/caMicroscope.project
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,20 @@
"timeCreated": "Fri Aug 10 19:27:36 UTC 2018",
"createdBy": "admin",
"description": "get auth for user"
},
"list": {
"queryTemplate": "{\n\t\"_operation\" : \"find\" ,\n\t\"_operation_args\" : {\n\t\t\t\t\t\t\t\"query\" : {} ,\n\t\t\t\t\t\t\t\"fields\" :{ \u0027_id\u0027 : 0 }\n\t\t\t\t\t\t}\n}\n",
"metaData": {},
"tags": [],
"bindVariables": {},
"stage": "UNVERIFIED",
"outputFormat": {
"outputFormat": "JSON"
},
"name": "list",
"timeCreated": "Mon Dec 09 19:45:34 GMT 2019",
"createdBy": "admin",
"description": "list all auth with no queries"
}
},
"deleteEndpoints": {},
Expand Down
222 changes: 152 additions & 70 deletions config/login.html
Original file line number Diff line number Diff line change
@@ -1,77 +1,159 @@
<!DOCTYPE html>
<html>
<h1>Redirecting...</h1>
<script>
// config vars, these are DEFAULTS
var audience = "wolf.cci.emory.edu/camic_uat"
var scope = "openid%20email"
var client_id = "YLRDUmEs5Jivi6FX3XtNNAt97X3a0epD"
// handle urls automatically
var base_deployment_url = window.location.toString().split("/").slice(0,-1).join("/")
var redirect_uri = base_deployment_url + "/login.html"
var default_redirect = base_deployment_url + "/apps/table.html"
var response_type = "id_token"
var base_auth_url = "https://birmstuff.auth0.com/authorize?"
var cookie_name = "token" // "token" is expected by elevate router
// make the url
var auth_url = base_auth_url
auth_url += "&audience=" + audience
auth_url += "&scope=" + scope
auth_url += "&response_type=" + response_type
auth_url += "&client_id=" + client_id
auth_url += "&redirect_uri=" + redirect_uri
<head>
<title>CaMicroscope</title>
<meta charset="utf-8" />
<meta name="google-signin-client_id" content="539699277901-buh78f048405grejogqbrskj233rt0d0.apps.googleusercontent.com">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="./apps/landing/main.css" />
<script type="text/javascript" src="./common/util.js"></script>
</head>
<body>
<header id="header">
<label style="color:white;padding:0 15px;font-size:20px;">CaMicroscope</label>
<nav id="nav">
<ul>
<li><a target="_blank" href="https://docs.google.com/forms/d/e/1FAIpQLScL91LxrpAZjU88GBZP9gmcdgdf8__uNUwhws2lzU6Lr4qNwA/viewform">Feedback</a></li>
<!-- <li><a href="./login.html?logout=true">Sign Out</a></li> -->
</ul>
</nav>
</header>
<section id="main" class="wrapper" style="padding:3em;">
<div class="inner">
<header class="major">
<h2 style="margin:0;">caMicroscope</h2>
</header>
<!-- Content -->

function randomString(length) {
var bytes = new Uint8Array(length);
var random = window.crypto.getRandomValues(bytes);
var result = [];
var charset = '0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._~'
random.forEach(function (c) {
<div class="content">
<p><strong>caMicroscope</strong> is a tool to view, label, and annotate biomedical images.</p>
<a href="#" class="image fit"><img src="./apps/landing/banner1.jpg" alt="" /></a>

</div>

<div class="posts" style="justify-content: center;">
<!-- Organizer -->
<section class="post">
<a href="../table.html" class="image"><img src="./apps/landing/camic.jpg" alt=""/></a>
<div class="content">
<h3>Please Sign In With Your Google Account</h3>
<div id="google-signin2"></div>
</div>
</section>
</div>
</section>

<script>
function onSuccess(googleUser) {
// don't if we're logging out
if (getUrlParam("logout")) {
removeUserConsentAcceptance(getUserId());
signOut();
deleteCookies();
console.log("logging out");
window.location.href = "./login.html";
} else {
var id_token = googleUser.getAuthResponse().id_token;
// console.info(id_token);
// trade for camic token
var cookie_name = "token"; // "token" is expected by elevate router
var base_deployment_url = window.location
.toString()
.split("/")
.slice(0, -1)
.join("/");
var redirect_uri = base_deployment_url + "/login.html";
var default_redirect = base_deployment_url + "/apps/table.html";
var state;
if (getUrlParam("state")) {
state = decodeURIComponent(getUrlParam("state"));
}
if (!state) {
state = default_redirect;
}
if (id_token) {
document.cookie = cookie_name + "=" + id_token;
fetch("./auth/Token/check", {
headers: {
Authorization: "Bearer " + id_token
}
})
.then(x => x.json())
.then(x => {
if (x.hasOwnProperty("token")) {
document.cookie = cookie_name + "=" + x.token;
let token_data = parseJwt(x.token);
window.location = "./apps/landing/landing.html";
} else {
window.alert("User not added");
window.location = "./apps/signup/signup";
}
});
}
}
}

function onFailure(error) {
console.error(error);
}

function renderButton() {
gapi.signin2.render('google-signin2', {
'scope': 'profile email',
'width': 240,
'height': 50,
'longtitle': true,
'theme': 'dark',
'onsuccess': onSuccess,
'onfailure': onFailure
});
}

function signOut() {
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut().then(function() {
console.log("User signed out.");
});
}

function deleteCookies() {
var allcookies = document.cookie.split(";");
for (var i = 0; i < allcookies.length; i++) {
var cookie = allcookies[i];
var eqPos = cookie.indexOf("=");
var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT;";
}
}

// google's jwk is here: https://www.googleapis.com/oauth2/v3/certs
function randomString(length) {
var bytes = new Uint8Array(length);
var random = window.crypto.getRandomValues(bytes);
var result = [];
var charset =
"0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._~";
random.forEach(function(c) {
result.push(charset[c % charset.length]);
});
return result.join('');
}
});
return result.join("");
}

function getUrlParam(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, '\\$&');
var regex = new RegExp('[?&#]' + name + '(=([^&#]*)|&|#|$)'),
function getUrlParam(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&#]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}

// get variables
let id_token = getUrlParam("id_token")
let state = getUrlParam("state")
if (!state){
state = default_redirect
}
// is this a login pre or post?
if (id_token){
document.cookie = cookie_name + "=" + id_token;
fetch("./auth/Token/check",
{headers: {
'Authorization': "Bearer " + id_token
}}
).then(x=>x.json()).then(x=>{
console.log("{id provider", id_token)
console.log("{auth service}", x)
if (x.hasOwnProperty('token')){
document.cookie = cookie_name + "=" + x.token;
window.location = state
} else {
console.error("please give me a better failure message/response")
window.alert("User not added")
window.location = "./apps/signup/signup"
if (!results) return null;
if (!results[2]) return "";
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
</script>

})
} else {
window.localStorage.setItem('nonce', randomString(16));
auth_url += "&state=" + state
auth_url += "&nonce=" + window.localStorage.getItem('nonce')
window.location = auth_url
}
</script>
<html>
<script src="https://apis.google.com/js/platform.js?onload=renderButton" async defer></script>

<script>

</script>
</body>
</html>
1 change: 1 addition & 0 deletions config/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"update":{"path": "/HeatmapEdit/delete/update", "attr": "write"}
},
"Auth": {
"list":"/Authorization/query/list",
"get":{"path": "/Authorization/query/getAuth", "attr": "admin"},
"post":{"path": "/Authorization/submit/json", "attr": "admin"}
},
Expand Down
2 changes: 2 additions & 0 deletions config/test_seed.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// To add the test data, run this against mongo, either by modifying the ca-idx script, or directly.
// To access mongo, either expose the port (not recommended for production) or run `docker exec -it ca-mongo mongo` then `use camic`
var slides = [{
"_id": new ObjectId("5bec456369056d7e537c2a9b"),
name: "CMU1",
Expand Down
29 changes: 29 additions & 0 deletions data_types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# caMicroscope Data Types
A description of data types for use with caMicroscope

## Files

### Slides
All slides should be openslide compatible, but not all formats seem to work consistently. SVS and TIF file extensions seem to work most reliably.

### TFJS Models and Weights
The prediction and segmentation applications can use a suitable tensorflow.js formatted model and weights to operate. [This guide](https://www.tensorflow.org/js/guide/save_load) may be useful for the generation of these files.

### Data Associated with Mongo
Segmentations, Heatmaps, annotations, and Templates are all primarily mongo documents, and are described in the next section. Use mongoexport or mongoimport in a `docker exec -it ca-mongo` context.

## Mongo Data and Metadata

### Slide Metadata
Slides are identified by their uuid, which is automatically generated. Slides have a display name `name`, a file location in context `location`, a measurement scale conversion factor in micrometers per pixel `mpp`, and `study` and `specimen` fields.

### Marks/Annotations
Marks are extended [geoJson](https://geojson.org/) formatted items with [viewport coordinates](https://openseadragon.github.io/examples/viewport-coordinates/). The geojson component is contained within `geometries`. `provenance` describes the source `provenance.analysis.source` and associated slide uuid `provenance.image.slide` of the mark, as well as the mark's execution id `provenance.analysis.execution_id`, and the mark's display name `provenance.analysis.name`. `properties` has any filled out information associated with an active template.

### Heatmaps
Heatmaps are data on a grid. `data` is a list of grid elements, in the format `[x position, y position, variable 1 value, *any additional values, if any*]`. The associated fields are stored `provenance.analysis.fields` in a list of items of format `{"name":"FIELDNAME", "range":[min,max]}`. The x and y positions are translated according to `provenance.analysis.coordinateSystem`. The associated slide, as with marks, is `provenance.image.slide`. The heatmap relative id is `provenance.image.execution_id`.

## Sample Data

### Mongo Data
See https://github.com/camicroscope/Distro/blob/master/config/test_seed.js
2 changes: 1 addition & 1 deletion develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ services:
build: "https://github.com/camicroscope/caMicroscope.git#develop"
container_name: ca-front
volumes:
- ./config/login.html:/var/www/html/login.html
- ./config/login.html:/usr/local/apache2/htdocs/login.html
loader:
build: "https://github.com/camicroscope/SlideLoader.git#develop"
container_name: ca-load
Expand Down
Loading

0 comments on commit 06228ae

Please sign in to comment.