@@ -4,7 +4,7 @@ import { isChrome, localSystemDetails } from "./brainchop-telemetry.js"
44import MyWorker from "./brainchop-webworker.js?worker"
55import { Niimath } from "@niivue/niimath"
66import {
7- antiAliasCuberille ,
7+ antiAliasCuberille , cuberille ,
88 setPipelinesBaseUrl as setCuberillePipelinesUrl
99} from "@itk-wasm/cuberille"
1010import {
@@ -240,6 +240,8 @@ async function main() {
240240 const opacity = 1.0 - ( 0.5 * Number ( isBetterQuality ) )
241241 largestCheck . disabled = isBetterQuality
242242 largestClusterGroup . style . opacity = opacity
243+ hollowGroup . style . opacity = opacity
244+ hollowSelect . disabled = isBetterQuality
243245 bubbleCheck . disabled = isBetterQuality
244246 bubbleGroup . style . opacity = opacity
245247 closeMM . disabled = isBetterQuality
@@ -262,7 +264,7 @@ async function main() {
262264 //mesh with specified isosurface
263265 let isoValue = 0.5
264266 if ( nv1 . volumes [ nv1 . volumes . length - 1 ] . hdr . intent_code === 0 ) {
265- isoValue = 222 //isScalar
267+ isoValue = 240 //isScalar
266268 }
267269 //const largestCheckValue = largestCheck.checked
268270 let reduce = Math . min ( Math . max ( Number ( shrinkPct . value ) / 100 , 0.01 ) , 1 )
@@ -299,10 +301,10 @@ async function main() {
299301 const volIdx = nv1 . volumes . length - 1
300302 let hdr = nv1 . volumes [ volIdx ] . hdr
301303 let img = nv1 . volumes [ volIdx ] . img
302- let hollowInt = Number ( hollowSelect . value )
304+ /* let hollowInt = Number(hollowSelect.value )
303305 if (hollowInt < 0){
304306 const vol = nv1.volumes[volIdx]
305- const niiBuffer = await nv1 . saveImage ( { volumeByIndex : nv1 . volumes . length - 1 } ) . buffer
307+ const niiBuffer = await nv1.saveImage({volumeByIndex: nv1.volumes.length - 1})
306308 const niiBlob = new Blob([niiBuffer], { type: 'application/octet-stream' })
307309 const niiFile = new File([niiBlob], 'input.nii')
308310 niimath.setOutputDataType('input') // call before setting image since this is passed to the image constructor
@@ -318,13 +320,19 @@ async function main() {
318320 })
319321 hdr = outVol.hdr
320322 img = outVol.img
321- }
323+ }*/
322324 loadingCircle . classList . remove ( "hidden" )
323325 meshProcessingMsg . classList . remove ( "hidden" )
324326 meshProcessingMsg . textContent = "Generating mesh from segmentation"
325327 const itkImage = nii2iwi ( hdr , img , false )
326328 itkImage . size = itkImage . size . map ( Number )
327- const { mesh } = await antiAliasCuberille ( itkImage , { noClosing : true } )
329+ let mesh
330+ if ( nv1 . volumes [ nv1 . volumes . length - 1 ] . hdr . intent_code === 0 ) {
331+ ( { mesh } = await cuberille ( itkImage , { isoSurfaceValue : 240 } ) )
332+ } else {
333+ ( { mesh } = await antiAliasCuberille ( itkImage , { noClosing : true } ) )
334+ }
335+
328336 meshProcessingMsg . textContent = "Generating manifold"
329337 const { outputMesh : repairedMesh } = await repair ( mesh , { maximumHoleArea : 50.0 } )
330338 meshProcessingMsg . textContent = "Keep largest mesh component"
0 commit comments