Skip to content

Commit

Permalink
Merge pull request #450 from camicroscope/develop
Browse files Browse the repository at this point in the history
For 3.8.1
  • Loading branch information
birm committed Oct 5, 2020
2 parents e7b6fa5 + 8c11858 commit 629cb3d
Show file tree
Hide file tree
Showing 11 changed files with 88 additions and 21 deletions.
7 changes: 6 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* **Version 1**
* [1.0.x](#camicroscope-10)

### caMicroscope [Unreleased](https://github.com/camicroscope/camicroscope/compare/v3.8.0...camicroscope:develop)
### caMicroscope [Unreleased](https://github.com/camicroscope/camicroscope/compare/v3.8.1...camicroscope:develop)
###### TBD
* TBD

### caMicroscope [3.8.1](https://github.com/camicroscope/camicroscope/compare/v3.8.0...camicroscope:v3.8.1)
###### 2020-10-05
* Added baked-in default annotation schema
* Loader Bugfix

### caMicroscope [3.8.0](https://github.com/camicroscope/camicroscope/compare/v3.7.7...camicroscope:v3.8.0)
###### 2020-09-04
* Incorperation of the Machine Learning Development Workbench (GSOC 2020 @akhil-rana) [#438](https://github.com/camicroscope/caMicroscope/pull/438)
Expand Down
5 changes: 2 additions & 3 deletions apps/loader/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ function changeStatus(step, text, reset=true) {
// Reset the status bar
console.log('Previous: ', document.getElementById('load_status').innerHTML);
document.getElementById('load_status').innerHTML='';

// Display JSON as table:
if (typeof text === 'object') { // If the text arg is a JSON
var col = []; // List of column headers
Expand Down Expand Up @@ -51,7 +50,7 @@ function changeStatus(step, text, reset=true) {
tr = table.insertRow(-1);
for (var j = 0; j < col.length; j++) {
var tabCell = tr.insertCell(-1);
if (text[col[j]].length>65&&step == 'CHECK') {
if (text[col[j]] && text[col[j]].length>65&&step == 'CHECK') {
tabCell.innerHTML= `${text[col[j]].substr(0, 65)}<span class="collapse" id="more-${j}">
${text[col[j]].substr(65)} </span>
<span><a href="#more-${j}" data-toggle="collapse">... <i class="fa fa-caret-down"></i></span>`;
Expand Down Expand Up @@ -127,7 +126,7 @@ function handleDownload(id) {
throw new Error('Slide not found');
}
}).then((location) => {
fileName= location.substring(location.lastIndexOf('/')+1, location.length);
fileName = location.substring(location.lastIndexOf('/')+1, location.length);
console.log(fileName);
return fileName;
}).then((fileName) =>{
Expand Down
14 changes: 10 additions & 4 deletions apps/convert/index.html → apps/port/index.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<script src="../../core/Store.js"></script>
<script src="./port.js"></script>
<script src="./xml2geo.js"></script>
<link rel="stylesheet" href="./style.css">
<title>Import and Export [caMicroscope]</title>
</head>
<body>
<h1>Convert Annotations from XML</h1>
<h1>Import Annotations</h1>
<h3>Info</h3>
<div class="form">
<label for="slide_id">Slide Id:</label>
<input type="text" id="slide_id" name="slide_id"><br>
<label for="annot_name">Annotation Name:</label>
<input type="text" id="annot_name" name="annot_name"><br>
<h3>File Contents</h3>
<label for="annot_name">XML Contents:</label>
<textarea id="xml_in" name="input" rows="10" cols="30"></textarea><br>
<button id="convert_btn" onclick="xml2geo()" type="button">Convert</button>
<label for="annot_name">Input:</label>
<textarea id="input" name="input" rows="10" cols="30"></textarea><br>
<button id="convert_btn" onclick="xml2geo()" type="button">Convert from XML</button>
<button id="prepare_btn" onclick="prepareAnnot()" type="button">Prepare JSON</button>
</div>
<br><br>
<h3>Output</h3>
<textarea id="output" rows="10" cols="30"></textarea>
<br>
<button id="post_btn" onclick="saveAnnot()" type="button">Post</button>
</body>
</html>
22 changes: 22 additions & 0 deletions apps/port/port.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const store = new Store('../../data');

function prepareAnnot() {
try {
let output = JSON.parse(document.getElementById('input'));
output['provenance']['image']['slide'] = document.getElementById('slide_id').value;
output['provenance']['analysis']['execution'] = document.getElementById('annot_name').value;
output['properties']['annotations']['name'] = document.getElementById('annot_name').value;
} catch (e) {
alert(e);
}
document.getElementById('output').innerHTML = JSON.stringify(output);
}

function saveAnnot() {
try {
let doc = JSON.parse(document.getElementById('output'));
} catch (e) {
alert(e);
}
store.addMark(doc).then((x)=>alert('done!')).catch((e)=>alert(e));
}
File renamed without changes.
1 change: 1 addition & 0 deletions apps/convert/xml2geo.js → apps/port/xml2geo.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var template = {
'source': 'human',
'execution_id': 'TEMPLATE',
'name': 'TEMPLATE',
'coordinate': 'image',
},
},
'properties': {
Expand Down
31 changes: 29 additions & 2 deletions components/operationpanel/operationpanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,35 @@ function OperationPanel(options) {
// check form schema
if (!this.setting.formSchemas || this.setting.formSchemas.length == 0) {
// console.error(`${this.name}:No Form Schema ...`);
this.elt.textContent = `${this.name}:No Form Schema ...`;
return;
// this.elt.textContent = `${this.name}:No Form Schema ...`;
this.setting.formSchemas = [{
'_id': '0',
'type': 'object',
'id': 'annotation-form',
'name': 'AnnotSchema',
'description': '',
'links': [

],
'additionalProperties': false,
'properties': {
'name': {
'id': 'a0',
'title': 'Identity Name',
'type': 'string',
'required': true,
'description': 'note name',
},
'notes': {
'id': 'a1',
'title': 'Notes: ',
'type': 'string',
'format': 'textarea',
'maxLength': 128,
},
},
}];
// return;
}
if (!this.setting.action || !this.setting.action.callback) {
// console.error(`${this.name}:No Action ...`);
Expand Down
14 changes: 12 additions & 2 deletions core/extension/openseadragon-canvas-draw-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,10 @@
type: "Point",
coordinates: [...point]
},
bound: [...point]
bound: {
type: "Point",
coordinates: [...point]
}
};
return;
}
Expand All @@ -710,6 +713,13 @@
: "Polygon",
coordinates: [[point]],
path: null
},
bound: {
type:
this.drawMode === "line" || this.drawMode === "grid"
? "LineString"
: "Polygon",
coordinates: [[point]]
}
};

Expand Down Expand Up @@ -841,7 +851,7 @@
}
}
// create bounds
this._current_path_.bound = getBounds(
this._current_path_.bound.coordinates[0] = getBounds(
this._current_path_.geometry.coordinates[0]
);

Expand Down
3 changes: 0 additions & 3 deletions core/extension/osd-heatmap-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,9 +696,6 @@
finalData = this.__thresholdingData();
// set patch color
this._display_ctx_.fillStyle = this._color;
// get the patch's size on the screen
//const w = logicalToPhysicalDistanceX(this._size[0],this._viewer.imagingHelper);
//const h = logicalToPhysicalDistanceY(this._size[1],this._viewer.imagingHelper);

// start to draw each patch
this._display_ctx_.beginPath();
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"description": "",
"scripts": {
"test": "mocha test --recursive",
"lint": "eslint ./core/*.js ./components/**/*.js ./apps/*.js ./apps/convert/*.js ./apps/heatmap/*.js ./apps/labeling/*.js ./apps/loader/*.js ./apps/model/*.js ./apps/segment/*.js ./apps/model/**/*.js ./apps/segment/**/*.js ./apps/viewer/*.js --quiet",
"lint-fix": "eslint ./core/*.js ./components/**/*.js ./apps/*.js ./apps/convert/*.js ./apps/heatmap/*.js ./apps/labeling/*.js ./apps/loader/*.js ./apps/model/*.js ./apps/segment/*.js ./apps/model/**/*.js ./apps/segment/**/*.js ./apps/viewer/*.js --quiet --fix"
"lint": "eslint ./core/*.js ./components/**/*.js ./apps/*.js ./apps/port/*.js ./apps/heatmap/*.js ./apps/labeling/*.js ./apps/loader/*.js ./apps/model/*.js ./apps/segment/*.js ./apps/model/**/*.js ./apps/segment/**/*.js ./apps/viewer/*.js --quiet",
"lint-fix": "eslint ./core/*.js ./components/**/*.js ./apps/*.js ./apps/port/*.js ./apps/heatmap/*.js ./apps/labeling/*.js ./apps/loader/*.js ./apps/model/*.js ./apps/segment/*.js ./apps/model/**/*.js ./apps/segment/**/*.js ./apps/viewer/*.js --quiet --fix"
},
"author": "",
"license": "NONE",
Expand Down
8 changes: 4 additions & 4 deletions test/ui/operationpanel-test-cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ describe('Operation Panel Component',function(){
// multipleElt = dom.window.document.getElementById('multiple');
// });
// Options Error: No Schema Error
it('Options Error: No Schema Error', function () {
let error = dom.window.document.getElementById('error1');
assert.equal(error.textContent,'OperationPanel:No Form Schema ...');
});
// it('Options Error: No Schema Error', function () {
// let error = dom.window.document.getElementById('error1');
// assert.equal(error.textContent,'OperationPanel:No Form Schema ...');
// });

// Options Error: No Action Error
it('Options Error: No Action Error', function () {
Expand Down

0 comments on commit 629cb3d

Please sign in to comment.