fastMONAI 0.3.2__py3-none-any.whl → 0.3.3__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.
fastMONAI/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.3.2"
1
+ __version__ = "0.3.3"
@@ -257,6 +257,7 @@ def download_medmnist3d_dataset(study: str, path: (str, Path) = '../data',
257
257
  dataset_file_path = path / f'{study}.npz'
258
258
 
259
259
  try:
260
+ #todo: check if dataset is downloaded
260
261
  download_url(url=MURLs.MEDMNIST_DICT[study], filepath=dataset_file_path)
261
262
  except:
262
263
  raise ValueError(f"Dataset '{study}' does not exist.")
fastMONAI/vision_data.py CHANGED
@@ -110,19 +110,19 @@ class MedImageDataLoaders(DataLoaders):
110
110
  # %% ../nbs/02_vision_data.ipynb 16
111
111
  @typedispatch
112
112
  def show_batch(x: MedImage, y, samples, ctxs=None, max_n=6, nrows=None,
113
- ncols=None, figsize=None, channel: int = 0, indices=None,
114
- anatomical_plane: int = 0, **kwargs):
115
- """Showing a batch of samples for classification and regression tasks."""
116
-
113
+ ncols=None, figsize=None, channel=0, indices=None,
114
+ anatomical_plane=0, **kwargs):
115
+ '''Showing a batch of samples for classification and regression tasks.'''
116
+
117
117
  if ctxs is None:
118
118
  ctxs = get_grid(min(len(samples), max_n), nrows=nrows, ncols=ncols, figsize=figsize)
119
-
119
+
120
120
  n = 1 if y is None else 2
121
121
 
122
122
  for i in range(n):
123
123
  ctxs = [
124
- b.show(ctx=c, channel=channel, indices=indices, anatomical_plane=anatomical_plane, **kwargs)
125
- for b, c, _ in zip(samples.itemgot(i), ctxs, range(max_n))
124
+ b.show(ctx=c, channel=channel, indices=indices, anatomical_plane=anatomical_plane, **kwargs)
125
+ for b,c,_ in zip(samples.itemgot(i),ctxs,range(max_n))
126
126
  ]
127
127
 
128
128
  plt.tight_layout()
