|
349 | 349 | " subject.volume.data[0].cpu().numpy().flatten(order=\"F\") > threshold\n", |
350 | 350 | " )\n", |
351 | 351 | " try:\n", |
352 | | - " mesh = grid.contour_labeled(smoothing=True, progress_bar=verbose)\n", |
| 352 | + " mesh = grid.contour_labels(\n", |
| 353 | + " boundary_style=\"strict_external\",\n", |
| 354 | + " smoothing=True, \n", |
| 355 | + " output_mesh_type='quads',\n", |
| 356 | + " pad_background=True,\n", |
| 357 | + " orient_faces=True,\n", |
| 358 | + " simplify_output=False,\n", |
| 359 | + " progress_bar=verbose,\n", |
| 360 | + " )\n", |
353 | 361 | " except AttributeError as e:\n", |
354 | 362 | " raise AttributeError(\n", |
355 | 363 | " f\"{e}, ensure you are using pyvista>=0.43 and vtk>=9.3\"\n", |
|
360 | 368 | " )\n", |
361 | 369 | "\n", |
362 | 370 | " # Transform the mesh using the affine matrix\n", |
363 | | - " mesh = mesh.transform(subject.volume.affine.squeeze())\n", |
| 371 | + " mesh = mesh.transform(subject.volume.affine.squeeze(), inplace=False)\n", |
364 | 372 | "\n", |
365 | 373 | " # Preprocess the mesh\n", |
366 | 374 | " if extract_largest:\n", |
|
403 | 411 | "\n", |
404 | 412 | " # Run SurfaceNets\n", |
405 | 413 | " grid.point_data[\"values\"] = subject.mask.data[0].numpy().flatten(order=\"F\")\n", |
406 | | - " mesh = grid.contour_labeled(smoothing=True, progress_bar=verbose)\n", |
| 414 | + " mesh = grid.contour_labels(\n", |
| 415 | + " boundary_style=\"strict_external\",\n", |
| 416 | + " smoothing=True, \n", |
| 417 | + " output_mesh_type='quads',\n", |
| 418 | + " pad_background=True,\n", |
| 419 | + " orient_faces=True,\n", |
| 420 | + " simplify_output=False,\n", |
| 421 | + " progress_bar=verbose,\n", |
| 422 | + " )\n", |
407 | 423 | " mesh.smooth_taubin(\n", |
408 | 424 | " n_iter=100,\n", |
409 | 425 | " feature_angle=120.0,\n", |
|
417 | 433 | " mesh.clean(inplace=True, progress_bar=verbose)\n", |
418 | 434 | "\n", |
419 | 435 | " # Transform the mesh using the affine matrix\n", |
420 | | - " mesh = mesh.transform(subject.mask.affine.squeeze())\n", |
| 436 | + " mesh = mesh.transform(subject.mask.affine.squeeze(), inplace=False)\n", |
421 | 437 | "\n", |
422 | 438 | " return mesh" |
423 | 439 | ] |
|
0 commit comments