Repository: Project-MONAI/MONAI

Issue:
progress bar with tqdm
**Is your feature request related to a problem? Please describe.**
instead of implementing the progress bar related functionality, [tqdm](https://github.com/tqdm/tqdm) looks like a good library to use directly. this ticket requests replacing the existing code to use tqdm implementations 



Discussion:

Resolving patch:
diff --git a/monai/application/utils.py b/monai/application/utils.py
--- a/monai/application/utils.py
+++ b/monai/application/utils.py
@@ -15,7 +15,7 @@
 import hashlib
 import tarfile
 import zipfile
-from monai.utils import process_bar
+from monai.utils import progress_bar
 
 
 def check_md5(filepath: str, md5_value: str = None):
@@ -65,7 +65,7 @@ def download_url(url: str, filepath: str, md5_value: str = None):
     os.makedirs(os.path.dirname(filepath), exist_ok=True)
 
     def _process_hook(blocknum, blocksize, totalsize):
-        process_bar(blocknum * blocksize, totalsize)
+        progress_bar(blocknum * blocksize, totalsize, f"Downloading {filepath.split('/')[-1]}:")
 
     try:
         urlretrieve(url, filepath, reporthook=_process_hook)
diff --git a/monai/data/dataset.py b/monai/data/dataset.py
--- a/monai/data/dataset.py
+++ b/monai/data/dataset.py
@@ -23,7 +23,7 @@
 
 from monai.transforms import Compose, Randomizable, Transform
 from monai.transforms.utils import apply_transform
-from monai.utils import get_seed, process_bar
+from monai.utils import get_seed, progress_bar
 
 
 class Dataset(_TorchDataset):
@@ -254,7 +254,6 @@ def __init__(
         self.cache_num = min(cache_num, int(len(self) * cache_rate), len(self))
         if self.cache_num > 0:
             self._cache = [None] * self.cache_num
-            print("Load and cache transformed data...")
             if num_workers > 0:
                 self._item_processed = 0
                 self._thread_lock = threading.Lock()
@@ -266,7 +265,7 @@ def __init__(
             else:
                 for i in range(self.cache_num):
                     self._cache[i] = self._load_cache_item(data[i], transform.transforms)
-                    process_bar(i + 1, self.cache_num)
+                    progress_bar(i + 1, self.cache_num, "Load and cache transformed data: ")
 
     def _load_cache_item(self, item, transforms):
         for _transform in transforms:
@@ -281,7 +280,7 @@ def _load_cache_item_thread(self, args):
         self._cache[i] = self._load_cache_item(item, transforms)
         with self._thread_lock:
             self._item_processed += 1
-            process_bar(self._item_processed, self.cache_num)
+            progress_bar(self._item_processed, self.cache_num, "Load and cache transformed data: ")
 
     def __getitem__(self, index):
         if index < self.cache_num:
diff --git a/monai/utils/misc.py b/monai/utils/misc.py
--- a/monai/utils/misc.py
+++ b/monai/utils/misc.py
@@ -96,19 +96,21 @@ def is_scalar(val):
     return np.isscalar(val)
 
 
-def process_bar(index: int, count: int, bar_len: int = 30, newline: bool = False):
-    """print a process bar to track some time consuming task.
+def progress_bar(index: int, count: int, desc: str = None, bar_len: int = 30, newline: bool = False):
+    """print a progress bar to track some time consuming task.
 
     Args:
-        index: current satus in process.
-        count: total steps of the process.
+        index: current satus in progress.
+        count: total steps of the progress.
+        desc: description of the progress bar, if not None, show before the progress bar.
         bar_len: the total length of the bar on screen, default is 30 char.
         newline: whether to print in a new line for every index.
     """
     end = "\r" if newline is False else "\r\n"
     filled_len = int(bar_len * index // count)
-    bar = "[" + "=" * filled_len + " " * (bar_len - filled_len) + "]"
-    print(f"{index}/{count} {bar:s}  ", end=end)
+    bar = f"{desc} " if desc is not None else ""
+    bar += "[" + "=" * filled_len + " " * (bar_len - filled_len) + "]"
+    print(f"{index}/{count} {bar}", end=end)
     if index == count:
         print("")
 


Test patch: