cardiac-geometriesx 0.6.1__tar.gz → 0.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cardiac-geometriesx might be problematic. Click here for more details.

Files changed (27) hide show
  1. {cardiac_geometriesx-0.6.1/src/cardiac_geometriesx.egg-info → cardiac_geometriesx-0.7.0}/PKG-INFO +5 -2
  2. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/pyproject.toml +6 -3
  3. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/src/cardiac_geometries/cli.py +72 -394
  4. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/src/cardiac_geometries/gui.py +0 -2
  5. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/src/cardiac_geometries/mesh.py +59 -303
  6. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/src/cardiac_geometries/utils.py +17 -12
  7. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0/src/cardiac_geometriesx.egg-info}/PKG-INFO +5 -2
  8. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/src/cardiac_geometriesx.egg-info/requires.txt +4 -1
  9. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/tests/test_cli.py +1 -2
  10. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/tests/test_save_load.py +1 -1
  11. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/LICENSE +0 -0
  12. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/README.md +0 -0
  13. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/setup.cfg +0 -0
  14. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/src/cardiac_geometries/__init__.py +0 -0
  15. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/src/cardiac_geometries/fibers/__init__.py +0 -0
  16. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/src/cardiac_geometries/fibers/cylinder.py +0 -0
  17. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/src/cardiac_geometries/fibers/cylinder_flat.py +0 -0
  18. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/src/cardiac_geometries/fibers/lv_ellipsoid.py +0 -0
  19. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/src/cardiac_geometries/fibers/slab.py +0 -0
  20. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/src/cardiac_geometries/fibers/utils.py +0 -0
  21. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/src/cardiac_geometries/geometry.py +0 -0
  22. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/src/cardiac_geometriesx.egg-info/SOURCES.txt +0 -0
  23. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/src/cardiac_geometriesx.egg-info/dependency_links.txt +0 -0
  24. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/src/cardiac_geometriesx.egg-info/entry_points.txt +0 -0
  25. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/src/cardiac_geometriesx.egg-info/not-zip-safe +0 -0
  26. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/src/cardiac_geometriesx.egg-info/top_level.txt +0 -0
  27. {cardiac_geometriesx-0.6.1 → cardiac_geometriesx-0.7.0}/tests/test_refinement.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cardiac-geometriesx
3
- Version: 0.6.1
3
+ Version: 0.7.0
4
4
  Summary: A python library for cardiac geometries
5
5
  Author-email: Henrik Finsberg <henriknf@simula.no>
6
6
  License: MIT
@@ -29,11 +29,14 @@ Provides-Extra: docs
29
29
  Requires-Dist: jupyter-book; extra == "docs"
30
30
  Requires-Dist: jupytext; extra == "docs"
31
31
  Requires-Dist: jupyter; extra == "docs"
32
- Requires-Dist: pyvista[all]>=0.43.0; extra == "docs"
32
+ Requires-Dist: pyvista[all]>=0.45.0; extra == "docs"
33
+ Requires-Dist: vtk>=9.5.0; extra == "docs"
33
34
  Requires-Dist: trame-vuetify; extra == "docs"
34
35
  Requires-Dist: ipywidgets; extra == "docs"
35
36
  Requires-Dist: fenicsx-ldrb; extra == "docs"
36
37
  Requires-Dist: ukb-atlas; extra == "docs"
38
+ Requires-Dist: sphinx-codeautolink; extra == "docs"
39
+ Requires-Dist: sphinx-copybutton; extra == "docs"
37
40
  Provides-Extra: test
38
41
  Requires-Dist: pre-commit; extra == "test"
39
42
  Requires-Dist: pytest; extra == "test"
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "cardiac-geometriesx"
7
- version = "0.6.1"
7
+ version = "0.7.0"
8
8
  description = "A python library for cardiac geometries"
9
9
  authors = [{name = "Henrik Finsberg", email = "henriknf@simula.no"}]
10
10
  license = {text = "MIT"}
@@ -42,11 +42,14 @@ docs = [
42
42
  "jupyter-book",
43
43
  "jupytext",
44
44
  "jupyter",
45
- "pyvista[all]>=0.43.0",
45
+ "pyvista[all]>=0.45.0",
46
+ "vtk>=9.5.0",
46
47
  "trame-vuetify",
47
48
  "ipywidgets",
48
49
  "fenicsx-ldrb",
49
50
  "ukb-atlas",
51
+ "sphinx-codeautolink",
52
+ "sphinx-copybutton",
50
53
  ]
