Skip to content

Commit

Permalink
Merge branch 'master' into ilan-gold/geotiff_addition
Browse files Browse the repository at this point in the history
  • Loading branch information
ilan-gold authored Feb 4, 2020
2 parents 89ece6d + 1eb8a92 commit b717735
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions demo/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
content="A viewer for high bit depth, high resolution, multi-channel images"
/>
<!--
manifest.json provides metadata used when your web app is installed on a
Expand All @@ -21,7 +21,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>Viv Demo</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
8 changes: 4 additions & 4 deletions demo/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ export default class App extends PureComponent {
this.resize = this.resize.bind(this)
this.state = {
sliderValues:{
channel_0: 10000,
channel_1: 10000,
channel_2: 10000,
channel_3: 10000
channel_0: [0, 20000],
channel_1: [0, 20000],
channel_2: [0, 20000],
channel_3: [0, 20000]
},
colorValues:{
channel_0: [255, 0, 0],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class MicroscopyViewerLayer extends CompositeLayer {
: !this.state.connections && getZarrConnections({...this.props}).then((connections) => {
this.setState({connections})
})

}

renderLayers() {
Expand Down
16 changes: 7 additions & 9 deletions src/layers/xr-layer/xr-layer-fragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ uniform usampler2D channel4;
uniform usampler2D channel5;
// range
uniform float sliderValues[6];
uniform vec2 sliderValues[6];
// color
uniform vec3 colorValue0;
Expand Down Expand Up @@ -61,26 +61,24 @@ vec3 rgb2hsv(vec3 rgb) {
}
void main() {
float channel0Color = float(texture(channel0, vTexCoord).r) / sliderValues[0];
float channel1Color = float(texture(channel1, vTexCoord).r) / sliderValues[1];
float channel2Color = float(texture(channel2, vTexCoord).r) / sliderValues[2];
float channel3Color = float(texture(channel3, vTexCoord).r) / sliderValues[3];
float channel4Color = float(texture(channel4, vTexCoord).r) / sliderValues[4];
float channel5Color = float(texture(channel5, vTexCoord).r) / sliderValues[5];
float channel0Color = (float(texture(channel0, vTexCoord).r) - sliderValues[0][0]) / sliderValues[0][1];
float channel1Color = (float(texture(channel1, vTexCoord).r) - sliderValues[1][0]) / sliderValues[1][1];
float channel2Color = (float(texture(channel2, vTexCoord).r) - sliderValues[2][0]) / sliderValues[2][1];
float channel3Color = (float(texture(channel3, vTexCoord).r) - sliderValues[3][0]) / sliderValues[3][1];
float channel4Color = (float(texture(channel4, vTexCoord).r) - sliderValues[4][0]) / sliderValues[4][1];
float channel5Color = (float(texture(channel5, vTexCoord).r) - sliderValues[5][0]) / sliderValues[5][1];
vec3 rgbCombo = vec3(0.0);
vec3 hsvCombo = vec3(0.0);
float channelArray[6] = float[6](channel0Color, channel1Color, channel2Color, channel3Color, channel4Color, channel5Color);
vec3 colorValues[6] = vec3[6](colorValue0, colorValue1, colorValue2, colorValue3, colorValue4, colorValue5);
for(int i = 0; i < 6; i++) {
hsvCombo = rgb2hsv(vec3(colorValues[i]));
hsvCombo = vec3(hsvCombo.xy, channelArray[i]);
rgbCombo += hsv2rgb(hsvCombo);
}
color = vec4(rgbCombo, 1.0);
}
`;

0 comments on commit b717735

Please sign in to comment.