GANDLF 0.1.4.dev20250610__py3-none-any.whl → 0.1.4.dev20250612__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.
@@ -287,7 +287,7 @@ def generate_metrics_dict(
287
287
  pred_array = pred_tensor.squeeze(0).numpy().astype(int)
288
288
 
289
289
  overall_stats_dict[current_subject_id] = generate_instance_segmentation(
290
- prediction=pred_array, target=label_array
290
+ prediction=pred_array, target=label_array, parameters=parameters
291
291
  )
292
292
 
293
293
  elif problem_type == "synthesis":
@@ -1,4 +1,5 @@
1
1
  from pathlib import Path
2
+ import tempfile
2
3
 
3
4
  import numpy as np
4
5
 
@@ -6,7 +7,10 @@ from panoptica import Panoptica_Evaluator
6
7
 
7
8
 
8
9
  def generate_instance_segmentation(
9
- prediction: np.ndarray, target: np.ndarray, panoptica_config_path: str = None
10
+ prediction: np.ndarray,
11
+ target: np.ndarray,
12
+ parameters: dict = None,
13
+ panoptica_config_path: str = None,
10
14
  ) -> dict:
11
15
  """
12
16
  Evaluate a single exam using Panoptica.
@@ -14,6 +18,7 @@ def generate_instance_segmentation(
14
18
  Args:
15
19
  prediction (np.ndarray): The input prediction containing objects.
16
20
  label_path (str): The path to the reference label.
21
+ target (np.ndarray): The input target containing objects.
17
22
  panoptica_config_path (str): The path to the Panoptica configuration file.
18
23
 
19
24
  Returns:
@@ -21,11 +26,21 @@ def generate_instance_segmentation(
21
26
  """
22
27
 
23
28
  cwd = Path(__file__).parent.absolute()
24
- panoptica_config_path = (
25
- cwd / "panoptica_config_brats.yaml"
26
- if panoptica_config_path is None
27
- else panoptica_config_path
28
- )
29
+ # the parameters dict takes precedence over the panoptica_config_path
30
+ panoptica_config = parameters.get("panoptica_config", None)
31
+ if panoptica_config is None:
32
+ panoptica_config_path = (
33
+ cwd / "panoptica_config_brats.yaml"
34
+ if panoptica_config_path is None
35
+ else panoptica_config_path
36
+ )
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)
29
44
  evaluator = Panoptica_Evaluator.load_from_config(panoptica_config_path)
30
45
 
31
46
  # call evaluate
GANDLF/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.1.4-dev20250610"
1
+ __version__ = "0.1.4-dev20250612"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GANDLF
3
- Version: 0.1.4.dev20250610
3
+ Version: 0.1.4.dev20250612
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,14 +5,14 @@ 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=TSEmkWJ598nnrig3HD41R2tUwAc3_g0b31QBDWk3VBc,34
8
+ GANDLF/version.py,sha256=gGbVohMgfFwu60Ykq1JhAQJwAPDKpCTxPluhzigMGRw,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
12
12
  GANDLF/cli/config_generator.py,sha256=_j0aRV3puiIItJ1WOHRNVII_TkGJuH9ep6SuwPblcnc,4502
13
13
  GANDLF/cli/data_split_saver.py,sha256=72ygy9s3INt2NFAfSW4j9dxxmuuvfzfBTF0Hwh0nYBU,1720
14
14
  GANDLF/cli/deploy.py,sha256=7yPqRox6e5MB-VzHxmA4kt-W5dWwElxDm1mm019jN74,15155
15
- GANDLF/cli/generate_metrics.py,sha256=CsQC8oWWEFRfZXQet_qrtTYfWn16o3jXdOh_3976GvU,20406
15
+ GANDLF/cli/generate_metrics.py,sha256=ySQ5s0sGajXbr__HLOzsDtULhuZ3x7plqaC1Lz1oZto,20429
16
16
  GANDLF/cli/huggingface_hub_handler.py,sha256=vGQYwDiT3Y8yk_xLNkB8DgW1rYpEcwYp0TCdCO5oWTs,4631
17
17
  GANDLF/cli/main_run.py,sha256=gYNJQGvmwqBjj3ARRxj-y3R1PMOP4qTwcwFSRBbkh0k,4352
18
18
  GANDLF/cli/patch_extraction.py,sha256=30RpBfjpwE9GLRSSD7JRqwoHngESQL0eOt09n_5r18Q,3555
@@ -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=ExbobmLhlyKYRKE7zEhZmuHtu5fdIUDs-53K-u4AKX8,1026
114
+ GANDLF/metrics/segmentation_panoptica.py,sha256=aFGF3q_Fnf5vIWaJDMHcs2Az_fb23l2cvvifnCkgPO0,1611
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.dev20250610.dist-info/licenses/LICENSE,sha256=GlZPAfA4eckod8IVayhBXkqCpESXf6cc9BGli_Jwims,11357
186
- gandlf-0.1.4.dev20250610.dist-info/METADATA,sha256=uWMTZ9ZfIKwMqRkWwoUfAw21WLGvGHSwAbHdOH7-4Tg,9932
187
- gandlf-0.1.4.dev20250610.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
188
- gandlf-0.1.4.dev20250610.dist-info/entry_points.txt,sha256=agwocNI7Upi-sFDe1rMl71dGN8YhCBB7WJmtBHRF4jg,902
189
- gandlf-0.1.4.dev20250610.dist-info/top_level.txt,sha256=i5D9wEbQhl085_9Lx2m7x-9Zu6nlx1tjYYbuSihG09E,7
190
- gandlf-0.1.4.dev20250610.dist-info/RECORD,,
185
+ gandlf-0.1.4.dev20250612.dist-info/licenses/LICENSE,sha256=GlZPAfA4eckod8IVayhBXkqCpESXf6cc9BGli_Jwims,11357
186
+ gandlf-0.1.4.dev20250612.dist-info/METADATA,sha256=VmbeXSBOt1umWsVE7jgMGFgkQmZ92pisC9CST_7Ruxs,9932
187
+ gandlf-0.1.4.dev20250612.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
188
+ gandlf-0.1.4.dev20250612.dist-info/entry_points.txt,sha256=agwocNI7Upi-sFDe1rMl71dGN8YhCBB7WJmtBHRF4jg,902
189
+ gandlf-0.1.4.dev20250612.dist-info/top_level.txt,sha256=i5D9wEbQhl085_9Lx2m7x-9Zu6nlx1tjYYbuSihG09E,7
190
+ gandlf-0.1.4.dev20250612.dist-info/RECORD,,