51
54
  test = [
52
55
  "pre-commit",
@@ -177,7 +180,7 @@ tag = true
177
180
  sign_tags = false
178
181
  tag_name = "v{new_version}"
179
182
  tag_message = "Bump version: {current_version} → {new_version}"
180
- current_version = "0.6.1"
183
+ current_version = "0.7.0"
181
184
 
182
185
 
183
186
  [[tool.bumpversion.files]]
@@ -1,3 +1,4 @@
1
+ import logging
1
2
  import math
2
3
  from importlib.metadata import metadata
3
4
  from pathlib import Path
@@ -6,6 +7,8 @@ import rich_click as click
6
7
 
7
8
  from . import mesh
8
9
 
10
+ logger = logging.getLogger(__name__)
11
+
9
12
  meta = metadata("cardiac-geometriesx")
10
13
  __version__ = meta["Version"]
11
14
  __author__ = meta["Author-email"]
@@ -14,6 +17,13 @@ __email__ = meta["Author-email"]
14
17
  __program_name__ = meta["Name"]
15
18
 
16
19
 
20
+ def init_logging(verbose: bool = False):
21
+ loglevel = logging.DEBUG if verbose else logging.INFO
22
+ logging.basicConfig(level=loglevel)
23
+ for name in ["numba"]:
24
+ logging.getLogger(name).setLevel(logging.WARNING)
25
+
26
+
17
27
  @click.group()
18
28
  @click.version_option(__version__, prog_name="cardiac_geometriesx")
19
29
  def app():
@@ -301,129 +311,80 @@ def lv_ellipsoid(
301
311
  show_default=True,
302
312
  )
303
313
  @click.option(
304
- "--center-lv-x",
305
- default=0.0,
306
- type=float,
307
- help="X-coordinate for the center of the lv",
308
- show_default=True,
309
- )
310
- @click.option(
311
- "--center-lv-y",
312
- default=0.0,
313
- type=float,
314
- help="Y-coordinate for the center of the lv",
315
- show_default=True,
316
- )
317
- @click.option(
318
- "--center-lv-z",
319
- default=0.0,
320
- type=float,
321
- help="Z-coordinate for the center of the lv",
322
- show_default=True,
323
- )
324
- @click.option(
325
- "--a-endo-lv",
314
+ "--base-cut-z",
326
315
  default=2.5,
327
316
  type=float,
328
- help="Dilation of lv endo ellipsoid in the x-direction",
329
- show_default=True,
330
- )
331
- @click.option(
332
- "--b-endo-lv",
333
- default=1.0,
334
- type=float,
335
- help="Dilation of lv endo ellipsoid in the y-direction",
317
+ help="Z-coordinate of the base cut",
336
318
  show_default=True,
337
319
  )
338
320
  @click.option(
339
- "--c-endo-lv",
340
- default=1.0,
321
+ "--box-size",
322
+ default=15.0,
341
323
  type=float,
342
- help="Dilation of lv endo ellipsoid in the y-direction",
324
+ help="Size of the cutting box",
343
325
  show_default=True,
344
326
  )
345
327
  @click.option(
346
- "--a-epi-lv",
347
- default=3.0,
328
+ "--rv-wall-thickness",
329
+ default=0.4,
348
330
  type=float,
349
- help="Dilation of lv epi ellipsoid in the x-direction",
331
+ help="Thickness of the right ventricle wall",
350
332
  show_default=True,
351
333
  )
352
334
  @click.option(
353
- "--b-epi-lv",
354
- default=1.5,
355
- type=float,
356
- help="Dilation of lv epi ellipsoid in the y-direction",
357
- show_default=True,
358
- )
359
- @click.option(
360
- "--c-epi-lv",
361
- default=1.5,
362
- type=float,
363
- help="Dilation of lv epi ellipsoid in the y-direction",
364
- show_default=True,
365
- )
366
- @click.option(
367
- "--center-rv-x",
368
- default=0.0,
369
- type=float,
370
- help="X-coordinate for the center of the rv",
371
- show_default=True,
372
- )
373
- @click.option(
374
- "--center-rv-y",
335
+ "--lv-wall-thickness",
375
336
  default=0.5,
376
337
  type=float,
377
- help="Y-coordinate for the center of the rv",
338
+ help="Thickness of the left ventricle wall",
378
339
  show_default=True,
379
340
  )
380
341
  @click.option(
381
- "--center-rv-z",
382
- default=0.0,
342
+ "--rv-offset-x",
343
+ default=3.0,
383
344
  type=float,
384
- help="Z-coordinate for the center of the rv",
345
+ help="X-offset of the right ventricle",
385
346
  show_default=True,
386
347
  )
387
348
  @click.option(
388
- "--a-endo-rv",
389
- default=3.0,
349
+ "--lv-radius-x",
350
+ default=2.0,
390
351
  type=float,
391
- help="Dilation of rv endo ellipsoid in the x-direction",
352
+ help="X-radius of the left ventricle",
392
353
  show_default=True,
393
354
  )
394
355
  @click.option(
395
- "--b-endo-rv",
396
- default=1.5,
356
+ "--lv-radius-y",
357
+ default=1.8,
397
358
  type=float,
398
- help="Dilation of rv endo ellipsoid in the y-direction",
359
+ help="Y-radius of the left ventricle",
399
360
  show_default=True,
400
361
  )
401
362
  @click.option(
402
- "--c-endo-rv",
403
- default=1.5,
363
+ "--lv-radius-z",
364
+ default=3.25,
404
365
  type=float,
405
- help="Dilation of rv endo ellipsoid in the y-direction",
366
+ help="Z-radius of the left ventricle",
406
367
  show_default=True,
407
368
  )
408
369
  @click.option(
409
- "--a-epi-rv",
410
- default=4.0,
370
+ "--rv-radius-x",
371
+ default=1.9,
411
372
  type=float,
412
- help="Dilation of rv epi ellipsoid in the x-direction",
373
+ help="X-radius of the right ventricle",
413
374
  show_default=True,
414
375
  )
415
376
  @click.option(
416
- "--b-epi-rv",
377
+ "--rv-radius-y",
417
378
  default=2.5,
418
379
  type=float,
419
- help="Dilation of rv epi ellipsoid in the y-direction",
380
+ help="Y-radius of the right ventricle",
420
381
  show_default=True,
421
382
  )
422
383
  @click.option(
423
- "--c-epi-rv",
424
- default=2.0,
384
+ "--rv-radius-z",
385
+ default=3.0,
425
386
  type=float,
426
- help="Dilation of rv epi ellipsoid in the z-direction",
387
+ help="Z-radius of the right ventricle",
427
388
  show_default=True,
428
389
  )
429
390
  @click.option(
@@ -454,340 +415,58 @@ def lv_ellipsoid(
454
415
  help="Function space for fibers of the form family_degree",
455
416
  show_default=True,
456
417
  )
457
- def biv_ellipsoid(
458
- outdir: Path,
459
- char_length: float = 0.5,
460
- center_lv_x: float = 0.0,
461
- center_lv_y: float = 0.0,
462
- center_lv_z: float = 0.0,
463
- a_endo_lv: float = 2.5,
464
- b_endo_lv: float = 1.0,
465
- c_endo_lv: float = 1.0,
466
- a_epi_lv: float = 3.0,
467
- b_epi_lv: float = 1.5,
468
- c_epi_lv: float = 1.5,
469
- center_rv_x: float = 0.0,
470
- center_rv_y: float = 0.5,
471
- center_rv_z: float = 0.0,
472
- a_endo_rv: float = 3.0,
473
- b_endo_rv: float = 1.5,
474
- c_endo_rv: float = 1.5,
475
- a_epi_rv: float = 4.0,
476
- b_epi_rv: float = 2.5,
477
- c_epi_rv: float = 2.0,
478
- create_fibers: bool = False,
479
- fiber_angle_endo: float = -60,
480
- fiber_angle_epi: float = +60,
481
- fiber_space: str = "P_1",
482
- ):
483
- outdir = Path(outdir)
484
- outdir.mkdir(exist_ok=True)
485
-
486
- geo = mesh.biv_ellipsoid(
487
- outdir=outdir,
488
- char_length=char_length,
489
- center_lv_x=center_lv_x,
490
- center_lv_y=center_lv_y,
491
- center_lv_z=center_lv_z,
492
- a_endo_lv=a_endo_lv,
493
- b_endo_lv=b_endo_lv,
494
- c_endo_lv=c_endo_lv,
495
- a_epi_lv=a_epi_lv,
496
- b_epi_lv=b_epi_lv,
497
- c_epi_lv=c_epi_lv,
498
- center_rv_x=center_rv_x,
499
- center_rv_y=center_rv_y,
500
- center_rv_z=center_rv_z,
501
- a_endo_rv=a_endo_rv,
502
- b_endo_rv=b_endo_rv,
503
- c_endo_rv=c_endo_rv,
504
- a_epi_rv=a_epi_rv,
505
- b_epi_rv=b_epi_rv,
506
- c_epi_rv=c_epi_rv,
507
- create_fibers=create_fibers,
508
- fiber_angle_endo=fiber_angle_endo,
509
- fiber_angle_epi=fiber_angle_epi,
510
- fiber_space=fiber_space,
511
- )
512
- geo.save(outdir / "biv_ellipsoid.bp")
513
-
514
-
515
- @click.command(help="Create BiV ellipsoidal geometry embedded in a torso")
516
- @click.argument(
517
- "outdir",
518
- required=True,
519
- type=click.Path(
520
- file_okay=False,
521
- dir_okay=True,
522
- writable=True,
523
- readable=True,
524
- resolve_path=True,
525
- ),
526
- )
527
- @click.option(
528
- "--char-length",
529
- default=0.5,
530
- type=float,
531
- help="Characteristic length of mesh",
532
- show_default=True,
533
- )
534
- @click.option(
535
- "--heart-as-surface/--heart-as-volume",
536
- default=False,
537
- help="Whether the heart should be a surface of a volume inside the torso",
538
- show_default=True,
539
- )
540
- @click.option(
541
- "--torso-length",
542
- default=20,
543
- type=float,
544
- help="Length of torso in the x-direction",
545
- show_default=True,
546
- )
547
- @click.option(
548
- "--torso-width",
549
- default=20,
550
- type=float,
551
- help="Length of torso in the y-direction",
552
- show_default=True,
553
- )
554
- @click.option(
555
- "--torso-height",
556
- default=20,
557
- type=float,
558
- help="Length of torso in the z-direction",
559
- show_default=True,
560
- )
561
- @click.option(
562
- "--rotation-angle",
563
- default=math.pi / 6,
564
- type=float,
565
- help=(
566
- "Angle to rotate the torso in order to object realistic position of the heart in a torso"
567
- ),
568
- show_default=True,
569
- )
570
- @click.option(
571
- "--center-lv-x",
572
- default=0.0,
573
- type=float,
574
- help="X-coordinate for the center of the lv",
575
- show_default=True,
576
- )
577
418
  @click.option(
578
- "--center-lv-y",
579
- default=0.0,
580
- type=float,
581
- help="Y-coordinate for the center of the lv",
582
- show_default=True,
583
- )
584
- @click.option(
585
- "--center-lv-z",
586
- default=0.0,
587
- type=float,
588
- help="Z-coordinate for the center of the lv",
589
- show_default=True,
590
- )
591
- @click.option(
592
- "--a-endo-lv",
593
- default=2.5,
594
- type=float,
595
- help="Dilation of lv endo ellipsoid in the x-direction",
596
- show_default=True,
597
- )
598
- @click.option(
599
- "--b-endo-lv",
600
- default=1.0,
601
- type=float,
602
- help="Dilation of lv endo ellipsoid in the y-direction",
603
- show_default=True,
604
- )
605
- @click.option(
606
- "--c-endo-lv",
607
- default=1.0,
608
- type=float,
609
- help="Dilation of lv endo ellipsoid in the y-direction",
610
- show_default=True,
611
- )
612
- @click.option(
613
- "--a-epi-lv",
614
- default=3.0,
615
- type=float,
616
- help="Dilation of lv epi ellipsoid in the x-direction",
617
- show_default=True,
618
- )
619
- @click.option(
620
- "--b-epi-lv",
621
- default=1.5,
622
- type=float,
623
- help="Dilation of lv epi ellipsoid in the y-direction",
624
- show_default=True,
625
- )
626
- @click.option(
627
- "--c-epi-lv",
628
- default=1.5,
629
- type=float,
630
- help="Dilation of lv epi ellipsoid in the y-direction",
631
- show_default=True,
632
- )
633
- @click.option(
634
- "--center-rv-x",
635
- default=0.0,
636
- type=float,
637
- help="X-coordinate for the center of the rv",
638
- show_default=True,
639
- )
640
- @click.option(
641
- "--center-rv-y",
642
- default=0.5,
643
- type=float,
644
- help="Y-coordinate for the center of the rv",
645
- show_default=True,
646
- )
647
- @click.option(
648
- "--center-rv-z",
649
- default=0.0,
650
- type=float,
651
- help="Z-coordinate for the center of the rv",
652
- show_default=True,
653
- )
654
- @click.option(
655
- "--a-endo-rv",
656
- default=3.0,
657
- type=float,
658
- help="Dilation of rv endo ellipsoid in the x-direction",
659
- show_default=True,
660
- )
661
- @click.option(
662
- "--b-endo-rv",
663
- default=1.5,
664
- type=float,
665
- help="Dilation of rv endo ellipsoid in the y-direction",
666
- show_default=True,
667
- )
668
- @click.option(
669
- "--c-endo-rv",
670
- default=1.5,
671
- type=float,
672
- help="Dilation of rv endo ellipsoid in the y-direction",
673
- show_default=True,
674
- )
675
- @click.option(
676
- "--a-epi-rv",
677
- default=4.0,
678
- type=float,
679
- help="Dilation of rv epi ellipsoid in the x-direction",
680
- show_default=True,
681
- )
682
- @click.option(
683
- "--b-epi-rv",
684
- default=2.5,
685
- type=float,
686
- help="Dilation of rv epi ellipsoid in the y-direction",
687
- show_default=True,
688
- )
689
- @click.option(
690
- "--c-epi-rv",
691
- default=2.0,
692
- type=float,
693
- help="Dilation of rv epi ellipsoid in the z-direction",
694
- show_default=True,
695
- )
696
- @click.option(
697
- "--create-fibers",
698
- default=False,
419
+ "-v",
420
+ "--verbose",
699
421
  is_flag=True,
700
- help="If True create analytic fibers",
701
- show_default=True,
702
- )
703
- @click.option(
704
- "--fiber-angle-endo",
705
- default=-60,
706
- type=float,
707
- help="Angle for the endocardium",
708
- show_default=True,
709
- )
710
- @click.option(
711
- "--fiber-angle-epi",
712
- default=+60,
713
- type=float,
714
- help="Angle for the epicardium",
715
- show_default=True,
716
- )
717
- @click.option(
718
- "--fiber-space",
719
- default="P_1",
720
- type=str,
721
- help="Function space for fibers of the form family_degree",
422
+ help="Enable verbose output",
722
423
  show_default=True,
723
424
  )
724
- def biv_ellipsoid_torso(
425
+ def biv_ellipsoid(
725
426
  outdir: Path,
726
- char_length: float = 0.5,
727
- heart_as_surface: bool = True,
728
- torso_length: float = 20.0,
729
- torso_width: float = 20.0,
730
- torso_height: float = 20.0,
731
- rotation_angle: float = math.pi / 6,
732
- center_lv_x: float = 0.0,
733
- center_lv_y: float = 0.0,
734
- center_lv_z: float = 0.0,
735
- a_endo_lv: float = 2.5,
736
- b_endo_lv: float = 1.0,
737
- c_endo_lv: float = 1.0,
738
- a_epi_lv: float = 3.0,
739
- b_epi_lv: float = 1.5,
740
- c_epi_lv: float = 1.5,
741
- center_rv_x: float = 0.0,
742
- center_rv_y: float = 0.5,
743
- center_rv_z: float = 0.0,
744
- a_endo_rv: float = 3.0,
745
- b_endo_rv: float = 1.5,
746
- c_endo_rv: float = 1.5,
747
- a_epi_rv: float = 4.0,
748
- b_epi_rv: float = 2.5,
749
- c_epi_rv: float = 2.0,
427
+ char_length: float = 0.4, # cm
428
+ base_cut_z: float = 2.5,
429
+ box_size: float = 15.0, # Size of the cutting box
430
+ rv_wall_thickness: float = 0.4, # cm
431
+ lv_wall_thickness: float = 0.5, # cm
432
+ rv_offset_x: float = 3.0,
433
+ lv_radius_x: float = 2.0,
434
+ lv_radius_y: float = 1.8,
435
+ lv_radius_z: float = 3.25,
436
+ rv_radius_x: float = 1.9,
437
+ rv_radius_y: float = 2.5,
438
+ rv_radius_z: float = 3.0,
750
439
  create_fibers: bool = False,
751
440
  fiber_angle_endo: float = -60,
752
441
  fiber_angle_epi: float = +60,
753
442
  fiber_space: str = "P_1",
443
+ verbose: bool = False,
754
444
  ):
445
+ init_logging(verbose=verbose)
755
446
  outdir = Path(outdir)
756
447
  outdir.mkdir(exist_ok=True)
757
448
 
758
- geo = mesh.biv_ellipsoid_torso(
449
+ geo = mesh.biv_ellipsoid(
759
450
  outdir=outdir,
760
451
  char_length=char_length,
761
- heart_as_surface=heart_as_surface,
762
- torso_length=torso_length,
763
- torso_height=torso_height,
764
- torso_width=torso_width,
765
- rotation_angle=rotation_angle,
766
- center_lv_x=center_lv_x,
767
- center_lv_y=center_lv_y,
768
- center_lv_z=center_lv_z,
769
- a_endo_lv=a_endo_lv,
770
- b_endo_lv=b_endo_lv,
771
- c_endo_lv=c_endo_lv,
772
- a_epi_lv=a_epi_lv,
773
- b_epi_lv=b_epi_lv,
774
- c_epi_lv=c_epi_lv,
775
- center_rv_x=center_rv_x,
776
- center_rv_y=center_rv_y,
777
- center_rv_z=center_rv_z,
778
- a_endo_rv=a_endo_rv,
779
- b_endo_rv=b_endo_rv,
780
- c_endo_rv=c_endo_rv,
781
- a_epi_rv=a_epi_rv,
782
- b_epi_rv=b_epi_rv,
783
- c_epi_rv=c_epi_rv,
452
+ base_cut_z=base_cut_z,
453
+ box_size=box_size,
454
+ rv_wall_thickness=rv_wall_thickness,
455
+ lv_wall_thickness=lv_wall_thickness,
456
+ rv_offset_x=rv_offset_x,
457
+ lv_radius_x=lv_radius_x,
458
+ lv_radius_y=lv_radius_y,
459
+ lv_radius_z=lv_radius_z,
460
+ rv_radius_x=rv_radius_x,
461
+ rv_radius_y=rv_radius_y,
462
+ rv_radius_z=rv_radius_z,
784
463
  create_fibers=create_fibers,
785
464
  fiber_angle_endo=fiber_angle_endo,
786
465
  fiber_angle_epi=fiber_angle_epi,
787
466
  fiber_space=fiber_space,
467
+ verbose=verbose,
788
468
  )
789
-
790
- geo.save(outdir / "biv_ellipsoid_torso.bp")
469
+ geo.save(outdir / "biv_ellipsoid.bp")
791
470
 
792
471
 
793
472
  @click.command(help="Create slab geometry")
@@ -1310,7 +989,6 @@ def gui():
1310
989
 
1311
990
  app.add_command(lv_ellipsoid)
1312
991
  app.add_command(biv_ellipsoid)
1313
- app.add_command(biv_ellipsoid_torso)
1314
992
  app.add_command(slab)
1315
993
  app.add_command(slab_in_bath)
1316
994
  app.add_command(gui)
@@ -51,8 +51,6 @@ def load_geometry(folder: str):
51
51
  def plot_geometry(geo):
52
52
  V = dolfinx.fem.functionspace(geo.mesh, ("Lagrange", 1))
53
53
 
54
- pv.start_xvfb()
55
-
56
54
  # Plot the mesh with cell tags
57
55
  mesh_plotter = pv.Plotter()
58
56
  mesh_plotter.background_color = "white"
@@ -211,27 +211,29 @@ def ukb(
211
211
  return geo
212
212
 
213
213
 
214
+ def transform_biv_markers(markers: dict[str, tuple[int, int]]) -> dict[str, list[int]]:
215
+ return {
216
+ "base": [markers["BASE"][0]],
217
+ "lv": [markers["LV_ENDO_FW"][0], markers["LV_SEPTUM"][0]],
218
+ "rv": [markers["RV_ENDO_FW"][0], markers["RV_SEPTUM"][0]],
219
+ "epi": [markers["LV_EPI_FW"][0], markers["RV_EPI_FW"][0]],
220
+ }
221
+
222
+
214
223
  def biv_ellipsoid(
215
224
  outdir: str | Path,
216
225
  char_length: float = 0.5,
217
- center_lv_x: float = 0.0,
218
- center_lv_y: float = 0.0,
219
- center_lv_z: float = 0.0,
220
- a_endo_lv: float = 2.5,
221
- b_endo_lv: float = 1.0,
222
- c_endo_lv: float = 1.0,
223
- a_epi_lv: float = 3.0,
224
- b_epi_lv: float = 1.5,
225
- c_epi_lv: float = 1.5,
226
- center_rv_x: float = 0.0,
227
- center_rv_y: float = 0.5,
228
- center_rv_z: float = 0.0,
229
- a_endo_rv: float = 3.0,
230
- b_endo_rv: float = 1.5,
231
- c_endo_rv: float = 1.5,
232
- a_epi_rv: float = 4.0,
233
- b_epi_rv: float = 2.5,
234
- c_epi_rv: float = 2.0,
226
+ base_cut_z: float = 2.5,
227
+ box_size: float = 15.0, # Size of the cutting box
228
+ rv_wall_thickness: float = 0.4, # cm
229
+ lv_wall_thickness: float = 0.5, # cm
230
+ rv_offset_x: float = 2.5,
231
+ lv_radius_x: float = 2.0,
232
+ lv_radius_y: float = 1.8,
233
+ lv_radius_z: float = 3.25,
234
+ rv_radius_x: float = 1.9,
235
+ rv_radius_y: float = 2.5,
236
+ rv_radius_z: float = 3.0,
235
237
  create_fibers: bool = False,
236
238
  fiber_angle_endo: float = 60,
237
239
  fiber_angle_epi: float = -60,
@@ -247,42 +249,20 @@ def biv_ellipsoid(
247
249
  Directory where to save the results.
248
250
  char_length : float, optional
249
251
  Characteristic length of mesh, by default 0.5
250
- center_lv_y : float, optional
251
- X-coordinate for the center of the lv, by default 0.0
252
- center_lv_y : float, optional
253
- Y-coordinate for the center of the lv, by default 0.0
254
- center_lv_z : float, optional
255
- Z-coordinate for the center of the lv, by default 0.0
256
- a_endo_lv : float, optional
257
- Dilation of lv endo ellipsoid in the x-direction, by default 2.5
258
- b_endo_lv : float, optional
259
- Dilation of lv endo ellipsoid in the y-direction, by default 1.0
260
- c_endo_lv : float, optional
261
- Dilation of lv endo ellipsoid in the z-direction, by default 1.0
262
- a_epi_lv : float, optional
263
- Dilation of lv epi ellipsoid in the x-direction, by default 3.0
264
- b_epi_lv : float, optional
265
- Dilation of lv epi ellipsoid in the y-direction, by default 1.5
266
- c_epi_lv : float, optional
267
- Dilation of lv epi ellipsoid in the z-direction, by default 1.5
268
- center_rv_x : float, optional
269
- X-coordinate for the center of the rv, by default 0.0
270
- center_rv_y : float, optional
271
- Y-coordinate for the center of the rv, by default 0.5
272
- center_rv_z : float, optional
273
- Z-coordinate for the center of the rv, by default 0.0
274
- a_endo_rv : float, optional
275
- Dilation of rv endo ellipsoid in the x-direction, by default 3.0
276
- b_endo_rv : float, optional
277
- Dilation of rv endo ellipsoid in the y-direction, by default 1.5
278
- c_endo_rv : float, optional
279
- Dilation of rv endo ellipsoid in the z-direction, by default 1.5
280
- a_epi_rv : float, optional
281
- Dilation of rv epi ellipsoid in the x-direction, by default 4.0
282
- b_epi_rv : float, optional
283
- Dilation of rv epi ellipsoid in the y-direction, by default 2.5
284
- c_epi_rv : float, optional
285
- Dilation of rv epi ellipsoid in the z-direction, by default 2.0
252
+ box_size : float, optional
253
+ Size of the cutting box, by default 15.0
254
+ lv_radius_x : float, optional
255
+ Radius of the left ventricle in the x-direction, by default 2.0
256
+ lv_radius_y : float, optional
257
+ Radius of the left ventricle in the y-direction, by default 1.8
258
+ lv_radius_z : float, optional
259
+ Radius of the left ventricle in the z-direction, by default 3.25
260
+ rv_radius_x : float, optional
261
+ Radius of the right ventricle in the x-direction, by default 1.9
262
+ rv_radius_y : float, optional
263
+ Radius of the right ventricle in the y-direction, by default 2.5
264
+ rv_radius_z : float, optional
265
+ Radius of the right ventricle in the z-direction, by default 3.0
286
266
  create_fibers : bool, optional
287
267
  If True create analytic fibers, by default False
288
268
  fiber_angle_endo : float, optional
@@ -311,24 +291,17 @@ def biv_ellipsoid(
311
291
  json.dump(
312
292
  {
313
293
  "char_length": char_length,
314
- "center_lv_x": center_lv_x,
315
- "center_lv_y": center_lv_y,
316
- "center_lv_z": center_lv_z,
317
- "a_endo_lv": a_endo_lv,
318
- "b_endo_lv": b_endo_lv,
319
- "c_endo_lv": c_endo_lv,
320
- "a_epi_lv": a_epi_lv,
321
- "b_epi_lv": b_epi_lv,
322
- "c_epi_lv": c_epi_lv,
323
- "center_rv_x": center_rv_x,
324
- "center_rv_y": center_rv_y,
325
- "center_rv_z": center_rv_z,
326
- "a_endo_rv": a_endo_rv,
327
- "b_endo_rv": b_endo_rv,
328
- "c_endo_rv": c_endo_rv,
329
- "a_epi_rv": a_epi_rv,
330
- "b_epi_rv": b_epi_rv,
331
- "c_epi_rv": c_epi_rv,
294
+ "base_cut_z": base_cut_z,
295
+ "box_size": box_size,
296
+ "rv_wall_thickness": rv_wall_thickness,
297
+ "lv_wall_thickness": lv_wall_thickness,
298
+ "rv_offset_x": rv_offset_x,
299
+ "lv_radius_x": lv_radius_x,
300
+ "lv_radius_y": lv_radius_y,
301
+ "lv_radius_z": lv_radius_z,
302
+ "rv_radius_x": rv_radius_x,
303
+ "rv_radius_y": rv_radius_y,
304
+ "rv_radius_z": rv_radius_z,
332
305
  "create_fibers": create_fibers,
333
306
  "fiber_angle_endo": fiber_angle_endo,
334
307
  "fiber_angle_epi": fiber_angle_epi,
@@ -345,24 +318,17 @@ def biv_ellipsoid(
345
318
  cgc.biv_ellipsoid(
346
319
  mesh_name=mesh_name.as_posix(),
347
320
  char_length=char_length,
348
- center_lv_x=center_lv_x,
349
- center_lv_y=center_lv_y,
350
- center_lv_z=center_lv_z,
351
- a_endo_lv=a_endo_lv,
352
- b_endo_lv=b_endo_lv,
353
- c_endo_lv=c_endo_lv,
354
- a_epi_lv=a_epi_lv,
355
- b_epi_lv=b_epi_lv,
356
- c_epi_lv=c_epi_lv,
357
- center_rv_x=center_rv_x,
358
- center_rv_y=center_rv_y,
359
- center_rv_z=center_rv_z,
360
- a_endo_rv=a_endo_rv,
361
- b_endo_rv=b_endo_rv,
362
- c_endo_rv=c_endo_rv,
363
- a_epi_rv=a_epi_rv,
364
- b_epi_rv=b_epi_rv,
365
- c_epi_rv=c_epi_rv,
321
+ base_cut_z=base_cut_z,
322
+ box_size=box_size,
323
+ rv_wall_thickness=rv_wall_thickness,
324
+ lv_wall_thickness=lv_wall_thickness,
325
+ rv_offset_x=rv_offset_x,
326
+ lv_radius_x=lv_radius_x,
327
+ lv_radius_y=lv_radius_y,
328
+ lv_radius_z=lv_radius_z,
329
+ rv_radius_x=rv_radius_x,
330
+ rv_radius_y=rv_radius_y,
331
+ rv_radius_z=rv_radius_z,
366
332
  verbose=verbose,
367
333
  )
368
334
  comm.barrier()
@@ -382,10 +348,12 @@ def biv_ellipsoid(
382
348
  )
383
349
  raise ImportError(msg)
384
350
 
351
+ ldrb_markers = transform_biv_markers(geometry.markers)
352
+
385
353
  system = ldrb.dolfinx_ldrb(
386
354
  mesh=geometry.mesh,
387
355
  ffun=geometry.ffun,
388
- markers=geometry.markers,
356
+ markers=ldrb_markers,
389
357
  alpha_endo_lv=fiber_angle_endo,
390
358
  alpha_epi_lv=fiber_angle_epi,
391
359
  beta_endo_lv=0,
@@ -403,218 +371,6 @@ def biv_ellipsoid(
403
371
  return geo
404
372
 
405
373
 
406
- def biv_ellipsoid_torso(
407
- outdir: str | Path,
408
- char_length: float = 0.5,
409
- heart_as_surface: bool = False,
410
- torso_length: float = 20.0,
411
- torso_width: float = 20.0,
412
- torso_height: float = 20.0,
413
- rotation_angle: float = math.pi / 6,
414
- center_lv_x: float = 0.0,
415
- center_lv_y: float = 0.0,
416
- center_lv_z: float = 0.0,
417
- a_endo_lv: float = 2.5,
418
- b_endo_lv: float = 1.0,
419
- c_endo_lv: float = 1.0,
420
- a_epi_lv: float = 3.0,
421
- b_epi_lv: float = 1.5,
422
- c_epi_lv: float = 1.5,
423
- center_rv_x: float = 0.0,
424
- center_rv_y: float = 0.5,
425
- center_rv_z: float = 0.0,
426
- a_endo_rv: float = 3.0,
427
- b_endo_rv: float = 1.5,
428
- c_endo_rv: float = 1.5,
429
- a_epi_rv: float = 4.0,
430
- b_epi_rv: float = 2.5,
431
- c_epi_rv: float = 2.0,
432
- create_fibers: bool = False,
433
- fiber_angle_endo: float = 60,
434
- fiber_angle_epi: float = -60,
435
- fiber_space: str = "P_1",
436
- verbose: bool = False,
437
- comm: MPI.Comm = MPI.COMM_WORLD,
438
- ) -> Geometry:
439
- """Create BiV ellipsoidal geometry
440
-
441
- Parameters
442
- ----------
443
- outdir : str | Path
444
- Directory where to save the results.
445
- char_length : float, optional
446
- Characteristic length of mesh, by default 0.5
447
- heart_as_surface: bool
448
- If true, create the heart as a a surface inside the torso,
449
- otherwise let the heart be a volume, by default True.
450
- torso_length : float, optional
451
- Length of torso in the x-direction, by default 20.0
452
- torso_width : float, optional
453
- Length of torso in the y-direction, by default 20.0
454
- torso_height : float, optional
455
- Length of torso in the z-direction, by default 20.0
456
- rotation_angle: float, optional
457
- Angle to rotate the torso in order to object realistic position of
458
- the heart in a torso, by default pi / 6
459
- center_lv_x : float, optional
460
- X-coordinate for the center of the lv, by default 0.0
461
- center_lv_y : float, optional
462
- Y-coordinate for the center of the lv, by default 0.0
463
- center_lv_z : float, optional
464
- Z-coordinate for the center of the lv, by default 0.0
465
- a_endo_lv : float, optional
466
- Dilation of lv endo ellipsoid in the x-direction, by default 2.5
467
- b_endo_lv : float, optional
468
- Dilation of lv endo ellipsoid in the y-direction, by default 1.0
469
- c_endo_lv : float, optional
470
- Dilation of lv endo ellipsoid in the z-direction, by default 1.0
471
- a_epi_lv : float, optional
472
- Dilation of lv epi ellipsoid in the x-direction, by default 3.0
473
- b_epi_lv : float, optional
474
- Dilation of lv epi ellipsoid in the y-direction, by default 1.5
475
- c_epi_lv : float, optional
476
- Dilation of lv epi ellipsoid in the z-direction, by default 1.5
477
- center_rv_x : float, optional
478
- X-coordinate for the center of the rv, by default 0.0
479
- center_rv_y : float, optional
480
- Y-coordinate for the center of the rv, by default 0.5
481
- center_rv_z : float, optional
482
- Z-coordinate for the center of the rv, by default 0.0
483
- a_endo_rv : float, optional
484
- Dilation of rv endo ellipsoid in the x-direction, by default 3.0
485
- b_endo_rv : float, optional
486
- Dilation of rv endo ellipsoid in the y-direction, by default 1.5
487
- c_endo_rv : float, optional
488
- Dilation of rv endo ellipsoid in the z-direction, by default 1.5
489
- a_epi_rv : float, optional
490
- Dilation of rv epi ellipsoid in the x-direction, by default 4.0
491
- b_epi_rv : float, optional
492
- Dilation of rv epi ellipsoid in the y-direction, by default 2.5
493
- c_epi_rv : float, optional
494
- Dilation of rv epi ellipsoid in the z-direction, by default 2.0
495
- create_fibers : bool, optional
496
- If True create analytic fibers, by default False
497
- fiber_angle_endo : float, optional
498
- Angle for the endocardium, by default 60
499
- fiber_angle_epi : float, optional
500
- Angle for the epicardium, by default -60
501
- fiber_space : str, optional
502
- Function space for fibers of the form family_degree, by default "P_1"
503
- verbose : bool, optional
504
- If True print information from gmsh, by default False
505
- comm : MPI.Comm, optional
506
- MPI communicator, by default MPI.COMM_WORLD
507
-
508
- Returns
509
- -------
510
- cardiac_geometries.geometry.Geometry
511
- A Geometry with the mesh, markers, markers functions and fibers.
512
-
513
- """
514
- outdir = Path(outdir)
515
- mesh_name = outdir / "biv_ellipsoid_torso.msh"
516
- if comm.rank == 0:
517
- outdir.mkdir(exist_ok=True, parents=True)
518
-
519
- with open(outdir / "info.json", "w") as f:
520
- json.dump(
521
- {
522
- "char_length": char_length,
523
- "heart_as_surface": heart_as_surface,
524
- "torso_length": torso_length,
525
- "torso_width": torso_width,
526
- "torso_height": torso_height,
527
- "rotation_angle": rotation_angle,
528
- "center_lv_x": center_lv_x,
529
- "center_lv_y": center_lv_y,
530
- "center_lv_z": center_lv_z,
531
- "a_endo_lv": a_endo_lv,
532
- "b_endo_lv": b_endo_lv,
533
- "c_endo_lv": c_endo_lv,
534
- "a_epi_lv": a_epi_lv,
535
- "b_epi_lv": b_epi_lv,
536
- "c_epi_lv": c_epi_lv,
537
- "center_rv_x": center_rv_x,
538
- "center_rv_y": center_rv_y,
539
- "center_rv_z": center_rv_z,
540
- "a_endo_rv": a_endo_rv,
541
- "b_endo_rv": b_endo_rv,
542
- "c_endo_rv": c_endo_rv,
543
- "a_epi_rv": a_epi_rv,
544
- "b_epi_rv": b_epi_rv,
545
- "c_epi_rv": c_epi_rv,
546
- "create_fibers": create_fibers,
547
- "fiber_angle_endo": fiber_angle_endo,
548
- "fiber_angle_epi": fiber_angle_epi,
549
- "fiber_space": fiber_space,
550
- "mesh_type": "biv",
551
- "cardiac_geometry_version": __version__,
552
- "timestamp": datetime.datetime.now().isoformat(),
553
- },
554
- f,
555
- indent=2,
556
- default=utils.json_serial,
557
- )
558
-
559
- cgc.biv_ellipsoid_torso(
560
- mesh_name=mesh_name.as_posix(),
561
- char_length=char_length,
562
- heart_as_surface=heart_as_surface,
563
- torso_length=torso_length,
564
- torso_height=torso_height,
565
- torso_width=torso_width,
566
- rotation_angle=rotation_angle,
567
- center_lv_x=center_lv_x,
568
- center_lv_y=center_lv_y,
569
- center_lv_z=center_lv_z,
570
- a_endo_lv=a_endo_lv,
571
- b_endo_lv=b_endo_lv,
572
- c_endo_lv=c_endo_lv,
573
- a_epi_lv=a_epi_lv,
574
- b_epi_lv=b_epi_lv,
575
- c_epi_lv=c_epi_lv,
576
- center_rv_x=center_rv_x,
577
- center_rv_y=center_rv_y,
578
- center_rv_z=center_rv_z,
579
- a_endo_rv=a_endo_rv,
580
- b_endo_rv=b_endo_rv,
581
- c_endo_rv=c_endo_rv,
582
- a_epi_rv=a_epi_rv,
583
- b_epi_rv=b_epi_rv,
584
- c_epi_rv=c_epi_rv,
585
- verbose=verbose,
586
- )
587
- comm.barrier()
588
-
589
- geometry = utils.gmsh2dolfin(comm=comm, msh_file=mesh_name)
590
-
591
- if comm.rank == 0:
592
- with open(outdir / "markers.json", "w") as f:
593
- json.dump(geometry.markers, f, default=utils.json_serial)
594
- comm.barrier()
595
-
596
- if create_fibers:
597
- if heart_as_surface:
598
- logger.warning("Can only create fibers when heart is a volume.")
599
- else:
600
- raise NotImplementedError("Fibers not implemented yet for biv ellipsoid.")
601
- # from .fibers._biv_ellipsoid import create_biv_in_torso_fibers
602
-
603
- # create_biv_in_torso_fibers(
604
- # mesh=geometry.mesh,
605
- # ffun=geometry.marker_functions.ffun,
606
- # cfun=geometry.marker_functions.cfun,
607
- # markers=geometry.markers,
608
- # fiber_space=fiber_space,
609
- # alpha_endo=fiber_angle_endo,
610
- # alpha_epi=fiber_angle_epi,
611
- # outdir=outdir,
612
- # )
613
-
614
- geo = Geometry.from_folder(comm=comm, folder=outdir)
615
- return geo
616
-
617
-
618
374
  def lv_ellipsoid(
619
375
  outdir: Path | str,
620
376
  r_short_endo: float = 7.0,
@@ -14,6 +14,11 @@ from dolfinx.graph import adjacencylist
14
14
  from packaging.version import Version
15
15
  from structlog import get_logger
16
16
 
17
+ try:
18
+ import dolfinx.io.gmsh as gmshio
19
+ except ImportError:
20
+ import dolfinx.io.gmshio as gmshio # type: ignore[import]
21
+
17
22
  logger = get_logger()
18
23
 
19
24
  quads = ("Quadrature", "Q", "Quad", "quadrature", "q", "quad")
@@ -90,8 +95,8 @@ def model_to_mesh(
90
95
  if comm.rank == rank:
91
96
  assert model is not None, "Gmsh model is None on rank responsible for mesh creation."
92
97
  # Get mesh geometry and mesh topology for each element
93
- x = dolfinx.io.gmshio.extract_geometry(model)
94
- topologies = dolfinx.io.gmshio.extract_topology_and_markers(model)
98
+ x = gmshio.extract_geometry(model)
99
+ topologies = gmshio.extract_topology_and_markers(model)
95
100
 
96
101
  # Extract Gmsh cell id, dimension of cell and number of nodes to
97
102
  # cell for each
@@ -170,8 +175,8 @@ def model_to_mesh(
170
175
  vertex_values = np.empty((0,), dtype=np.int32)
171
176
 
172
177
  # Create distributed mesh
173
- ufl_domain = dolfinx.io.gmshio.ufl_mesh(cell_id, gdim, dtype=dtype)
174
- gmsh_cell_perm = dolfinx.io.gmshio.cell_perm_array(
178
+ ufl_domain = gmshio.ufl_mesh(cell_id, gdim, dtype=dtype)
179
+ gmsh_cell_perm = gmshio.cell_perm_array(
175
180
  dolfinx.cpp.mesh.to_type(str(ufl_domain.ufl_cell())), num_nodes
176
181
  )
177
182
  cells = cells[:, gmsh_cell_perm].copy()
@@ -207,7 +212,7 @@ def model_to_mesh(
207
212
  facet_type = dolfinx.cpp.mesh.cell_entity_type(
208
213
  dolfinx.cpp.mesh.to_type(str(ufl_domain.ufl_cell())), tdim - 1, 0
209
214
  )
210
- gmsh_facet_perm = dolfinx.io.gmshio.cell_perm_array(facet_type, num_facet_nodes)
215
+ gmsh_facet_perm = gmshio.cell_perm_array(facet_type, num_facet_nodes)
211
216
  marked_facets = marked_facets[:, gmsh_facet_perm]
212
217
 
213
218
  local_entities, local_values = distribute_entity_data(
@@ -217,7 +222,7 @@ def model_to_mesh(
217
222
  mesh.topology.create_connectivity(topology.dim - 1, tdim)
218
223
  adj = adjacencylist(local_entities)
219
224
 
220
- ft = dolfinx.io.gmshio.meshtags_from_entities(
225
+ ft = gmshio.meshtags_from_entities(
221
226
  mesh, tdim - 1, adj, local_values.astype(np.int32, copy=False)
222
227
  )
223
228
  ft.name = "Facet tags"
@@ -231,7 +236,7 @@ def model_to_mesh(
231
236
  edge_type = dolfinx.cpp.mesh.cell_entity_type(
232
237
  dolfinx.cpp.mesh.to_type(str(ufl_domain.ufl_cell())), tdim - 2, 0
233
238
  )
234
- gmsh_edge_perm = dolfinx.io.gmshio.cell_perm_array(edge_type, num_edge_nodes)
239
+ gmsh_edge_perm = gmshio.cell_perm_array(edge_type, num_edge_nodes)
235
240
  marked_edges = marked_edges[:, gmsh_edge_perm]
236
241
 
237
242
  local_entities, local_values = distribute_entity_data(
@@ -239,7 +244,7 @@ def model_to_mesh(
239
244
  )
240
245
  mesh.topology.create_connectivity(topology.dim - 2, tdim)
241
246
  adj = adjacencylist(local_entities)
242
- et = dolfinx.io.gmshio.meshtags_from_entities(
247
+ et = gmshio.meshtags_from_entities(
243
248
  mesh, tdim - 2, adj, local_values.astype(np.int32, copy=False)
244
249
  )
245
250
  et.name = "Edge tags"
@@ -253,7 +258,7 @@ def model_to_mesh(
253
258
  vertex_type = dolfinx.cpp.mesh.cell_entity_type(
254
259
  dolfinx.cpp.mesh.to_type(str(ufl_domain.ufl_cell())), tdim - 3, 0
255
260
  )
256
- gmsh_vertex_perm = dolfinx.io.gmshio.cell_perm_array(vertex_type, num_vertex_nodes)
261
+ gmsh_vertex_perm = gmshio.cell_perm_array(vertex_type, num_vertex_nodes)
257
262
  marked_vertices = marked_vertices[:, gmsh_vertex_perm]
258
263
 
259
264
  local_entities, local_values = distribute_entity_data(
@@ -261,7 +266,7 @@ def model_to_mesh(
261
266
  )
262
267
  mesh.topology.create_connectivity(topology.dim - 3, tdim)
263
268
  adj = adjacencylist(local_entities)
264
- vt = dolfinx.io.gmshio.meshtags_from_entities(
269
+ vt = gmshio.meshtags_from_entities(
265
270
  mesh, tdim - 3, adj, local_values.astype(np.int32, copy=False)
266
271
  )
267
272
  vt.name = "Vertex tags"
@@ -281,7 +286,7 @@ def parse_element(
281
286
  """
282
287
 
283
288
  family_str, degree_str = space_string.split("_")
284
- kwargs = {"degree": int(degree_str), "cell": mesh.ufl_cell().cellname()}
289
+ kwargs = {"degree": int(degree_str), "cell": mesh.basix_cell()}
285
290
  if dim > 1:
286
291
  if family_str in quads:
287
292
  kwargs["value_shape"] = (dim,)
@@ -425,7 +430,7 @@ def gmsh2dolfin(comm: MPI.Intracomm, msh_file, rank: int = 0) -> GMshGeometry:
425
430
  outdir.mkdir(parents=True, exist_ok=True)
426
431
 
427
432
  if Version(dolfinx.__version__) >= Version("0.10.0"):
428
- mesh_data = dolfinx.io.gmshio.read_from_msh(comm=comm, filename=msh_file)
433
+ mesh_data = gmshio.read_from_msh(comm=comm, filename=msh_file)
429
434
  mesh = mesh_data.mesh
430
435
  markers_ = mesh_data.physical_groups
431
436
  ct = mesh_data.cell_tags
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cardiac-geometriesx
3
- Version: 0.6.1
3
+ Version: 0.7.0
4
4
  Summary: A python library for cardiac geometries
5
5
  Author-email: Henrik Finsberg <henriknf@simula.no>
6
6
  License: MIT
@@ -29,11 +29,14 @@ Provides-Extra: docs
29
29
  Requires-Dist: jupyter-book; extra == "docs"
30
30
  Requires-Dist: jupytext; extra == "docs"
31
31
  Requires-Dist: jupyter; extra == "docs"
32
- Requires-Dist: pyvista[all]>=0.43.0; extra == "docs"
32
+ Requires-Dist: pyvista[all]>=0.45.0; extra == "docs"
33
+ Requires-Dist: vtk>=9.5.0; extra == "docs"
33
34
  Requires-Dist: trame-vuetify; extra == "docs"
34
35
  Requires-Dist: ipywidgets; extra == "docs"
35
36
  Requires-Dist: fenicsx-ldrb; extra == "docs"
36
37
  Requires-Dist: ukb-atlas; extra == "docs"
38
+ Requires-Dist: sphinx-codeautolink; extra == "docs"
39
+ Requires-Dist: sphinx-copybutton; extra == "docs"
37
40
  Provides-Extra: test
38
41
  Requires-Dist: pre-commit; extra == "test"
39
42
  Requires-Dist: pytest; extra == "test"
@@ -17,11 +17,14 @@ wheel
17
17
  jupyter-book
18
18
  jupytext
19
19
  jupyter
20
- pyvista[all]>=0.43.0
20
+ pyvista[all]>=0.45.0
21
+ vtk>=9.5.0
21
22
  trame-vuetify
22
23
  ipywidgets
23
24
  fenicsx-ldrb
24
25
  ukb-atlas
26
+ sphinx-codeautolink
27
+ sphinx-copybutton
25
28
 
26
29
  [gui]
27
30
  streamlit
@@ -81,9 +81,8 @@ def test_biv_fibers(tmp_path: Path):
81
81
  [
82
82
  cli.slab_in_bath,
83
83
  cli.biv_ellipsoid,
84
- cli.biv_ellipsoid_torso,
85
84
  ],
86
- ids=["slab_in_bath", "biv_ellipsoid", "biv_ellipsoid_torso"],
85
+ ids=["slab_in_bath", "biv_ellipsoid"],
87
86
  )
88
87
  @pytest.mark.skipif(gmsh.__version__ == "4.14.0", reason="GMSH 4.14.0 has a bug with fuse")
89
88
  def test_script_no_fibers(script, tmp_path: Path):
@@ -132,7 +132,7 @@ def test_load_from_folder_mesh_and_function(tmp_path):
132
132
  mesh,
133
133
  basix.ufl.element(
134
134
  family="Lagrange",
135
- cell=mesh.ufl_cell().cellname(),
135
+ cell=mesh.basix_cell(),
136
136
  degree=1,
137
137
  discontinuous=False,
138
138
  shape=(3,),