Skip to content

Commit

Permalink
WIP: Refactor study results local features
Browse files Browse the repository at this point in the history
  • Loading branch information
brianhelba committed Feb 28, 2017
1 parent 49fa6d4 commit f2a343e
Show file tree
Hide file tree
Showing 12 changed files with 236 additions and 250 deletions.
299 changes: 124 additions & 175 deletions web_external/StudyResults/StudyResultsView.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion web_external/StudyResults/studyResultsImagePage.jade

This file was deleted.

3 changes: 0 additions & 3 deletions web_external/StudyResults/studyResultsImagePage.styl

This file was deleted.

24 changes: 9 additions & 15 deletions web_external/StudyResults/studyResultsLocalFeaturesPage.jade
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
- var hasFeaturesClass = hasLocalFeatures ? '' : 'hidden';
- var noFeaturesClass = hasLocalFeatures ? 'hidden' : '';

.isic-study-results-local-features-content(class=noFeaturesClass)
span N/A

.isic-study-results-local-features-content(class=hasFeaturesClass)
#isic-study-results-select-local-feature-container
.isic-study-results-local-features-legend
.isic-study-results-local-features-legend-possible
i ■
span 50% confidence
.isic-study-results-local-features-legend-definite
i ■
span 100% confidence
#isic-study-results-local-features-select-container
.isic-study-results-local-features-legend
.isic-study-results-local-features-legend-possible
i ■
span 50% confidence
.isic-study-results-local-features-legend-definite
i ■
span 100% confidence
#isic-study-results-local-features-image-container
37 changes: 19 additions & 18 deletions web_external/StudyResults/studyResultsLocalFeaturesPage.styl
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
.isic-study-results-local-features-content
display flex

&>span
margin-left 20px
#isic-study-results-local-features-select-container
flex 1

.isic-study-results-local-features-legend
margin-top 10px
.isic-study-results-local-features-legend
margin-top 10px

&>div
display inline
margin-left 20px
&>div
display inline
margin-left 20px

.isic-study-results-local-features-legend-possible
i
color #fafa00
.isic-study-results-local-features-legend-possible
i
color #fafa00

.isic-study-results-local-features-legend-definite
i
color #0000ff
.isic-study-results-local-features-legend-definite
i
color #0000ff

#isic-study-results-local-features-image-container
margin-top 5px

#isic-study-results-select-local-feature-container
display flex
flex 1
min-width 640px
min-height 480px
object-fit contain
width 100%
height 100%
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.isic-study-results-local-features-select-container
// For select2, add width in style attribute, see https://select2.github.io/examples.html#responsive
select#isic-study-results-local-features-select-box.form-control.input(style='width:100%')
option(selected disabled value='')
each feature in availableFeatures
option(value=feature.id)= feature.name.join(', ')
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.isic-study-results-select-local-features-container
.isic-study-results-local-features-select-container

select
// Note that this might not apply, see https://select2.github.io/examples.html#responsive
Expand Down
10 changes: 0 additions & 10 deletions web_external/StudyResults/studyResultsPage.jade
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,3 @@
#isic-study-results-global-features-container

.tab-pane#isic-study-results-local-features-tab-content
#isic-study-results-local-features-container

// Container for images associated with tabs. Visibility is controlled by logic in StudyResultsView.js.
.isic-study-results-flex-grow.isic-study-results-image-container

// Local features image container
.isic-study-results-flex-grow.hidden#isic-study-results-local-features-image-container

// Image preview container
.isic-study-results-flex-grow#isic-study-results-image-preview-container
24 changes: 4 additions & 20 deletions web_external/StudyResults/studyResultsPage.styl
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@
#isic-study-results-main-container
overflow hidden

.isic-study-results-image-container
overflow auto
display flex
flex-flow column

#isic-study-results-select-image-container
min-width 155px
overflow auto
Expand All @@ -42,25 +37,14 @@
#isic-study-results-select-user-container
margin-bottom 10px

#isic-study-results-image-preview-container
#isic-study-results-local-features-image-container
display flex

.isic-study-results-image-preview-container
flex 1

.isic-study-results-image
flex 1
min-width 640px
min-height 480px
object-fit contain
width 100%
height 100%

.nav
li
a
padding 5px 10px

.tab-content
padding-top 3px
height 100%

.tab-pane
height 100%

This file was deleted.

64 changes: 64 additions & 0 deletions web_external/common/Viewer/ImageViewerWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,69 @@ isic.views.ImageViewerWidget = isic.View.extend({

isic.View.prototype.destroy.call(this);
}
});

isic.views.OverlayImageViewerWidget = isic.views.ImageViewerWidget.extend({
State: {
ABSENT: 0.0,
POSSIBLE: 0.5,
DEFINITE: 1.0
},

_createViewer: function () {
isic.views.ImageViewerWidget.prototype._createViewer.call(this);

this.annotationLayer = this.viewer.createLayer('feature', {
features: ['pixelmap']
});
this.pixelmap = this.annotationLayer.createFeature('pixelmap', {
selectionAPI: true,
url: girder.apiRoot + '/image/' + this.model.id + '/superpixels',
position: {
ul: {x: 0, y: 0},
lr: {x: this.sizeX, y: this.sizeY}
},
color: _.bind(function (dataValue, index) {
var color = {r: 0, g: 0, b: 0, a: 0};
var shownAlpha = 0.4;

if (dataValue === this.State.ABSENT) {
// This could be semi-transparent, to show "definite negative" tiles
color.a = 0.0;
} else if (dataValue === this.State.POSSIBLE) {
color = window.geo.util.convertColor('#fafa00');
color.a = shownAlpha;
} else if (dataValue === this.State.DEFINITE) {
color = window.geo.util.convertColor('#0000ff');
color.a = shownAlpha;
}
// TODO: else, log error
return color;
}, this)
});
this.annotationLayer.draw();
this.clear();
},

/**
* Remove all displayed overlays.
*/
clear: function () {
this.pixelmap.data([]);
this.pixelmap.visible(false);
this.pixelmap.draw();

this.pixelmap.geoOff();
},

/**
* Display a single view-only feature on the viewer.
*/
overlay: function (featureValues) {
this.clear();

this.pixelmap.data(featureValues);
this.pixelmap.visible(true);
this.pixelmap.draw();
}
});
10 changes: 9 additions & 1 deletion web_external/models/AnnotationModel.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
isic.models.AnnotationModel = girder.Model.extend({
resourceName: 'annotation'
resourceName: 'annotation',

isComplete: function () {
return this.get('state') === 'complete';
},

image: function () {
return new isic.models.ImageModel(this.get('image'));
}
});

0 comments on commit f2a343e

Please sign in to comment.