@@ -98,15 +98,12 @@ function destroyPreview() {
9898
9999function drawpreview ( cfg ) {
100100 // xyzscale = undefined; // add for test
101- console . log ( "🛠️ Rendering in drawpreview()" ) ;
102- console . log ( "🟢 Data received:" , cfg ) ;
101+ // console.log("🟢 Data received:", cfg);
103102 initcanvas ( ) ;
104103
105104 scene . remove . apply ( scene , scene . children ) ;
106105 if ( cfg . hasOwnProperty ( "Shapes" ) ) {
107- console . log ( "📦 Drawing Shapes..." ) ;
108106 if ( cfg . Shapes instanceof nj . NdArray ) {
109- console . log ( "🟢 Detected NumJS Array. Calling drawvolume()" ) ;
110107 if ( isWebGL2Available ( ) ) {
111108 let box = { Grid : { Size : cfg . Shapes . shape } } ;
112109 drawshape ( box , 0 ) ;
@@ -136,26 +133,26 @@ function drawpreview(cfg) {
136133 } else {
137134 if ( cfg . hasOwnProperty ( "MeshNode" ) && cfg . hasOwnProperty ( "MeshSurf" ) ) {
138135 if ( cfg . MeshNode instanceof nj . NdArray ) {
139- console . log ( "✅ Rendering MeshNode & MeshSurf!" ) ;
140- console . log ( "🔍 Rendering MeshNode & MeshSurf!" ) ;
141- console . log ( "📌 MeshNode Data:" , cfg . MeshNode ) ;
142- console . log ( "📌 MeshSurf Data:" , cfg . MeshSurf ) ;
143- console . log ( "📌 MeshNode Shape:" , cfg . MeshNode . shape ) ;
144- console . log ( "📌 MeshSurf Shape:" , cfg . MeshSurf . shape ) ;
136+ // console.log("✅ Rendering MeshNode & MeshSurf!");
137+ // console.log("🔍 Rendering MeshNode & MeshSurf!");
138+ // console.log("📌 MeshNode Data:", cfg.MeshNode);
139+ // console.log("📌 MeshSurf Data:", cfg.MeshSurf);
140+ // console.log("📌 MeshNode Shape:", cfg.MeshNode.shape);
141+ // console.log("📌 MeshSurf Shape:", cfg.MeshSurf.shape);
145142 drawsurf ( cfg . MeshNode , cfg . MeshSurf ) ;
146143 } else {
147144 if ( cfg . MeshNode . hasOwnProperty ( "_ArraySize_" ) ) {
148145 let nodesize = cfg . MeshNode . _ArraySize_ ;
149146 let surfsize = cfg . MeshSurf . _ArraySize_ ;
150147 let jd = new jdata ( cfg , { } ) ;
151148 cfg = jd . decode ( ) . data ;
152- console . log ( "🔄 Converting MeshNode & MeshSurf to ndarrays..." ) ;
149+ // console.log("🔄 Converting MeshNode & MeshSurf to ndarrays...");
153150 drawsurf (
154151 nj . array ( cfg . MeshNode , "float32" ) ,
155152 nj . array ( cfg . MeshSurf , "uint32" )
156153 ) ;
157154 } else {
158- console . log ( "🔄 Converting MeshNode & MeshSurf from plain arrays..." ) ;
155+ // console.log("🔄 Converting MeshNode & MeshSurf from plain arrays...");
159156 drawsurf (
160157 nj
161158 . array ( Array . from ( cfg . MeshNode ) , "float32" )
@@ -241,13 +238,13 @@ function drawpreview(cfg) {
241238}
242239
243240function previewdata ( key , idx , isinternal , hastime ) {
244- console . log ( "📦 previewdata() input:" , {
245- key,
246- idx,
247- isinternal,
248- intdata : window . intdata ,
249- } ) ;
250- console . log ( "key in previewdata" , key ) ;
241+ // console.log("📦 previewdata() input:", {
242+ // key,
243+ // idx,
244+ // isinternal,
245+ // intdata: window.intdata,
246+ // });
247+ // console.log("key in previewdata", key);
251248 if ( ! hasthreejs ) {
252249 $ . when (
253250 $ . getScript ( "https://mcx.space/cloud/js/OrbitControls.js" ) ,
@@ -257,21 +254,19 @@ function previewdata(key, idx, isinternal, hastime) {
257254 ) . done ( function ( ) {
258255 hasthreejs = true ;
259256 dopreview ( key , idx , isinternal , hastime ) ;
260- console . log ( "into the previewdata function if" ) ;
261257 } ) ;
262258 } else {
263259 dopreview ( key , idx , isinternal , hastime ) ;
264- console . log ( "into the previewdata function else" ) ;
265260 }
266261}
267262
268263function dopreview ( key , idx , isinternal , hastime ) {
269- console . log ( "🧪 dopreview input:" , {
270- key,
271- idx,
272- isinternal,
273- intdata : intdata [ idx ] ,
274- } ) ;
264+ // console.log("🧪 dopreview input:", {
265+ // key,
266+ // idx,
267+ // isinternal,
268+ // intdata: intdata[idx],
269+ // });
275270 let ndim = 0 ;
276271
277272 if ( hastime === undefined ) hastime = [ ] ;
@@ -281,7 +276,7 @@ function dopreview(key, idx, isinternal, hastime) {
281276 if ( window . intdata && window . intdata [ idx ] && window . intdata [ idx ] [ 2 ] ) {
282277 dataroot = window . intdata [ idx ] [ 2 ] ;
283278 } else {
284- console . error ( "❌ Internal data not ready for index" , idx ) ;
279+ // console.error("❌ Internal data not ready for index", idx);
285280 return ;
286281 }
287282 } else {
@@ -291,15 +286,15 @@ function dopreview(key, idx, isinternal, hastime) {
291286 if ( window . extdata && window . extdata [ idx ] && window . extdata [ idx ] [ 2 ] ) {
292287 if ( typeof key === "object" ) {
293288 dataroot = key ;
294- console . log ( "if key is object" , typeof key ) ;
289+ // console.log("if key is object", typeof key);
295290 } else {
296291 dataroot = window . extdata [ idx ] [ 2 ] ;
297- console . log ( "type of key" , typeof key ) ;
292+ // console.log("type of key", typeof key);
298293 }
299294
300295 // dataroot = key;
301296
302- console . log ( "into dopreview external data's dataroot" , dataroot ) ;
297+ // console.log("into dopreview external data's dataroot", dataroot);
303298 } else {
304299 console . error ( "❌ External data not ready for index" , idx ) ;
305300 return ;
@@ -319,9 +314,9 @@ function dopreview(key, idx, isinternal, hastime) {
319314 dataroot = window . extdata [ idx ] [ 2 ] ;
320315 }
321316 } else if ( dataroot instanceof nj . NdArray ) {
322- console . log ( "dataroot before ndim" , dataroot ) ;
317+ // console.log("dataroot before ndim", dataroot);
323318 ndim = dataroot . shape . length ;
324- console . log ( "ndim" , ndim ) ;
319+ // console.log("ndim", ndim);
325320 }
326321
327322 if ( ndim < 3 && ndim > 0 ) {
@@ -346,16 +341,16 @@ function dopreview(key, idx, isinternal, hastime) {
346341 '<h4>Data preview</h4><a href="javascript:void(0)" class="closebtn" onclick="$(\'#chartpanel\').hide()" title="Close">×</a><div id="plotchart"></div>'
347342 ) ;
348343 if ( dataroot instanceof nj . NdArray ) {
349- console . log ( "dataroot" , dataroot ) ;
344+ // console.log("dataroot", dataroot);
350345 if ( dataroot . shape [ 0 ] > dataroot . shape [ 1 ] )
351346 dataroot = dataroot . transpose ( ) ;
352- console . log ( "is nj.NdArray:" , dataroot instanceof nj . NdArray ) ;
353- console . log ( "dtype:" , dataroot . dtype ) ;
354- console . log ( "shape:" , dataroot . shape ) ;
355- console . log ( "size:" , dataroot . size ) ;
347+ // console.log("is nj.NdArray:", dataroot instanceof nj.NdArray);
348+ // console.log("dtype:", dataroot.dtype);
349+ // console.log("shape:", dataroot.shape);
350+ // console.log("size:", dataroot.size);
356351
357352 let plotdata = dataroot . tolist ( ) ;
358- console . log ( "plotdata" , plotdata ) ;
353+ // console.log("plotdata", plotdata);
359354 if ( hastime . length == 0 ) {
360355 if ( plotdata [ 0 ] instanceof Array )
361356 plotdata . unshift ( [ ...Array ( plotdata [ 0 ] . length ) . keys ( ) ] ) ;
@@ -383,14 +378,12 @@ function dopreview(key, idx, isinternal, hastime) {
383378 : hastime [ i ] ;
384379 }
385380 let u = new uPlot ( opts , plotdata , document . getElementById ( "plotchart" ) ) ;
386- console . log ( "first u" , u ) ;
387381 } else {
388382 let u = new uPlot (
389383 opts ,
390384 [ [ ...Array ( dataroot . length ) . keys ( ) ] , dataroot ] ,
391385 document . getElementById ( "plotchart" )
392386 ) ;
393- console . log ( "second u" , u ) ;
394387 }
395388 // add spinner
396389 // --- NEW LOGIC for 2D plot ---
@@ -542,7 +535,7 @@ function drawshape(shape, index) {
542535 wireframe : true ,
543536 transparent : true ,
544537 } ) ;
545- console . log ( "📌 Mesh Material:" , material ) ;
538+ // console.log("📌 Mesh Material:", material);
546539 obj = new THREE . Mesh ( geometry , material ) ;
547540 obj . position . set ( shape . Sphere . O [ 0 ] , shape . Sphere . O [ 1 ] , shape . Sphere . O [ 2 ] ) ;
548541 boundingbox . add ( obj ) ;
@@ -576,7 +569,7 @@ function drawshape(shape, index) {
576569 wireframe : true ,
577570 transparent : false ,
578571 } ) ;
579- console . log ( "📌 Mesh Material:" , material ) ;
572+ // console.log("📌 Mesh Material:", material);
580573 obj = new THREE . Mesh ( geometry , material ) ;
581574 boundingbox . add ( obj ) ;
582575 break ;
@@ -591,11 +584,11 @@ function mulberry32(a) {
591584}
592585
593586function drawsurf ( node , tri ) {
594- console . log ( "🔷 Inside drawsurf()" ) ;
595- console . log ( "📌 Received MeshNode:" , node ) ;
596- console . log ( "📌 Received MeshSurf:" , tri ) ;
597- console . log ( "📌 MeshNode Shape:" , node . shape ) ;
598- console . log ( "📌 MeshSurf Shape:" , tri . shape ) ;
587+ // console.log("🔷 Inside drawsurf()");
588+ // console.log("📌 Received MeshNode:", node);
589+ // console.log("📌 Received MeshSurf:", tri);
590+ // console.log("📌 MeshNode Shape:", node.shape);
591+ // console.log("📌 MeshSurf Shape:", tri.shape);
599592 $ ( "#mip-radio-button,#iso-radio-button,#interp-radio-button" ) . prop (
600593 "disabled" ,
601594 true
@@ -621,14 +614,14 @@ function drawsurf(node, tri) {
621614 side : THREE . DoubleSide ,
622615 wireframe : false ,
623616 } ) ;
624- console . log ( "📌 Mesh Material:" , material ) ;
617+ // console.log("📌 Mesh Material:", material);
625618 lastvolume = new THREE . Mesh ( geometry , material ) ;
626619 scene . add ( lastvolume ) ;
627620
628- console . log ( "🟢 Mesh Added to Scene:" , lastvolume ) ;
629- console . log ( "📌 Mesh Position:" , lastvolume . position ) ;
630- console . log ( "📌 Mesh Bounding Box:" , lastvolume . geometry . boundingBox ) ;
631- console . log ( "📌 Mesh Bounding Sphere:" , lastvolume . geometry . boundingSphere ) ;
621+ // console.log("🟢 Mesh Added to Scene:", lastvolume);
622+ // console.log("📌 Mesh Position:", lastvolume.position);
623+ // console.log("📌 Mesh Bounding Box:", lastvolume.geometry.boundingBox);
624+ // console.log("📌 Mesh Bounding Sphere:", lastvolume.geometry.boundingSphere);
632625
633626 var geo = new THREE . WireframeGeometry ( lastvolume . geometry ) ;
634627 var mat = new THREE . LineBasicMaterial ( { color : 0x666666 } ) ;
@@ -656,11 +649,11 @@ function drawsurf(node, tri) {
656649
657650 boundingbox . add ( lastvolume ) ;
658651
659- console . log ( "👁 Camera Pos:" , camera . position ) ;
660- console . log ( "👁 Controls Target:" , controls . target ) ;
661- console . log ( "👁 Mesh Pos:" , lastvolume . position ) ;
662- console . log ( "👁 Bounding Sphere:" , geometry . boundingSphere ) ;
663- console . log ( "👁 Canvas size:" , canvas . width ( ) , canvas . height ( ) ) ;
652+ // console.log("👁 Camera Pos:", camera.position);
653+ // console.log("👁 Controls Target:", controls.target);
654+ // console.log("👁 Mesh Pos:", lastvolume.position);
655+ // console.log("👁 Bounding Sphere:", geometry.boundingSphere);
656+ // console.log("👁 Canvas size:", canvas.width(), canvas.height());
664657}
665658
666659function resetscene ( s ) {
@@ -916,7 +909,6 @@ function initcanvas() {
916909 }
917910
918911 if ( renderer ) {
919- console . log ( "♻️ Resetting renderer and canvas..." ) ;
920912 renderer . dispose ( ) ;
921913 $ ( "#canvas" ) . empty ( ) ;
922914 }
@@ -943,7 +935,7 @@ function initcanvas() {
943935 renderer . setPixelRatio ( window . devicePixelRatio ) ;
944936 renderer . setSize ( canvas . width ( ) , canvas . height ( ) ) ;
945937 canvas . append ( renderer . domElement ) ;
946- console . log ( "✅ <canvas> appended:" , renderer . domElement ) ;
938+ // console.log("✅ <canvas> appended:", renderer.domElement);
947939
948940 controls = new THREE . OrbitControls ( camera , renderer . domElement ) ;
949941 controls . minZoom = 0.5 ;
@@ -1721,8 +1713,8 @@ function update() {
17211713}
17221714
17231715function previewdataurl ( url , idx ) {
1724- console . log ( "🌍 Fetching external data from:" , url ) ;
1725- console . log ( "🔍 Index:" , idx ) ;
1716+ // console.log("🌍 Fetching external data from:", url);
1717+ // console.log("🔍 Index:", idx);
17261718
17271719 // if (!/\.(nii|nii\.gz|jdt|jdb|bmsh|jmsh|bnii|gz)$/i.test(url)) {
17281720 if ( ! / f i l e = .* \. ( n i i ( \. g z ) ? | j d t | j d b | b m s h | j m s h | b n i i ) (? = ( & | $ ) ) / i. test ( url ) ) {
@@ -1801,9 +1793,9 @@ function previewdataurl(url, idx) {
18011793
18021794 let bjd ;
18031795 if ( url . match ( / \. n i i \. g z / ) ) {
1804- console . log ( "🔄 Processing NIfTI file..." ) ;
1796+ // console.log("🔄 Processing NIfTI file...");
18051797 var origdata = pako . ungzip ( arrayBuffer ) ;
1806- console . log ( "✅ Unzipped Data Length:" , origdata . byteLength ) ;
1798+ // console.log("✅ Unzipped Data Length:", origdata.byteLength);
18071799 const header = new DataView ( origdata . buffer ) ;
18081800 let headerlen = header . getUint32 ( 0 , true ) ;
18091801 let ndim = header . getUint16 ( 40 , true ) ;
@@ -1841,15 +1833,15 @@ function previewdataurl(url, idx) {
18411833 NIFTIData : bjd . reshape ( dims . reverse ( ) ) . transpose ( ) ,
18421834 } ;
18431835 } else {
1844- console . log ( "🔄 Processing BJData..." ) ;
1836+ // console.log("🔄 Processing BJData...");
18451837 bjd = bjdata . decode ( buffer . Buffer . from ( arrayBuffer ) ) ;
18461838 // bjd = bjdata.decode(new Uint8Array(arrayBuffer));
18471839 let jd = new jdata ( bjd [ 0 ] , { base64 : false } ) ;
18481840 bjd = jd . decode ( ) . data ;
18491841 }
18501842
18511843 var plotdata = bjd ;
1852- console . log ( "plotdata" , plotdata ) ;
1844+ // console.log("plotdata", plotdata);
18531845
18541846 if ( linkpath . length > 1 && ! linkpath [ 1 ] . match ( / ^ M e s h [ N S E V T ] / ) ) {
18551847 let objpath = linkpath [ 1 ] . split ( / (?< ! \\ ) \. / ) ;
@@ -1923,7 +1915,6 @@ function previewdataurl(url, idx) {
19231915 plotdata . hasOwnProperty ( "data" ) &&
19241916 plotdata . data . hasOwnProperty ( "dataTimeSeries" )
19251917 ) {
1926- console . log ( "into the datatimeseries condition" ) ;
19271918 let serieslabel = true ;
19281919 if ( plotdata . data . hasOwnProperty ( "measurementList" ) ) {
19291920 serieslabel = Array ( plotdata . data . measurementList . length ) ;
@@ -1935,8 +1926,8 @@ function previewdataurl(url, idx) {
19351926 plotdata . data . measurementList [ i ] . detectorIndex ;
19361927 }
19371928 }
1938- console . log ( "serieslabel in plotdata.hasownproperty" , serieslabel ) ;
1939- console . log ( "plotdata 2nd" , plotdata ) ;
1929+ // console.log("serieslabel in plotdata.hasownproperty", serieslabel);
1930+ // console.log("plotdata 2nd", plotdata);
19401931 previewdata (
19411932 nj . concatenate (
19421933 plotdata . data . time . reshape ( plotdata . data . time . size , 1 ) ,
@@ -1954,7 +1945,7 @@ function previewdataurl(url, idx) {
19541945 window . extdata = window . extdata || [ ] ;
19551946 if ( ! window . extdata [ idx ] ) {
19561947 window . extdata [ idx ] = [ "" , "" , null , `External ${ idx } ` ] ;
1957- console . log ( "window.extdata in preview" , window . extdata ) ; //
1948+ // console.log("window.extdata in preview", window.extdata);
19581949 }
19591950 window . extdata [ idx ] [ 2 ] = plotdata ;
19601951 // window.extdata[idx][2] = bjd;
0 commit comments