javascriptwebglxtk

How to get Fibers Object Record coordinates and show as text


I Got 2 files, 「Tracts_1.trk」and「Tracts_1.txt」.

According to XTK library API, it only accepted the Binary format file which is 「Tracts_1.trk」.

I know 「Tracts_1.trk」 inside record the files coordinates.

How to get the coordinates in the Fibers Object and show as text, just like 「Tracts_1.txt」?

I can't find any Property or Method can get it, please help me.

My Folder: https://googledrive.com/host/0B7yrjtQvNRwocGV5Tzl6aHBMbTQ/

ps. Here is inside content:

「Tracts_1.trk」:TRACKO_E@@@LPSLPS??èJqWXB¶¤-BÙB÷©[Bí/BýBRò^B[1B¹PB=bBò3B;BeB*f4BijBÄêhB5B?ÂB4lBÆ´6BCÄB^zoB¿Ì7BpÁBÁrBuß8B!¾Bü vBß9B{¹B-yB¸:Bs²Bº|B¾f;B2©B& BKó;B¡>BEÍB(gBUÕ¿B¤BBÒ:¿BN¯B½B¤¾B´ÒBQúBÜæ½B-íB-B.½BøBsPBo¼BüB®jB媻Bø BÈ{BàºBý÷ BéBÛºBE Bª¤B@:¹BW9BÉB_¸B}BøBQ·B¶ýA1B¶B¹øAn B©µBWóAûª¡B´B,`îAJè¢BÑß³BF2éAA&¤Bû²BíäAñc¥B[²BY ßAâ¦B¼ô°B MÚA«Ô§BÕ¯Bø¸ÕA©B

「Tracts_1.txt」:27.0427 21.7054 34.6493 27.458 21.9389 34.4976 27.8683 22.1695 34.3288 28.2801 22.3784 34.1369 28.6995 22.5499 33.9256 29.1146 22.6982 33.6897 29.5256 22.8383 33.4417 29.9347 22.975 33.1889 30.3445 23.1091 32.9357 30.7563 23.2339 32.6811 31.172 23.3401 32.4243 31.5911 23.4252 32.1652 32.0128 23.4938 31.9056 32.4505 23.5504 31.6704 32.9026 23.5942 31.4616 33.3617 23.6299 31.2668 33.825 23.6596 31.0809 34.2947 23.6797 30.9107 34.7727 23.6885 30.7644 35.2589 23.6863 30.6478 35.7514 23.6751 30.5625 36.2485 23.6643 30.5097 36.7482 23.6608 30.492 37.2482 23.6608 30.492 37.7482 23.6608 30.492 38.2482 23.6608 30.492 38.7482 23.6608 30.492 39.2479 23.6508 30.5066 39.745 23.6205 30.5504 40.2387 23.5895 30.6233 40.7281 23.5785 30.7253 41.2138 23.5777 30.8441 41.6995 23.5771 30.9627 42.1829 23.5697 31.0904 42.658 23.5429 31.2439 43.1223 23.4993 31.4242 43.5719 23.4442 31.6359 44.0053 23.3786 31.8764 44.4387 23.313 32.1169 44.8721 23.2474 32.3575 45.3055 23.1818 32.598 45.739 23.1162 32.8385 46.169 23.0409 33.0822 46.5873 22.948 33.3398 46.9918 22.8516 33.6175 47.398 22.747 33.8897 47.7997 22.6141 34.156 48.1472 22.4109 34.4527 48.3627 22.1129 34.7914 48.4428 21.7596 35.1361 48.4213 21.3814 35.4624 48.3381 20.9921 35.765 48.2274 20.6003 36.0551 48.0928 20.2152 36.3443 47.9583 19.8301 36.6334 47.8074 19.4606 36.9346 47.6461 19.1029 37.2444 47.4754 18.7408 37.5441 47.295 18.3713 37.8286 47.1088 17.9981 38.1042 46.9169 17.6211 38.3709 46.7188 17.2461 38.6357 46.5155 16.8815 38.9108 46.3069 16.528 39.1964 46.0931 16.1863 39.4923 45.8743 15.8571 39.7984 45.6465 15.5373 40.108 45.415 15.2196 40.417 45.1895 14.8985 40.7268 44.9686 14.5748 41.0374 44.7457 14.2522 41.3476 44.5052 13.9398 41.6552 44.239 13.6438 41.9577 43.9586 13.3577 42.2568


Solution

  • I'm not sure to understand what you are trying to do.

    For each point in the tract, you want to show its coordinates as a caption?

    It is not supported right now.

    A workaround would be to loop around all the points in your tract, and for each of them create a sphere with the appropriate caption.

    http://jsfiddle.net/HZ38F/

      for ( var j = 0; j < numberOfPoints - 1; j++) {
        var currentPoint = fibers.points.get(j);
        var currentColor = fibers.colors.get(j);
    
        var newSphere = new X.sphere();
        newSphere.center = [currentPoint[0], currentPoint[1], currentPoint[2]];
        newSphere.color = [currentColor[0], currentColor[1], currentColor[2]];
        newSphere.radius = .1;
        newSphere.caption = 'x:  '+String(currentPoint[0])+'<br>y: '+String(currentPoint[1])+'<br>z: '+String(currentPoint[2]);
        r.add(newSphere);
    }