@@ -131,9 +131,9 @@ def show_batch(x: MedImage, y, samples, ctxs=None, max_n=6, nrows=None,
131
131
 
132
132
  # %% ../nbs/02_vision_data.ipynb 17
133
133
  @typedispatch
134
- def show_batch(x: MedImage, y: MedMask, samples, ctxs=None, max_n=6, nrows: int = None,
135
- ncols: int = None, figsize=None, channel: int = 0, indices: int = None,
136
- anatomical_plane: int = 0, **kwargs):
134
+ def show_batch(x: MedImage, y: MedMask, samples, ctxs=None, max_n=6, nrows=None,
135
+ ncols=None, figsize=None, channel=0, indices=None,
136
+ anatomical_plane=0, **kwargs):
137
137
  """Showing a batch of decoded segmentation samples."""
138
138
 
139
139
  nrows, ncols = min(len(samples), max_n), x.shape[1] + 1
@@ -226,7 +226,7 @@ def show_results(x: MedImage, y: MedMask, samples, outs, ctxs=None, max_n: int =
226
226
 
227
227
  # %% ../nbs/02_vision_data.ipynb 23
228
228
  @typedispatch
229
- def plot_top_losses(x: MedImage, y, samples, outs, raws, losses, nrows: int = None,
229
+ def plot_top_losses(x: MedImage, y: TensorCategory, samples, outs, raws, losses, nrows: int = None,
230
230
  ncols: int = None, figsize=None, channel: int = 0, indices: int = None,
231
231
  anatomical_plane: int = 0, **kwargs):
232
232
  """Show images in top_losses along with their prediction, actual, loss, and probability of actual class."""
@@ -4,15 +4,16 @@
4
4
  __all__ = ['inference', 'refine_binary_pred_mask']
5
5
 
6
6
  # %% ../nbs/06_vision_inference.ipynb 1
7
- import numpy as np
7
+ from copy import copy
8
8
  from pathlib import Path
9
- from torchio import Resize
9
+ import torch
10
+ import numpy as np
10
11
  from scipy.ndimage import label
11
- from .vision_core import *
12
- from .vision_augmentation import do_pad_or_crop
13
12
  from skimage.morphology import remove_small_objects
14
13
  from SimpleITK import DICOMOrient, GetArrayFromImage
15
- from copy import copy
14
+ from torchio import Resize
15
+ from .vision_core import *
16
+ from .vision_augmentation import do_pad_or_crop
16
17
 
17
18
  # %% ../nbs/06_vision_inference.ipynb 3
18
19
  def _to_original_orientation(input_img, org_orientation):
@@ -74,7 +75,7 @@ def inference(learn_inf, reorder, resample, fn: (str, Path) = '',
74
75
  def refine_binary_pred_mask(pred_mask,
75
76
  remove_size: (int, float) = None,
76
77
  percentage: float = 0.2,
77
- verbose: bool = False) -> np.ndarray:
78
+ verbose: bool = False) -> torch.Tensor:
78
79
  """Removes small objects from the predicted binary mask.
79
80
 
80
81
  Args:
@@ -102,4 +103,4 @@ def refine_binary_pred_mask(pred_mask,
102
103
  processed_mask = remove_small_objects(
103
104
  labeled_mask, min_size=small_objects_threshold)
104
105
 
105
- return np.where(processed_mask > 0, 1., 0.)
106
+ return torch.Tensor(processed_mask > 0).float()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastMONAI
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: fastMONAI library
5
5
  Home-page: https://github.com/MMIV-ML/fastMONAI
6
6
  Author: Satheshkumar Kaliyugarasan
@@ -1,20 +1,20 @@
1
- fastMONAI/__init__.py,sha256=vNiWJ14r_cw5t_7UDqDQIVZvladKFGyHH2avsLpN7Vg,22
1
+ fastMONAI/__init__.py,sha256=8KcCYTXH99C2-gCLuPILJvtT9YftRWJsartIx6TQ2ZY,22
2
2
  fastMONAI/_modidx.py,sha256=AGOW75o_d2Vd7CBku-4zz53OzUqkp4QqTEqsucyU7jg,27510
3
3
  fastMONAI/dataset_info.py,sha256=w5LKGmEzFtlqhxqzhFLWUfyVkUL0EYypZQCH9Ay6jgg,4948
4
- fastMONAI/external_data.py,sha256=RWk_MVy4x7MuKz2A6cRAThz2diV0546gYZchLQtU3wg,10970
4
+ fastMONAI/external_data.py,sha256=Hq4GPEWsBi9-fyk9r3WlBdUZjfNzeaKe5uqTwFD8qfU,11016
5
5
  fastMONAI/research_utils.py,sha256=LZu62g8BQAVYS4dD7qDsKHJXZnDd1uLkJ6LoaMDhUhk,590
6
6
  fastMONAI/utils.py,sha256=9I5nl6Sb0NbTxhr6FDnW4dapDhzPtmxGcJeXkkY4v3E,1406
7
7
  fastMONAI/vision_all.py,sha256=qAsncBCDTx3Ae8Hw44TK4E5wflO-8JbRWBu0CRLLGnY,360
8
8
  fastMONAI/vision_augmentation.py,sha256=lAlrLm8jbXRmk9a6e8_o_CNTS6Pyp-KKNXwjpelUUJc,9070
9
9
  fastMONAI/vision_core.py,sha256=KDoLS9UYNsh5nPIYc2JiDjWBLy1IRSpjH9cqEHjk4Vw,7428
10
- fastMONAI/vision_data.py,sha256=uFs4SGPeFHwNL9tLhuz4yBYG-s4KBEh_YC8SBhVCj5I,10530
11
- fastMONAI/vision_inference.py,sha256=wd-zJbL28B3N5T_WQZXhjI8atNyAEVQUY9PGhTU7F9s,3699
10
+ fastMONAI/vision_data.py,sha256=QZqHK35L9sU9BiQ2nIqGzOEBAGHfuke7YloyZrPkYto,10491
11
+ fastMONAI/vision_inference.py,sha256=k-rGKhVtdrZT9GvQEglEa0sZ283ue16mEPTZ-ZSKc5Q,3744
12
12
  fastMONAI/vision_loss.py,sha256=NrHnk1yD4EBKsp6aippppXU4l-mwmsZOqE_bsZP3ZNI,3591
13
13
  fastMONAI/vision_metrics.py,sha256=CVxdOBPaMJT6Mo5jF3WoQj6a3C-_FsnBicMAU_ZrFS8,3549
14
14
  fastMONAI/vision_plot.py,sha256=S2_yE0VcAwECgvXHb1YMJbTZq4iREh-VIgPShLcUma0,3095
15
- fastMONAI-0.3.2.dist-info/LICENSE,sha256=xV8xoN4VOL0uw9X8RSs2IMuD_Ss_a9yAbtGNeBWZwnw,11337
16
- fastMONAI-0.3.2.dist-info/METADATA,sha256=dEvtIMtl-0ppdOzC_jjZpPKo33jPmfW_wxjWiqN8C5s,5770
17
- fastMONAI-0.3.2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
18
- fastMONAI-0.3.2.dist-info/entry_points.txt,sha256=mVBsykSXMairzzk3hJaQ8c-UiwUZqGnn4aFZ24CpsBM,40
19
- fastMONAI-0.3.2.dist-info/top_level.txt,sha256=o8y7SWF9odtnIT3jvYtUn9okbJRlaAMCy7oPFCeQvQ8,10
20
- fastMONAI-0.3.2.dist-info/RECORD,,
15
+ fastMONAI-0.3.3.dist-info/LICENSE,sha256=xV8xoN4VOL0uw9X8RSs2IMuD_Ss_a9yAbtGNeBWZwnw,11337
16
+ fastMONAI-0.3.3.dist-info/METADATA,sha256=xVkZtZdie9sgwLhpKNl8yZaA7YKFDDFLYB-PDo5yOeA,5770
17
+ fastMONAI-0.3.3.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
18
+ fastMONAI-0.3.3.dist-info/entry_points.txt,sha256=mVBsykSXMairzzk3hJaQ8c-UiwUZqGnn4aFZ24CpsBM,40
19
+ fastMONAI-0.3.3.dist-info/top_level.txt,sha256=o8y7SWF9odtnIT3jvYtUn9okbJRlaAMCy7oPFCeQvQ8,10
20
+ fastMONAI-0.3.3.dist-info/RECORD,,