+
Y
Min
Max
+
-
@@ -407,7 +426,7 @@
Preview
Run
-
+
@@ -2785,10 +2804,22 @@ Backend
int32:THREE.IntType,
float32:THREE.FloatType
};
- const dim=volume.shape;
- const buf=nj.array(volume.transpose().flatten().selection.data, 'float32');
+ lastvolumedim=volume.shape;
+ const dim=lastvolumedim;
- const texture = new THREE.DataTexture3D( buf.selection.data, dim[0], dim[1], dim[2]);
+ $("#cross-t").prop( "disabled", true );
+
+ if(dim.length > 3 && dim[3] > 0) {
+ $('#cross-t').prop('min', 0);
+ $('#cross-t').prop('max', dim[3]-1);
+ $('#cross-t').val(0);
+ $("#cross-t").prop( "disabled", false );
+ $("#cross-t").prop('title', ''+$("#cross-t").val()+' ['+$("#cross-t").prop('min')+','+$("#cross-t").prop('max')+']');
+ }
+
+ lastvolumedata=nj.array(volume.transpose().flatten().selection.data, 'float32');
+
+ const texture = new THREE.DataTexture3D( lastvolumedata.selection.data, dim[0], dim[1], dim[2]);
texture.format = THREE.RedFormat;
texture.type = THREE.FloatType;
texture.minFilter = texture.magFilter = THREE.LinearFilter;
@@ -2827,6 +2858,10 @@ Backend
$("#clim-hi").prop('max',lastclim.y);
$("#clim-hi").val(lastclim.y);
+ $("#x_thickness").prop('max',dim[0]);
+ $("#y_thickness").prop('max',dim[1]);
+ $("#z_thickness").prop('max',dim[2]);
+
const material = new THREE.ShaderMaterial( {
uniforms: uniforms,
vertexShader: shader.vertexShader,
@@ -2986,7 +3021,7 @@ Backend
success: function( data ){
},
error: function(xhr,status,error) {
- alert("searchpub error: "+status);
+ alert("searchpub error: "+status + ". The selected server is down. Please choose an alternative server from the 'Choose server' menu.");
}
});
}
@@ -3035,7 +3070,26 @@ Backend
storage.userinfo = JSON.stringify({ fullname: $("#fullname").val(), inst: $("#inst").val(), email: $("#email").val(), netname: $("#netname").val()});
}
-function setcrosssectionsizes() {
+function setcrosssectionsizes(e) {
+ let eid=$(e).attr('id');
+ let deltaeid=eid.replace('cross-','').replace(/-(low|hi)$/,'_thickness');
+ let dvalue=parseInt($('#'+deltaeid).val());
+
+ if(dvalue>0) {
+ let othereid='';
+ dvalue /= (eid.match(/-x-/) ? lastvolumedim[0] : (eid.match(/-y-/) ? lastvolumedim[1]: lastvolumedim[2]));
+
+ if(eid.match(/-low/)) {
+ othereid='#'+eid.replace(/-low$/, '-hi');
+ $(othereid).val(Math.min(parseFloat($(e).val())+dvalue, 1))
+ } else {
+ othereid='#'+eid.replace(/-hi$/, '-low');
+ $(othereid).val(Math.max(parseFloat($(e).val())-dvalue, 0))
+ }
+ $(othereid).prop('title', ''+$(othereid).val()+' ['+$(othereid).prop('min')+','+$(othereid).prop('max')+']');
+ }
+
+ $(e).prop('title', ''+$(e).val()+' ['+$(e).prop('min')+','+$(e).prop('max')+']');
if(lastvolume !== null){
lastvolume.material.uniforms[ "u_minslice" ].value.set( parseFloat($("#cross-x-low").val()), parseFloat($("#cross-y-low").val()), parseFloat($("#cross-z-low").val()) );
lastvolume.material.uniforms[ "u_maxslice" ].value.set( parseFloat($("#cross-x-hi").val()), parseFloat($("#cross-y-hi").val()), parseFloat($("#cross-z-hi").val()) );
@@ -3138,6 +3192,8 @@ Backend
document.getElementById('renderpanel').appendChild( stats.domElement );
var lastvolume=null;
+var lastvolumedim=[];
+var lastvolumedata=null;
var lastloaded=null;
var lastclim=0;
var reqid=undefined;
@@ -3206,27 +3262,58 @@ Backend
});
$("#cross-x-low").on('input', function() {
- setcrosssectionsizes();
+ setcrosssectionsizes(this);
});
$("#cross-y-low").on('input', function() {
- setcrosssectionsizes();
+ setcrosssectionsizes(this);
});
$("#cross-z-low").on('input', function() {
- setcrosssectionsizes();
+ setcrosssectionsizes(this);
});
$("#cross-x-hi").on('input', function() {
- setcrosssectionsizes();
+ setcrosssectionsizes(this);
});
$("#cross-y-hi").on('input', function() {
- setcrosssectionsizes();
+ setcrosssectionsizes(this);
});
$("#cross-z-hi").on('input', function() {
- setcrosssectionsizes();
+ setcrosssectionsizes(this);
+});
+
+$("#x_thickness, #y_thickness, #z_thickness").on('input', function() {
+ let eid=$(this).attr('id');
+ let linkedeid1=eid.replace(/_thickness/,'-low').replace(/^/,'cross-');
+ let linkedeid2=eid.replace(/_thickness/,'-hi').replace(/^/,'cross-');
+ if($(this).val() == 0) {
+ $('#'+linkedeid1).val(0);
+ $('#'+linkedeid2).val(1);
+ } else {
+ $('#'+linkedeid1).val(($('#'+linkedeid1).val() + $('#'+linkedeid2).val())*0.5);
+ }
+ setcrosssectionsizes($('#'+linkedeid1));
+});
+
+$('#cross-t').on('mouseup', function() {
+ $(this).prop('title', ''+$(this).val()+' ['+$(this).prop('min')+','+$(this).prop('max')+']');
+ if(lastvolume !== null && lastvolumedata !== undefined){
+ let dim = lastvolumedim;
+ let offset=$(this).val()*dim[0]*dim[1]*dim[2];
+
+ let texture = new THREE.DataTexture3D(lastvolumedata.selection.data.slice(offset, offset+dim[0]*dim[1]*dim[2]), dim[0], dim[1], dim[2]);
+ texture.format = THREE.RedFormat;
+ texture.type = THREE.FloatType;
+ texture.minFilter = texture.magFilter = THREE.LinearFilter;
+ texture.unpackAlignment = 1;
+ texture.needsUpdate = true;
+
+ lastvolume.material.uniforms[ "u_data" ].value = texture;
+ renderer.updateComplete = false;
+ }
});
function setControlAngles(polar, azimuth) {
@@ -3245,6 +3332,10 @@ Backend
controls.maxPolarAngle = mxp;
}
+$('#submitserver').on('change', function() {
+ serverurl="https://"+$(this).val()+".coe.neu.edu/mcxcloud/mcxserver.cgi";
+})
+
$("#pos-x-view").on('click', function() {
setControlAngles(Math.PI * 90 / 180, Math.PI * 90 / 180);
});