Skip to content

Commit

Permalink
Merge branch 'add-vsita2d-to-cellprofiler' of https://github.com/binl…
Browse files Browse the repository at this point in the history
…iunls/MONAILabel into add-vsita2d-to-cellprofiler
  • Loading branch information
binliunls committed Aug 2, 2024
2 parents dcfe2b1 + ab24f92 commit a611b4f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions monailabel/tasks/infer/vista.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
def writer(self, data: Dict[str, Any], extension=None, dtype=None) -> Tuple[Any, Any]:
def writer(self, data: Dict[str, Any], extension=None, dtype=None) -> Tuple[Any, Any]:
d = dict(data)
output_dir = d.get("output_dir", "")
output_ext = d.get("output_ext", "")
Expand All @@ -13,4 +13,4 @@ def writer(self, data: Dict[str, Any], extension=None, dtype=None) -> Tuple[Any,
for key in self.key_iterator(d):
label = d[key]
output_filename = f"{basename}{'_' + self.output_postfix if self.output_postfix else ''}{output_ext}"
output_filepath = os.path.join(output_dir, output_filename)
output_filepath = os.path.join(output_dir, output_filename)
6 changes: 4 additions & 2 deletions sample-apps/vista/lib/infers/vista.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import os
import logging
import os
from typing import Any, Dict, Tuple

from monai.utils import ImageMetaKey

from monailabel.tasks.infer.bundle import BundleInferTask

logger = logging.getLogger(__name__)
Expand All @@ -12,6 +13,7 @@ class VISTAInfer(BundleInferTask):
"""
This provides Inference Engine for pre-trained VISTA segmentation model.
"""

def writer(self, data: Dict[str, Any], extension=None, dtype=None) -> Tuple[Any, Any]:
d = dict(data)
output_dir = self.bundle_config.get_parsed_content("output_dir", instantiate=True)
Expand All @@ -28,4 +30,4 @@ def writer(self, data: Dict[str, Any], extension=None, dtype=None) -> Tuple[Any,
logger.info(f"Reusing the bundle output {output_filepath}.")
return output_filepath, {}
else:
super().writer(data=data, extension=extension, dtype=dtype)
super().writer(data=data, extension=extension, dtype=dtype)
2 changes: 1 addition & 1 deletion sample-apps/vista/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
import os
from typing import Dict

from lib.infers import VISTAInfer
from monai.transforms import Invertd, SaveImaged

from lib.infers import VISTAInfer
import monailabel
from monailabel.interfaces.app import MONAILabelApp
from monailabel.interfaces.tasks.infer_v2 import InferTask
Expand Down

0 comments on commit a611b4f

Please sign in to comment.