GANDLF 0.1.4.dev20250707__py3-none-any.whl → 0.1.5.dev20250709__py3-none-any.whl

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.
@@ -1,6 +1,7 @@
1
1
  from pathlib import Path
2
- import tempfile
2
+ import os
3
3
 
4
+ from typing import Optional
4
5
  import numpy as np
5
6
 
6
7
  from panoptica import Panoptica_Evaluator
@@ -9,8 +10,8 @@ from panoptica import Panoptica_Evaluator
9
10
  def generate_instance_segmentation(
10
11
  prediction: np.ndarray,
11
12
  target: np.ndarray,
12
- parameters: dict = None,
13
- panoptica_config_path: str = None,
13
+ parameters: dict,
14
+ panoptica_config_path: Optional[str] = None,
14
15
  ) -> dict:
15
16
  """
16
17
  Evaluate a single exam using Panoptica.
@@ -19,29 +20,27 @@ def generate_instance_segmentation(
19
20
  prediction (np.ndarray): The input prediction containing objects.
20
21
  label_path (str): The path to the reference label.
21
22
  target (np.ndarray): The input target containing objects.
23
+ parameters (dict): The GaNDLF parameters from which panoptica config is to be extracted.
22
24
  panoptica_config_path (str): The path to the Panoptica configuration file.
23
25
 
24
26
  Returns:
25
27
  dict: The evaluation results.
26
28
  """
27
29
 
28
- cwd = Path(__file__).parent.absolute()
30
+ os.environ["PANOPTICA_CITATION_REMINDER"] = "False"
31
+
29
32
  # the parameters dict takes precedence over the panoptica_config_path
30
- panoptica_config = parameters.get("panoptica_config", None)
31
- if panoptica_config is None:
33
+ evaluator = parameters.get("panoptica_config", None)
34
+ if evaluator is None:
35
+ cwd = Path(__file__).parent.absolute()
32
36
  panoptica_config_path = (
33
- cwd / "panoptica_config_brats.yaml"
37
+ str(cwd / "panoptica_config_brats.yaml")
34
38
  if panoptica_config_path is None
35
39
  else panoptica_config_path
36
40
  )
37
- else:
38
- # write the panoptica config to a file
39
- panoptica_config_path = tempfile.NamedTemporaryFile(
40
- mode="w", delete=False, suffix=".yaml"
41
- ).name
42
- with open(panoptica_config_path, "w") as f:
43
- f.write(panoptica_config)
44
- evaluator = Panoptica_Evaluator.load_from_config(panoptica_config_path)
41
+ evaluator = Panoptica_Evaluator.load_from_config(panoptica_config_path)
42
+
43
+ assert evaluator is not None, "Panoptica evaluator could not be initialized."
45
44
 
46
45
  # call evaluate
47
46
  group2result = evaluator.evaluate(prediction_arr=prediction, reference_arr=target)
GANDLF/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.1.4-dev20250707"
1
+ __version__ = "0.1.5-dev20250709"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GANDLF
3
- Version: 0.1.4.dev20250707
3
+ Version: 0.1.5.dev20250709
4
4
  Summary: PyTorch-based framework that handles segmentation/regression/classification using various DL architectures for medical imaging.
5
5
  Author: MLCommons
6
6
  Author-email: gandlf@mlcommons.org
@@ -5,7 +5,7 @@ GANDLF/logger.py,sha256=oamQ1SOTTpAnC8vQ67o211Q6_bExGg_hAuqlHGlJfAI,2951
5
5
  GANDLF/logging_config.yaml,sha256=9XxRxAKtLn5ehT1khpR8wEiJGW64sx1lylAspM5KaWk,1337
6
6
  GANDLF/parseConfig.py,sha256=jO-ybIPxLw23OWDvFdTukbft0ZM8UOofGnoL2C5CEps,754
7
7
  GANDLF/training_manager.py,sha256=AZlf-fl7KAwZgyre8-0M5lAyma6NvtiGX6XT51AJdxU,11436
8
- GANDLF/version.py,sha256=aUD6n0l6GU99YL_r_OUbcz48uaESPsxSIr0HcUgtMm8,34
8
+ GANDLF/version.py,sha256=mnOEOwW-y5mRKKq51jXVfaB7yp_oCF4ajPpScc4Y6eM,34
9
9
  GANDLF/anonymize/__init__.py,sha256=Nxig-jM-a-aKlK09PNi1zhNulEpLTyjnsY_oGQKdjhQ,1953
