Repository: Project-MONAI/MONAI

Issue:
default transforms for MedNISTDataset and DecathlonDataset
**Is your feature request related to a problem? Please describe.**
MedNISTDataset and DecathlonDataset should by default use a loader transform and `Addchannel`, so that the user could quickly get started. (currently there's a default value for the transform argument)



Discussion:

Resolving patch:
diff --git a/monai/apps/datasets.py b/monai/apps/datasets.py
--- a/monai/apps/datasets.py
+++ b/monai/apps/datasets.py
@@ -15,7 +15,7 @@
 import numpy as np
 from typing import Any, Callable
 from monai.data import CacheDataset
-from monai.transforms import Randomizable
+from monai.transforms import Randomizable, LoadNiftid, LoadPNGd, AddChanneld, Compose
 from monai.data import load_decathalon_datalist
 from .utils import download_and_extract
 
@@ -28,7 +28,8 @@ class MedNISTDataset(Randomizable, CacheDataset):
     Args:
         root_dir: target directory to download and load MedNIST dataset.
         section: expected data section, can be: `training`, `validation` or `test`.
-        transform: transforms to execute operations on input data.
+        transform: transforms to execute operations on input data. the default transform is composed by
+            `LoadPNGd` and `AddChanneld`, which can load data into numpy array with [C, H, W] shape.
         download: whether to download and extract the MedNIST from resource link, default is False.
             if expected file already exists, skip downloading even set it to True.
             user can manually copy `MedNIST.tar.gz` file or `MedNIST` folder to root directory.
@@ -57,7 +58,7 @@ def __init__(
         self,
         root_dir: str,
         section: str,
-        transform: Callable[..., Any],
+        transform: Callable[..., Any] = Compose([LoadPNGd("image"), AddChanneld("image")]),
         download: bool = False,
         seed: int = 0,
         val_frac: float = 0.1,
@@ -136,7 +137,8 @@ class DecathlonDataset(Randomizable, CacheDataset):
             "Task03_Liver", "Task04_Hippocampus", "Task05_Prostate", "Task06_Lung", "Task07_Pancreas",
             "Task08_HepaticVessel", "Task09_Spleen", "Task10_Colon").
         section: expected data section, can be: `training`, `validation` or `test`.
-        transform: transforms to execute operations on input data.
+        transform: transforms to execute operations on input data. the default transform is composed by
+            `LoadNiftid` and `AddChanneld`, which can load data into numpy array with [C, H, W, D] shape.
         download: whether to download and extract the Decathlon from resource link, default is False.
             if expected file already exists, skip downloading even set it to True.
             user can manually copy tar file or dataset folder to the root directory.
@@ -202,7 +204,7 @@ def __init__(
         root_dir: str,
         task: str,
         section: str,
-        transform: Callable[..., Any],
+        transform: Callable[..., Any] = Compose([LoadNiftid(["image", "label"]), AddChanneld(["image", "label"])]),
         download: bool = False,
         seed: int = 0,
         val_frac: float = 0.2,
diff --git a/monai/apps/utils.py b/monai/apps/utils.py
--- a/monai/apps/utils.py
+++ b/monai/apps/utils.py
@@ -69,6 +69,8 @@ def download_url(url: str, filepath: str, md5_value: str = None):
 
     if url.startswith("https://drive.google.com"):
         gdown.download(url, filepath, quiet=False)
+        if not os.path.exists(filepath):
+            raise RuntimeError("download failed due to network issue or permission denied.")
     else:
 
         def _process_hook(blocknum, blocksize, totalsize):


Test patch:
diff --git a/tests/test_decathlondataset.py b/tests/test_decathlondataset.py
--- a/tests/test_decathlondataset.py
+++ b/tests/test_decathlondataset.py
@@ -39,9 +39,15 @@ def _test_dataset(dataset):
             self.assertTrue("image_meta_dict" in dataset[0])
             self.assertTupleEqual(dataset[0]["image"].shape, (1, 33, 47, 34))
 
-        data = DecathlonDataset(
-            root_dir=tempdir, task="Task04_Hippocampus", transform=transform, section="validation", download=True
-        )
+        try:
+            data = DecathlonDataset(
+                root_dir=tempdir, task="Task04_Hippocampus", transform=transform, section="validation", download=True
+            )
+        except RuntimeError as e:
+            if str(e).startswith("download failed due to network issue or permission denied."):
+                shutil.rmtree(tempdir)
+                return
+
         _test_dataset(data)
         data = DecathlonDataset(
             root_dir=tempdir, task="Task04_Hippocampus", transform=transform, section="validation", download=False