fastMONAI 0.3.2__tar.gz → 0.3.3__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.
- {fastMONAI-0.3.2/fastMONAI.egg-info → fastMONAI-0.3.3}/PKG-INFO +1 -1
- fastMONAI-0.3.3/fastMONAI/__init__.py +1 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/fastMONAI/external_data.py +1 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/fastMONAI/vision_data.py +11 -11
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/fastMONAI/vision_inference.py +8 -7
- {fastMONAI-0.3.2 → fastMONAI-0.3.3/fastMONAI.egg-info}/PKG-INFO +1 -1
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/settings.ini +1 -1
- fastMONAI-0.3.2/fastMONAI/__init__.py +0 -1
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/CONTRIBUTING.md +0 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/LICENSE +0 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/MANIFEST.in +0 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/README.md +0 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/fastMONAI/_modidx.py +0 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/fastMONAI/dataset_info.py +0 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/fastMONAI/research_utils.py +0 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/fastMONAI/utils.py +0 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/fastMONAI/vision_all.py +0 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/fastMONAI/vision_augmentation.py +0 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/fastMONAI/vision_core.py +0 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/fastMONAI/vision_loss.py +0 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/fastMONAI/vision_metrics.py +0 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/fastMONAI/vision_plot.py +0 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/fastMONAI.egg-info/SOURCES.txt +0 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/fastMONAI.egg-info/dependency_links.txt +0 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/fastMONAI.egg-info/entry_points.txt +0 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/fastMONAI.egg-info/not-zip-safe +0 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/fastMONAI.egg-info/requires.txt +0 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/fastMONAI.egg-info/top_level.txt +0 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/setup.cfg +0 -0
- {fastMONAI-0.3.2 → fastMONAI-0.3.3}/setup.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
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.")
|
|
@@ -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
|
|
114
|
-
anatomical_plane
|
|
115
|
-
|
|
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,
|
|
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
|
|
135
|
-
ncols
|
|
136
|
-
anatomical_plane
|
|
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
|
-
|
|
7
|
+
from copy import copy
|
|
8
8
|
from pathlib import Path
|
|
9
|
-
|
|
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
|
|
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) ->
|
|
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
|
|
106
|
+
return torch.Tensor(processed_mask > 0).float()
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.3.2"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|