10
10
  GANDLF/anonymize/convert_to_nifti.py,sha256=MOfSDncFGJGb-EQP9sFGn0yuKpX010Ioi2KNwttaex8,1339
11
11
  GANDLF/cli/__init__.py,sha256=F05eyL2HKyWkHczRZuPE_Z2Yg685P9ARYxTwz6njGeQ,784
@@ -111,7 +111,7 @@ GANDLF/metrics/metric_calculators.py,sha256=c-NAl84yniTWjMKePBlf0TsCIJnYHODplt8H
111
111
  GANDLF/metrics/panoptica_config_brats.yaml,sha256=mTGSQuJoENuy84gZd2tHV0Dfl7GX5nIeE_46q5Vczx4,2685
112
112
  GANDLF/metrics/regression.py,sha256=Ca58jo9OL1GdjB2ZvQCcrKWz9F67iY5rcbnQxT-LpcU,4584
113
113
  GANDLF/metrics/segmentation.py,sha256=zqWEI6LuphFM0Nsm0sG2XeqAxpNJnoK1Z9q4FJt58c8,25645
114
- GANDLF/metrics/segmentation_panoptica.py,sha256=aFGF3q_Fnf5vIWaJDMHcs2Az_fb23l2cvvifnCkgPO0,1611
114
+ GANDLF/metrics/segmentation_panoptica.py,sha256=TNphTIU4C3e-hu62sDpRDW_h6_za9g_7TgEjEgaRclE,1598
115
115
  GANDLF/metrics/synthesis.py,sha256=IfYit-R0O5ZUfmsWfLD6BqcLjjoEiotx0lUdsXWlbao,6730
116
116
  GANDLF/models/MSDNet.py,sha256=mzBkw_kQigSDTxaR7tojhdI4ECIQ65i_qiCrNaZmBHI,3442
117
117
  GANDLF/models/__init__.py,sha256=3SwskWonRW1AduPe6CYQWucU8ZBkkfJUpEF34I0NWP0,4286
@@ -182,9 +182,9 @@ GANDLF/utils/parameter_processing.py,sha256=DA7ZEsizWWLJZnCxBnDNh1NyA-bw5oirOvod
182
182
  GANDLF/utils/pred_target_processors.py,sha256=aatXJ6jdJaNAHa_tPzHfC1gOQrPYJLtg-cYeUFvkM_s,2701
183
183
  GANDLF/utils/tensor.py,sha256=AOwNTQfw9mnsomGwOF2Q_rdDS1WANlIatB0hhZN0gSg,21504
184
184
  GANDLF/utils/write_parse.py,sha256=HROxskhet-uIdUJmz16z_7p9r0mf8hWsqQFygwZ8ap0,9202
185
- gandlf-0.1.4.dev20250707.dist-info/licenses/LICENSE,sha256=GlZPAfA4eckod8IVayhBXkqCpESXf6cc9BGli_Jwims,11357
186
- gandlf-0.1.4.dev20250707.dist-info/METADATA,sha256=5ChBddmfEN7ncF2b6dv1ZGCiJf9d2GMd9NHXHmAzjfo,9904
187
- gandlf-0.1.4.dev20250707.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
188
- gandlf-0.1.4.dev20250707.dist-info/entry_points.txt,sha256=agwocNI7Upi-sFDe1rMl71dGN8YhCBB7WJmtBHRF4jg,902
189
- gandlf-0.1.4.dev20250707.dist-info/top_level.txt,sha256=i5D9wEbQhl085_9Lx2m7x-9Zu6nlx1tjYYbuSihG09E,7
190
- gandlf-0.1.4.dev20250707.dist-info/RECORD,,
185
+ gandlf-0.1.5.dev20250709.dist-info/licenses/LICENSE,sha256=GlZPAfA4eckod8IVayhBXkqCpESXf6cc9BGli_Jwims,11357
186
+ gandlf-0.1.5.dev20250709.dist-info/METADATA,sha256=2E8SDmCeaQXUSBljeHCx3ciqkoDvBlQ-Rw_CPcD_eN4,9904
187
+ gandlf-0.1.5.dev20250709.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
188
+ gandlf-0.1.5.dev20250709.dist-info/entry_points.txt,sha256=agwocNI7Upi-sFDe1rMl71dGN8YhCBB7WJmtBHRF4jg,902
189
+ gandlf-0.1.5.dev20250709.dist-info/top_level.txt,sha256=i5D9wEbQhl085_9Lx2m7x-9Zu6nlx1tjYYbuSihG09E,7
190
+ gandlf-0.1.5.dev20250709.dist-info/RECORD,,