Volume.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Volume - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <h1 translate="no">Volume</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>This class had been written to handle the output of the <a href="NRRDLoader.html">NRRDLoader</a>.
  16. It contains a volume of data and information about it. For now it only handles 3 dimensional data.</p></div>
  17. </header>
  18. <article>
  19. <h2 class="subsection-title">Import</h2>
  20. <p><span translate="no">Volume</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
  21. <pre><code class="language-js">import { Volume } from 'three/addons/misc/Volume.js';</code></pre>
  22. <div class="container-overview">
  23. <h2>Constructor</h2>
  24. <h3 class="name name-method" id="Volume" translate="no">new <a href="#Volume">Volume</a><span class="signature">( xLength : <span class="param-type">number</span>, yLength : <span class="param-type">number</span>, zLength : <span class="param-type">number</span>, type : <span class="param-type">string</span>, arrayBuffer : <span class="param-type">ArrayBuffer</span> )</span> </h3>
  25. <div class="method">
  26. <div class="description">
  27. <p>Constructs a new volume.</p>
  28. </div>
  29. <table class="params">
  30. <tbody>
  31. <tr>
  32. <td class="name">
  33. <strong>xLength</strong>
  34. </td>
  35. <td class="description last">
  36. <p>Width of the volume.</p>
  37. </td>
  38. </tr>
  39. <tr>
  40. <td class="name">
  41. <strong>yLength</strong>
  42. </td>
  43. <td class="description last">
  44. <p>Length of the volume.</p>
  45. </td>
  46. </tr>
  47. <tr>
  48. <td class="name">
  49. <strong>zLength</strong>
  50. </td>
  51. <td class="description last">
  52. <p>Depth of the volume.</p>
  53. </td>
  54. </tr>
  55. <tr>
  56. <td class="name">
  57. <strong>type</strong>
  58. </td>
  59. <td class="description last">
  60. <p>The type of data (uint8, uint16, ...).</p>
  61. </td>
  62. </tr>
  63. <tr>
  64. <td class="name">
  65. <strong>arrayBuffer</strong>
  66. </td>
  67. <td class="description last">
  68. <p>The buffer with volume data.</p>
  69. </td>
  70. </tr>
  71. </tbody>
  72. </table>
  73. </div>
  74. </div>
  75. <h2 class="subsection-title">Properties</h2>
  76. <div class="member">
  77. <h3 class="name" id="RASDimensions" translate="no">.<a href="#RASDimensions">RASDimensions</a><span class="type-signature"> : Array.&lt;number></span> </h3>
  78. <div class="description">
  79. <p>This array holds the dimensions of the volume in the RAS space</p>
  80. </div>
  81. </div>
  82. <div class="member">
  83. <h3 class="name" id="axisOrder" translate="no">.<a href="#axisOrder">axisOrder</a><span class="type-signature"> : Array.&lt;string></span> </h3>
  84. <div class="description">
  85. <p>The order of the Axis dictated by the NRRD header</p>
  86. </div>
  87. </div>
  88. <div class="member">
  89. <h3 class="name" id="data" translate="no">.<a href="#data">data</a><span class="type-signature"> : TypedArray</span> </h3>
  90. <div class="description">
  91. <p>The data of the volume.</p>
  92. </div>
  93. </div>
  94. <div class="member">
  95. <h3 class="name" id="inverseMatrix" translate="no">.<a href="#inverseMatrix">inverseMatrix</a><span class="type-signature"> : Martrix3</span> </h3>
  96. <div class="description">
  97. <p>The RAS to IJK matrix.</p>
  98. </div>
  99. </div>
  100. <div class="member">
  101. <h3 class="name" id="lowerThreshold" translate="no">.<a href="#lowerThreshold">lowerThreshold</a><span class="type-signature"> : number</span> </h3>
  102. <div class="description">
  103. <p>The voxels with values under this threshold won't appear in the slices.
  104. If changed, geometryNeedsUpdate is automatically set to true on all the slices associated to this volume.</p>
  105. </div>
  106. </div>
  107. <div class="member">
  108. <h3 class="name" id="matrix" translate="no">.<a href="#matrix">matrix</a><span class="type-signature"> : Martrix3</span> </h3>
  109. <div class="description">
  110. <p>The IJK to RAS matrix.</p>
  111. </div>
  112. </div>
  113. <div class="member">
  114. <h3 class="name" id="offset" translate="no">.<a href="#offset">offset</a><span class="type-signature"> : Array.&lt;number></span> </h3>
  115. <div class="description">
  116. <p>Offset of the volume in the RAS coordinate system</p>
  117. </div>
  118. </div>
  119. <div class="member">
  120. <h3 class="name" id="segmentation" translate="no">.<a href="#segmentation">segmentation</a><span class="type-signature"> : boolean</span> </h3>
  121. <div class="description">
  122. <p>Whether to use segmentation mode or not.
  123. It can load 16-bits nrrds correctly.</p>
  124. <p>Default is <code>false</code>.</p>
  125. </div>
  126. </div>
  127. <div class="member">
  128. <h3 class="name" id="sliceList" translate="no">.<a href="#sliceList">sliceList</a><span class="type-signature"> : Array.&lt;<a href="VolumeSlice.html">VolumeSlice</a>></span> </h3>
  129. <div class="description">
  130. <p>The list of all the slices associated to this volume</p>
  131. </div>
  132. </div>
  133. <div class="member">
  134. <h3 class="name" id="spacing" translate="no">.<a href="#spacing">spacing</a><span class="type-signature"> : Array.&lt;number></span> </h3>
  135. <div class="description">
  136. <p>Spacing to apply to the volume from IJK to RAS coordinate system</p>
  137. </div>
  138. </div>
  139. <div class="member">
  140. <h3 class="name" id="upperThreshold" translate="no">.<a href="#upperThreshold">upperThreshold</a><span class="type-signature"> : number</span> </h3>
  141. <div class="description">
  142. <p>The voxels with values over this threshold won't appear in the slices.
  143. If changed, geometryNeedsUpdate is automatically set to true on all the slices associated to this volume</p>
  144. </div>
  145. </div>
  146. <div class="member">
  147. <h3 class="name" id="xLength" translate="no">.<a href="#xLength">xLength</a><span class="type-signature"> : number</span> </h3>
  148. <div class="description">
  149. <p>Width of the volume in the IJK coordinate system.</p>
  150. <p>Default is <code>1</code>.</p>
  151. </div>
  152. </div>
  153. <div class="member">
  154. <h3 class="name" id="yLength" translate="no">.<a href="#yLength">yLength</a><span class="type-signature"> : number</span> </h3>
  155. <div class="description">
  156. <p>Height of the volume in the IJK coordinate system.</p>
  157. <p>Default is <code>1</code>.</p>
  158. </div>
  159. </div>
  160. <div class="member">
  161. <h3 class="name" id="zLength" translate="no">.<a href="#zLength">zLength</a><span class="type-signature"> : number</span> </h3>
  162. <div class="description">
  163. <p>Depth of the volume in the IJK coordinate system.</p>
  164. <p>Default is <code>1</code>.</p>
  165. </div>
  166. </div>
  167. <h2 class="subsection-title">Methods</h2>
  168. <h3 class="name name-method" id="access" translate="no">.<a href="#access">access</a><span class="signature">( i : <span class="param-type">number</span>, j : <span class="param-type">number</span>, k : <span class="param-type">number</span> )</span><span class="type-signature"> : number</span> </h3>
  169. <div class="method">
  170. <div class="description">
  171. <p>Compute the index in the data array corresponding to the given coordinates in IJK system.</p>
  172. </div>
  173. <table class="params">
  174. <tbody>
  175. <tr>
  176. <td class="name">
  177. <strong>i</strong>
  178. </td>
  179. <td class="description last">
  180. <p>First coordinate.</p>
  181. </td>
  182. </tr>
  183. <tr>
  184. <td class="name">
  185. <strong>j</strong>
  186. </td>
  187. <td class="description last">
  188. <p>Second coordinate.</p>
  189. </td>
  190. </tr>
  191. <tr>
  192. <td class="name">
  193. <strong>k</strong>
  194. </td>
  195. <td class="description last">
  196. <p>Third coordinate.</p>
  197. </td>
  198. </tr>
  199. </tbody>
  200. </table>
  201. <dl class="details">
  202. <dt class="tag-returns"><strong>Returns:</strong> The index.</dt>
  203. </dl>
  204. </div>
  205. <h3 class="name name-method" id="computeMinMax" translate="no">.<a href="#computeMinMax">computeMinMax</a><span class="signature">()</span><span class="type-signature"> : Array.&lt;number></span> </h3>
  206. <div class="method">
  207. <div class="description">
  208. <p>Compute the minimum and the maximum of the data in the volume.</p>
  209. </div>
  210. <dl class="details">
  211. <dt class="tag-returns"><strong>Returns:</strong> The min/max data as <code>[min,max]</code>.</dt>
  212. </dl>
  213. </div>
  214. <h3 class="name name-method" id="extractPerpendicularPlane" translate="no">.<a href="#extractPerpendicularPlane">extractPerpendicularPlane</a><span class="signature">( axis : <span class="param-type">'x' | 'y' | 'z'</span>, RASIndex : <span class="param-type">number</span> )</span><span class="type-signature"> : Object</span> </h3>
  215. <div class="method">
  216. <div class="description">
  217. <p>Compute the orientation of the slice and returns all the information relative to the geometry such as sliceAccess,
  218. the plane matrix (orientation and position in RAS coordinate) and the dimensions of the plane in both coordinate system.</p>
  219. </div>
  220. <table class="params">
  221. <tbody>
  222. <tr>
  223. <td class="name">
  224. <strong>axis</strong>
  225. </td>
  226. <td class="description last">
  227. <p>The normal axis to the slice.</p>
  228. </td>
  229. </tr>
  230. <tr>
  231. <td class="name">
  232. <strong>RASIndex</strong>
  233. </td>
  234. <td class="description last">
  235. <p>The index of the slice.</p>
  236. </td>
  237. </tr>
  238. </tbody>
  239. </table>
  240. <dl class="details">
  241. <dt class="tag-returns"><strong>Returns:</strong> An object containing all the useful information on the geometry of the slice.</dt>
  242. </dl>
  243. </div>
  244. <h3 class="name name-method" id="extractSlice" translate="no">.<a href="#extractSlice">extractSlice</a><span class="signature">( axis : <span class="param-type">'x' | 'y' | 'z'</span>, index : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="VolumeSlice.html">VolumeSlice</a></span> </h3>
  245. <div class="method">
  246. <div class="description">
  247. <p>Returns a slice corresponding to the given axis and index.
  248. The coordinate are given in the Right Anterior Superior coordinate format.</p>
  249. </div>
  250. <table class="params">
  251. <tbody>
  252. <tr>
  253. <td class="name">
  254. <strong>axis</strong>
  255. </td>
  256. <td class="description last">
  257. <p>The normal axis to the slice.</p>
  258. </td>
  259. </tr>
  260. <tr>
  261. <td class="name">
  262. <strong>index</strong>
  263. </td>
  264. <td class="description last">
  265. <p>The index of the slice.</p>
  266. </td>
  267. </tr>
  268. </tbody>
  269. </table>
  270. <dl class="details">
  271. <dt class="tag-returns"><strong>Returns:</strong> The extracted slice.</dt>
  272. </dl>
  273. </div>
  274. <h3 class="name name-method" id="getData" translate="no">.<a href="#getData">getData</a><span class="signature">( i : <span class="param-type">number</span>, j : <span class="param-type">number</span>, k : <span class="param-type">number</span> )</span><span class="type-signature"> : number</span> </h3>
  275. <div class="method">
  276. <div class="description">
  277. <p>Shortcut for data[access(i,j,k)].</p>
  278. </div>
  279. <table class="params">
  280. <tbody>
  281. <tr>
  282. <td class="name">
  283. <strong>i</strong>
  284. </td>
  285. <td class="description last">
  286. <p>First coordinate.</p>
  287. </td>
  288. </tr>
  289. <tr>
  290. <td class="name">
  291. <strong>j</strong>
  292. </td>
  293. <td class="description last">
  294. <p>Second coordinate.</p>
  295. </td>
  296. </tr>
  297. <tr>
  298. <td class="name">
  299. <strong>k</strong>
  300. </td>
  301. <td class="description last">
  302. <p>Third coordinate.</p>
  303. </td>
  304. </tr>
  305. </tbody>
  306. </table>
  307. <dl class="details">
  308. <dt class="tag-returns"><strong>Returns:</strong> The value in the data array.</dt>
  309. </dl>
  310. </div>
  311. <h3 class="name name-method" id="map" translate="no">.<a href="#map">map</a><span class="signature">( functionToMap : <span class="param-type">function</span>, context : <span class="param-type">Object</span> )</span><span class="type-signature"> : <a href="Volume.html">Volume</a></span> </h3>
  312. <div class="method">
  313. <div class="description">
  314. <p>Apply a function to all the voxels, be careful, the value will be replaced.</p>
  315. </div>
  316. <table class="params">
  317. <tbody>
  318. <tr>
  319. <td class="name">
  320. <strong>functionToMap</strong>
  321. </td>
  322. <td class="description last">
  323. <p>A function to apply to every voxel, will be called with the following parameters:
  324. value of the voxel, index of the voxel, the data (TypedArray).</p>
  325. </td>
  326. </tr>
  327. <tr>
  328. <td class="name">
  329. <strong>context</strong>
  330. </td>
  331. <td class="description last">
  332. <p>You can specify a context in which call the function, default if this Volume.</p>
  333. </td>
  334. </tr>
  335. </tbody>
  336. </table>
  337. <dl class="details">
  338. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  339. </dl>
  340. </div>
  341. <h3 class="name name-method" id="repaintAllSlices" translate="no">.<a href="#repaintAllSlices">repaintAllSlices</a><span class="signature">()</span><span class="type-signature"> : <a href="Volume.html">Volume</a></span> </h3>
  342. <div class="method">
  343. <div class="description">
  344. <p>Call repaint on all the slices extracted from this volume.</p>
  345. </div>
  346. <dl class="details">
  347. <dt class="tag-see">See:</dt>
  348. <dd class="tag-see">
  349. <ul>
  350. <li><a href="VolumeSlice.html#repaint">VolumeSlice#repaint</a></li>
  351. </ul>
  352. </dd>
  353. </dl>
  354. <dl class="details">
  355. <dt class="tag-returns"><strong>Returns:</strong> A reference to this volume.</dt>
  356. </dl>
  357. </div>
  358. <h3 class="name name-method" id="reverseAccess" translate="no">.<a href="#reverseAccess">reverseAccess</a><span class="signature">( index : <span class="param-type">number</span> )</span><span class="type-signature"> : Array.&lt;number></span> </h3>
  359. <div class="method">
  360. <div class="description">
  361. <p>Retrieve the IJK coordinates of the voxel corresponding of the given index in the data.</p>
  362. </div>
  363. <table class="params">
  364. <tbody>
  365. <tr>
  366. <td class="name">
  367. <strong>index</strong>
  368. </td>
  369. <td class="description last">
  370. <p>Index of the voxel.</p>
  371. </td>
  372. </tr>
  373. </tbody>
  374. </table>
  375. <dl class="details">
  376. <dt class="tag-returns"><strong>Returns:</strong> The IJK coordinates as <code>[x,y,z]</code>.</dt>
  377. </dl>
  378. </div>
  379. <h2 class="subsection-title">Source</h2>
  380. <p>
  381. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/misc/Volume.js" translate="no" target="_blank" rel="noopener">examples/jsm/misc/Volume.js</a>
  382. </p>
  383. </article>
  384. </section>
  385. <script src="../scripts/linenumber.js"></script>
  386. <script src="../scripts/page.js"></script>
  387. </body>
  388. </html>
粤ICP备19079148号